Skip to main content

avoid-long-files

added in: 1.10.0
⚙️

Warns when a file length (number of lines) exceeds the configured maximum.

Long files can be hard to read and maintain. Consider splitting them into several smaller ones.

⚙️ Config

Set max-length (default is 500) to configure the number of lines after which the rule should trigger.

dart_code_metrics:
...
rules:
...
- avoid-long-files:
max-length: 500

Example

❌ Bad:

// number of lines exceeds the configured 500 lines

✅ Good:

// number of lines is below the configured 500 lines