quick fix for `DUPLICATE_RULE`

Change-Id: I49c75bcaa12eefc06b1e906983b482a51466c134
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/367740
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Auto-Submit: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
diff --git a/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml b/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml
index 8271120..2e85863 100644
--- a/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml
+++ b/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml
@@ -45,8 +45,8 @@
 #
 # Stats:
 # -  42 "needsEvaluation"
-# - 365 "needsFix"
-# - 386 "hasFix"
+# - 364 "needsFix"
+# - 387 "hasFix"
 # - 516 "noFix"
 
 AnalysisOptionsErrorCode.INCLUDED_FILE_PARSE_ERROR:
@@ -65,9 +65,7 @@
   notes: |-
     We should be able to replace the deprecated lint rule with its replacement.
 AnalysisOptionsHintCode.DUPLICATE_RULE:
-  status: needsFix
-  notes: |-
-    We could offer to remove the duplicate rule.
+  status: hasFix
 AnalysisOptionsWarningCode.ANALYSIS_OPTION_DEPRECATED:
   status: needsFix
   notes: |-
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/analysis_options/fix_generator.dart b/pkg/analysis_server/lib/src/services/correction/fix/analysis_options/fix_generator.dart
index 7a33713..0698082 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/analysis_options/fix_generator.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/analysis_options/fix_generator.dart
@@ -28,6 +28,7 @@
   static const List<ErrorCode> codesWithFixes = [
     AnalysisOptionsHintCode.DEPRECATED_LINT,
     AnalysisOptionsWarningCode.ANALYSIS_OPTION_DEPRECATED_WITH_REPLACEMENT,
+    AnalysisOptionsHintCode.DUPLICATE_RULE,
     AnalysisOptionsWarningCode.UNSUPPORTED_OPTION_WITHOUT_VALUES,
   ];
 
@@ -97,7 +98,8 @@
         await _addFix_replaceWithStrictRawTypes(
             coveringNodePath, analyzerMap, strongModeMap);
       }
-    } else if (errorCode == AnalysisOptionsHintCode.DEPRECATED_LINT) {
+    } else if (errorCode == AnalysisOptionsHintCode.DEPRECATED_LINT ||
+        errorCode == AnalysisOptionsHintCode.DUPLICATE_RULE) {
       await _addFix_removeLint(coveringNodePath);
     } else if (errorCode ==
         AnalysisOptionsWarningCode.UNSUPPORTED_OPTION_WITHOUT_VALUES) {
diff --git a/pkg/analysis_server/test/src/services/correction/fix/analysis_options/remove_lint_test.dart b/pkg/analysis_server/test/src/services/correction/fix/analysis_options/remove_lint_test.dart
index 459b733..45e806a 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/analysis_options/remove_lint_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/analysis_options/remove_lint_test.dart
@@ -99,4 +99,17 @@
     - camel_case_types
 ''');
   }
+
+  Future<void> test_duplicated() async {
+    await assertHasFix('''
+linter:
+  rules:
+    - camel_case_types
+    - camel_case_types
+''', '''
+linter:
+  rules:
+    - camel_case_types
+''');
+  }
 }