avoid-similar-names
added in: 1.1.0
style
Checks for names within the scope that are very similar and thus confusing.
⚙️ Config
Set show-similarity
(default is false
) to display similarity in the issue message.
Set similarity-threshold
(default is 0.8
) to tune the similarity comparison.
Set ignored-names
(default is none) to ignore specific names.
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';
}