match-class-name-pattern
added in: 1.8.0
style
Configure class names to match the given pattern.
⚙️ Config
Set entries
(default is empty) to configure a list of entries for class names to match.
Each entry is an object with 3 fields: path
, pattern
and ignore-private
.
Set path
(can be a regular expression) to configure the path to trigger on.
Set pattern
(can be a regular expression) to configure a pattern that all class names in the given file should match.
Set ignore-private
to exclude private classes from the rule's check.
dart_code_metrics:
...
rules:
...
- match-class-name-pattern:
entries:
- path: '.*state.dart'
pattern: 'State$'
ignore-private: true
note
This rule requires configuration in order to highlight any issues.
Example
❌ Bad:
// LINT
class SomeClass {
...
}
class MyState {}
✅ Good:
class SomeState {
...
}
class MyState {}