quick fix for UNDEFINED_LINT

Change-Id: I375d523ba7dcf7fbe8ab55c7efb38c80880e24c4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/367763
Auto-Submit: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
This commit is contained in:
pq 2024-05-24 17:07:11 +00:00 committed by Commit Queue
parent 51f8b43696
commit ab41d83dd9
3 changed files with 19 additions and 6 deletions

View file

@ -45,8 +45,8 @@
#
# Stats:
# - 42 "needsEvaluation"
# - 363 "needsFix"
# - 388 "hasFix"
# - 362 "needsFix"
# - 389 "hasFix"
# - 516 "noFix"
AnalysisOptionsErrorCode.INCLUDED_FILE_PARSE_ERROR:
@ -118,9 +118,7 @@ AnalysisOptionsWarningCode.REPLACED_LINT:
notes: |-
We should be able to replace the deprecated lint rule with its replacement.
AnalysisOptionsWarningCode.UNDEFINED_LINT:
status: needsFix
notes: |-
The fix is to remove the name of the lint rule.
status: hasFix
AnalysisOptionsWarningCode.UNRECOGNIZED_ERROR_CODE:
status: needsFix
notes: |-

View file

@ -30,6 +30,7 @@ class AnalysisOptionsFixGenerator {
AnalysisOptionsWarningCode.ANALYSIS_OPTION_DEPRECATED_WITH_REPLACEMENT,
AnalysisOptionsHintCode.DUPLICATE_RULE,
AnalysisOptionsWarningCode.REMOVED_LINT,
AnalysisOptionsWarningCode.UNDEFINED_LINT,
AnalysisOptionsWarningCode.UNSUPPORTED_OPTION_WITHOUT_VALUES,
];
@ -101,7 +102,8 @@ class AnalysisOptionsFixGenerator {
}
} else if (errorCode == AnalysisOptionsHintCode.DEPRECATED_LINT ||
errorCode == AnalysisOptionsHintCode.DUPLICATE_RULE ||
errorCode == AnalysisOptionsWarningCode.REMOVED_LINT) {
errorCode == AnalysisOptionsWarningCode.REMOVED_LINT ||
errorCode == AnalysisOptionsWarningCode.UNDEFINED_LINT) {
await _addFix_removeLint(coveringNodePath);
} else if (errorCode ==
AnalysisOptionsWarningCode.UNSUPPORTED_OPTION_WITHOUT_VALUES) {

View file

@ -133,6 +133,19 @@ linter:
- camel_case_types
- removed_rule
''', '''
linter:
rules:
- camel_case_types
''');
}
Future<void> test_undefined() async {
await assertHasFix('''
linter:
rules:
- camel_case_types
- undefined_rule
''', '''
linter:
rules:
- camel_case_types