A method has more lines of code than the configured maximum
What it finds
A method that runs over many screens is hard to hold in mind at once: its variables live long, its cases interleave, and a change in one part affects others in ways that are easy to miss. Splitting it along its steps gives each step a name.
The length is counted in lines of code of the whole declaration: lines with at least one token, so blank lines and lines with only comments do not count. Lambdas and local functions count toward the member they are written in. The maximum is the parameter max_lines, 80 by default.
From the rule's source, long_method.rs.
Turn it on, off or suppress it
The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/csharp:long-method" = "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/csharp:long-method] reason="..."tx0 explain tx0/csharp:long-method shows the same in the terminal. Found a false positive? Report it.