Skip to content

Commit ab118f3

Browse files
srawlinsCommit Queue
authored and
Commit Queue
committed
DAS: register ignore producers rather than hard-code them
FixProcessor has to be part of the analysis_server_plugin package, so it cannot have any dependencies on the analysis_server package. This removes one. Work towards #53402 Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try Change-Id: I935712bf75837ba95438ac9ed5f7ba5d8f941a7a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/376126 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]>
1 parent 56a50e8 commit ab118f3

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

pkg/analysis_server/lib/src/services/correction/fix_internal.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ import 'package:analysis_server/src/services/correction/dart/data_driven.dart';
9999
import 'package:analysis_server/src/services/correction/dart/extend_class_for_mixin.dart';
100100
import 'package:analysis_server/src/services/correction/dart/extract_local_variable.dart';
101101
import 'package:analysis_server/src/services/correction/dart/flutter_remove_widget.dart';
102+
import 'package:analysis_server/src/services/correction/dart/ignore_diagnostic.dart';
102103
import 'package:analysis_server/src/services/correction/dart/import_library.dart';
103104
import 'package:analysis_server/src/services/correction/dart/inline_invocation.dart';
104105
import 'package:analysis_server/src/services/correction/dart/inline_typedef.dart';
@@ -1833,6 +1834,11 @@ void registerBuiltInProducers() {
18331834
FixProcessor.nonLintMultiProducerMap.addAll(_builtInNonLintMultiProducers);
18341835
FixProcessor.nonLintProducerMap.addAll(_builtInNonLintProducers);
18351836
FixProcessor.parseLintProducerMap.addAll(_builtInParseLintProducers);
1837+
FixProcessor.ignoreProducerGenerators.addAll([
1838+
IgnoreDiagnosticOnLine.new,
1839+
IgnoreDiagnosticInFile.new,
1840+
IgnoreDiagnosticInAnalysisOptionsFile.new,
1841+
]);
18361842
}
18371843

18381844
/// Computer for Dart "fix all in file" fixes.

pkg/analysis_server/lib/src/services/correction/fix_processor.dart

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// BSD-style license that can be found in the LICENSE file.
44

55
import 'package:analysis_server/src/services/correction/bulk_fix_processor.dart';
6-
import 'package:analysis_server/src/services/correction/dart/ignore_diagnostic.dart';
76
import 'package:analysis_server/src/services/linter/lint_names.dart';
87
import 'package:analysis_server_plugin/edit/dart/correction_producer.dart';
98
import 'package:analysis_server_plugin/edit/fix/dart_fix_context.dart';
@@ -63,6 +62,10 @@ class FixProcessor {
6362
/// parsed results.
6463
static final Map<String, List<ProducerGenerator>> parseLintProducerMap = {};
6564

65+
/// A list of generators that are used to create correction producers that
66+
/// produce corrections that ignore diagnostics locally.
67+
static final List<ProducerGenerator> ignoreProducerGenerators = [];
68+
6669
final DartFixContext _fixContext;
6770

6871
final List<Fix> fixes = <Fix>[];
@@ -152,12 +155,7 @@ class FixProcessor {
152155
if (errorCode is LintCode ||
153156
errorCode is HintCode ||
154157
errorCode is WarningCode) {
155-
var generators = [
156-
IgnoreDiagnosticOnLine.new,
157-
IgnoreDiagnosticInFile.new,
158-
IgnoreDiagnosticInAnalysisOptionsFile.new,
159-
];
160-
for (var generator in generators) {
158+
for (var generator in ignoreProducerGenerators) {
161159
await compute(generator(context: context));
162160
}
163161
}

0 commit comments

Comments
 (0)