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

Unified Diff: pkg/analyzer/lib/src/context/builder.dart

Issue 2716693003: enhance ContextBuilder getAnalysisOptions to handle lints (Closed)
Patch Set: Created 3 years, 10 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
Index: pkg/analyzer/lib/src/context/builder.dart
diff --git a/pkg/analyzer/lib/src/context/builder.dart b/pkg/analyzer/lib/src/context/builder.dart
index eef1373e1cc693f0f254f73485e4ffd71fe54d45..05421729840a748034c0dfa91208f933c66ed52c 100644
--- a/pkg/analyzer/lib/src/context/builder.dart
+++ b/pkg/analyzer/lib/src/context/builder.dart
@@ -25,6 +25,7 @@ import 'package:analyzer/src/generated/gn.dart';
import 'package:analyzer/src/generated/sdk.dart';
import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer/src/generated/workspace.dart';
+import 'package:analyzer/src/lint/registry.dart';
import 'package:analyzer/src/summary/summary_sdk.dart';
import 'package:analyzer/src/task/options.dart';
import 'package:args/args.dart';
@@ -410,6 +411,10 @@ class ContextBuilder {
applyToAnalysisOptions(options, optionMap);
if (builderOptions.argResults != null) {
applyAnalysisOptionFlags(options, builderOptions.argResults);
+ // If lints turned on but none specified, then enable default lints
+ if (options.lint && options.lintRules.isEmpty) {
+ options.lintRules = Registry.ruleRegistry.defaultRules;
+ }
}
}
return options;
« no previous file with comments | « pkg/analyzer/lib/src/command_line/arguments.dart ('k') | pkg/analyzer/test/src/command_line/arguments_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698