E1850: source file is above the preferred size
A source file has more than 500 code lines, which is the preferred size of a file.
A source file has more than 500 code lines, which is the preferred size of a
file. Strict mode (--strict, ADR-0041) counts the code lines of a file, that
is the lines that carry code. Blank lines, # comments and """ documentation
blocks (single-line or multi-line, including structured contract: blocks) do
not count, so a complete docstring never pushes a file over a limit. Strict
mode reports the first limit the file crosses: E1850 above 500, E1851 from
600 and E1852 above 800. Without --strict the size of a file is not
checked. The message names the count, as in source file has 502 code lines; preferred limit is 500, and the report points at the start of the file. Strict
mode fails the run, so the finding is an error. The same files are measured by
actus check, actus build and actus test: every production .act file of
the package, whether or not another file imports it.
Example
The comment # catalog: repeat N stands for N copies of the lines up to
# catalog: end, with {n} replaced by the copy's number. The example is 250
functions step_001 to step_250, 2 code lines each, and main, which make
502 code lines.
Fix
Split the file by responsibility: move the declarations that belong together into a module of their own, so that each file stays below the limit.
When a large file is one cohesive unit that splitting would damage, mark it
with meta limitless("file") at its beginning (ADR-0048). The exception is
then visible in the source and in review, instead of hidden in a comment.
Run actus explain E1850 in your terminal to read this entry offline. Browse Strict & toolchain or all error codes.