avoid-similar-names
added in: 1.1.0
style
Checks for names within the scope that are very similar and thus confusing.
Use show-similarity
configuration (default is false
), if you want similarity to be displayed in the issue message.
Use similarity-threshold
configuration (default is 0.8
), if you want to tune the similarity comparison.
Use ignored-names
configuration, if you want to ignore specific names.
⚙️ Config example
dart_code_metrics:
...
rules:
...
- avoid-similar-names:
show-similarity: true
similarity-threshold: 0.9
ignored-names:
- some
- name
Example
❌ Bad:
void main() {
final value = '1';
final value2 = '2'; // LINT
}
✅ Good:
void main() {
final value = '1';
final anotherValue = '2';
}