avoid-long-records

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.
1final value = (1, 2, 3);
Record has 3 fields (max 2). Replace it with a named class.
1final value = (1, 2, 3);
2typedef 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>