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

Unified Diff: pkg/analysis_server/lib/src/context_manager.dart

Issue 1420363005: Error Suppression FTW. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Test fix. Created 5 years, 2 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/analysis_server/test/analysis/notification_analysis_options_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/context_manager.dart
diff --git a/pkg/analysis_server/lib/src/context_manager.dart b/pkg/analysis_server/lib/src/context_manager.dart
index b3dbca7bbf210ee758e27abfceead5b652cc1e8b..872020934cd2fc55b10bee288715feba2f5ad1e7 100644
--- a/pkg/analysis_server/lib/src/context_manager.dart
+++ b/pkg/analysis_server/lib/src/context_manager.dart
@@ -22,6 +22,7 @@ import 'package:analyzer/source/pub_package_map_provider.dart';
import 'package:analyzer/source/sdk_ext.dart';
import 'package:analyzer/src/context/context.dart' as context;
import 'package:analyzer/src/generated/engine.dart';
+import 'package:analyzer/src/generated/error.dart';
import 'package:analyzer/src/generated/java_engine.dart';
import 'package:analyzer/src/generated/java_io.dart';
import 'package:analyzer/src/generated/source.dart';
@@ -520,6 +521,10 @@ class ContextManagerImpl implements ContextManager {
if (exclude != null) {
setIgnorePatternsForContext(info, exclude);
}
+
+ // Set filters.
+ YamlNode filters = analyzer['errors'];
+ setFiltersForContext(info, filters);
}
@override
@@ -543,6 +548,26 @@ class ContextManagerImpl implements ContextManager {
setRoots(includedPaths, excludedPaths, packageRoots);
}
+ void setFiltersForContext(ContextInfo info, YamlNode codes) {
+ List<ErrorFilter> filters = <ErrorFilter>[];
+ // If codes are enumerated, collect them as filters; else leave filters
+ // empty to overwrite previous value.
+ if (codes is YamlMap) {
+ String code, value;
+ codes.nodes.forEach((k, v) {
+ if (k is YamlScalar && v is YamlScalar) {
+ value = v.value?.toString()?.toLowerCase();
+ if (value == 'false' || value == 'ignore') {
+ // Case-insensitive.
+ code = k.value?.toString()?.toUpperCase();
+ filters.add((AnalysisError error) => error.errorCode.name == code);
+ }
+ }
+ });
+ }
+ info.context.setConfigurationData(CONFIGURED_ERROR_FILTERS, filters);
+ }
+
/**
* Sets the [ignorePatterns] for the context having info [info].
*/
« no previous file with comments | « no previous file | pkg/analysis_server/test/analysis/notification_analysis_options_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698