avoid-long-records
- Group
- Complexity
- Path
lint/complexity/avoid-long-records- Default
- Off, opt in
- Origin
- Falcon
- Rule
- 83 of 512
Reports record values and record types with too many fields.
max-fields (integer, default: 6) limits positional and named fields together.
Invalid
example.dartdart
final value = (1, 2, 3);
typedef LargeRecord = (int, int, {int third});Record has 3 fields (max 2). Replace it with a named class.
1
final value = (1, 2, 3);Record has 3 fields (max 2). Replace it with a named class.
1
final value = (1, 2, 3);2
typedef LargeRecord = (int, int, {int third});Valid
example.dartdart
final value = (1, 2);
(int, {int second}) value2 = (1, second: 2);
final nested = ((1, 2), (3, 4));Configure avoid-long-records
Set its severity in falcon.json. See the configuration guide.
falcon.jsonjson
{
"linter": {
"rules": {
"complexity": {
"avoid-long-records": "error"
}
}
}
}Or silence one occurrence with a suppression comment; the reason is required.
example.dartdart
// falcon-ignore lint/complexity/avoid-long-records: <reason>More complexity rules
- avoid-nested-conditional-expressions
avoid-nested-conditional-expressionsFlags a ternary conditional expression nested inside another ternary.
- avoid-nested-if
avoid_nested_ifFlags an
ifstatement whose then-branch contains nestedifstatements. - avoid-nested-switch-expressions
Reports deeply nested switch expressions.
- avoid-nested-switches
Reports deeply nested switch statements.
- avoid-nested-try-statements
Reports deeply nested try statements.
- avoid-redundant-async
avoid-redundant-asyncrecommendedFlags an
asyncfunction whose body is a singlereturn await ...;. - avoid-unnecessary-containers
avoid_unnecessary_containersrecommendedflutterFlags a
Containerwhose only argument is achild. - avoid-unnecessary-type-assertions
avoid-unnecessary-type-assertionsrecommendedFlags an
ischeck whose result is already guaranteed by the resolved static type.