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. |
*/ |