max-statements
- Group
- Complexity
- Path
lint/complexity/max-statements- Default
- Off, opt in
- Origin
- Falcon
- Rule
- 264 of 512
Reports function bodies with too many statements.
max-statements (integer, default: 20) limits executable and declaration
statements, excluding blocks, labels, empty statements, and local function
declarations. Nested callable bodies are measured independently.
Invalid
void handle() {
print(1);
if (true) { print(2); }
}void handle() {Valid
void handle() { print(1); print(2); }
void outer() {
void local() { print(1); print(2); }
local();
}
int arrow() => 1;Configure max-statements
Set its severity in falcon.json. See the configuration guide.
{
"linter": {
"rules": {
"complexity": {
"max-statements": "error"
}
}
}
}Or silence one occurrence with a suppression comment; the reason is required.
// falcon-ignore lint/complexity/max-statements: <reason>More complexity rules
- max-switch-cases
max_switch_casesFlags a
switchstatement with more than the configured number of cases. - maximum-nesting-level
maximum_nesting_levelFlags a function whose control-flow nesting runs deeper than the configured level.
- no-boolean-literal-compare
no-boolean-literal-comparerecommendedDon't compare boolean values to boolean literals.
- one-member-abstracts
one_member_abstractsFlags abstract classes whose only member is a single abstract method.
- prefer-conditional-assignment
prefer_conditional_assignmentrecommendedFlags
if (x == null) { x = y; }with no else branch. - prefer-conditional-expressions
prefer-conditional-expressionsFlags an
if/elsewhose branches each reduce to a single return or a single assignment to the same target. - prefer-expression-function-bodies
prefer_expression_function_bodiesFlags block function bodies that consist of a single
returnof a value. - prefer-extracting-callbacks
prefer-extracting-callbacksflutterFlags inline block-body callbacks passed to Widget constructors.