A file has more lines of code than the configured maximum

tx0/go:long-filestrictwarningmaintainability

What it finds

A very long file usually holds several concerns that grew together. Finding one's way in it takes longer, and changes to unrelated parts of it meet in reviews and merges. Go packages can spread over any number of files, so splitting costs nothing.

Lines of code are lines with at least one token; blank lines and lines with only comments do not count. The maximum is the parameter max_lines, 1000 by default. The finding is placed on the package clause.

From the rule's source, long_file.rs.

Turn it on, off or suppress it

The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/go:long-file" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/go:long-file] reason="..."

tx0 explain tx0/go:long-file shows the same in the terminal. Found a false positive? Report it.