Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1059)

Unified Diff: pkg/analyzer/lib/src/dart/analysis/driver.dart

Issue 2821943003: Fix an issue with restoring certain lint issues from summary files. (Closed)
Patch Set: use const instead of final Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/dart/error/lint_codes.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/dart/analysis/driver.dart
diff --git a/pkg/analyzer/lib/src/dart/analysis/driver.dart b/pkg/analyzer/lib/src/dart/analysis/driver.dart
index fa3aafcd3038838f2e41ad974ea42155da72be83..33d58ff6b66b146bd9c0f12b0cd6da62892272ce 100644
--- a/pkg/analyzer/lib/src/dart/analysis/driver.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart
@@ -26,7 +26,7 @@ import 'package:analyzer/src/dart/analysis/top_level_declaration.dart';
import 'package:analyzer/src/generated/engine.dart'
show AnalysisContext, AnalysisEngine, AnalysisOptions;
import 'package:analyzer/src/generated/source.dart';
-import 'package:analyzer/src/services/lint.dart';
+import 'package:analyzer/src/lint/registry.dart' as linter;
import 'package:analyzer/src/summary/api_signature.dart';
import 'package:analyzer/src/summary/format.dart';
import 'package:analyzer/src/summary/idl.dart';
@@ -1176,19 +1176,21 @@ class AnalysisDriver implements AnalysisDriverGeneric {
/**
* Return the lint code with the given [errorName], or `null` if there is no
- * lint registered with that name or the lint is not enabled in the analysis
- * options.
+ * lint registered with that name.
*/
ErrorCode _lintCodeByUniqueName(String errorName) {
- if (errorName.startsWith('_LintCode.')) {
- String lintName = errorName.substring(10);
- List<Linter> lintRules = _analysisOptions.lintRules;
- for (Linter linter in lintRules) {
- if (linter.name == lintName) {
- return linter.lintCode;
- }
- }
+ const String lintPrefix = 'LintCode.';
+ if (errorName.startsWith(lintPrefix)) {
+ String lintName = errorName.substring(lintPrefix.length);
+ return linter.Registry.ruleRegistry.getRule(lintName)?.lintCode;
}
+
+ const String lintPrefixOld = '_LintCode.';
+ if (errorName.startsWith(lintPrefixOld)) {
+ String lintName = errorName.substring(lintPrefixOld.length);
+ return linter.Registry.ruleRegistry.getRule(lintName)?.lintCode;
+ }
+
return null;
}
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/dart/error/lint_codes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698