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

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

Issue 2976473003: add analysis server --flutter-repo startup flag (Closed)
Patch Set: address comments Created 3 years, 5 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 | « pkg/analysis_server/lib/src/server/driver.dart ('k') | pkg/analyzer/test/src/context/builder_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 fe138d372793a38b5c84634dafa952963f09d98b..4f79e23469777065983169b906c3c1927072b285 100644
--- a/pkg/analyzer/lib/src/context/builder.dart
+++ b/pkg/analyzer/lib/src/context/builder.dart
@@ -29,6 +29,7 @@ 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/services/lint.dart';
import 'package:analyzer/src/summary/summary_sdk.dart';
import 'package:analyzer/src/task/options.dart';
import 'package:args/args.dart';
@@ -458,6 +459,17 @@ class ContextBuilder {
verbose('Using default lint rules');
}
}
+ if (ContextBuilderOptions.flutterRepo) {
+ const lintName = 'public_member_api_docs';
+ Linter rule = options.lintRules.firstWhere(
+ (Linter lint) => lint.name == lintName,
+ orElse: () => null);
+ if (rule == null) {
+ rule = Registry.ruleRegistry
+ .firstWhere((Linter lint) => lint.name == lintName);
+ options.lintRules = new List.from(options.lintRules)..add(rule);
+ }
+ }
} else {
verbose('Using default analysis options');
}
@@ -609,6 +621,12 @@ class ContextBuilder {
*/
class ContextBuilderOptions {
/**
+ * A flag indicating that the flutter repository is being analyzed.
+ * See comments in source for `flutter analyze --watch`.
+ */
+ static bool flutterRepo = false;
+
+ /**
* The results of parsing the command line arguments as defined by
* [defineAnalysisArguments] or `null` if none.
*/
« no previous file with comments | « pkg/analysis_server/lib/src/server/driver.dart ('k') | pkg/analyzer/test/src/context/builder_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698