E1851: source file has reached the size where it must be split

View source

A source file has 600 or more code lines, the size at which strict mode (--strict, ADR-0041) requires the file to be split.

A source file has 600 or more code lines, the size at which strict mode (--strict, ADR-0041) requires the file to be split. The code lines are the lines that carry code; blank lines, # comments and """ documentation blocks do not count. E1850 reports a file above 500 code lines and E1852 one above 800; this code is the range between. The message names the count, as in source file has 600 code lines; split is required at 600.

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 299 functions step_001 to step_299, 2 code lines each, and main, which make 600 code lines.

actus
# catalog: repeat 299
verb step_{n}() {
}
# catalog: end
verb main() {
}

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.

actus
import steps;

"""Entry point of the example; it does nothing and returns no value."""
verb main() {
}
actus
"""Re-export the first step moved out of the large file."""
open first;
actus
"""Do nothing, as the first step that was moved out of the large file."""
open verb first_step() {
}

Run actus explain E1851 in your terminal to read this entry offline. Browse Strict & toolchain or all error codes.