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

Unified Diff: pkg/analyzer/lib/plugin/options.dart

Issue 1418333002: OptionsValidator plugin extension and linter service. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Review feedback. 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
Index: pkg/analyzer/lib/plugin/options.dart
diff --git a/pkg/analyzer/lib/plugin/options.dart b/pkg/analyzer/lib/plugin/options.dart
index fb99a5070f5717c71d3992c6967c9ed63f9857d5..cec20c28f93ab9dda0fb2f29c128b9146ed23587 100644
--- a/pkg/analyzer/lib/plugin/options.dart
+++ b/pkg/analyzer/lib/plugin/options.dart
@@ -7,6 +7,7 @@
library analyzer.plugin.options;
import 'package:analyzer/src/generated/engine.dart';
+import 'package:analyzer/src/generated/error.dart';
import 'package:analyzer/src/plugin/options_plugin.dart';
import 'package:plugin/plugin.dart';
import 'package:yaml/yaml.dart';
@@ -18,8 +19,17 @@ final String OPTIONS_PROCESSOR_EXTENSION_POINT_ID = Plugin.join(
OptionsPlugin.UNIQUE_IDENTIFIER,
OptionsPlugin.OPTIONS_PROCESSOR_EXTENSION_POINT);
+/// The identifier of the extension point that allows plugins to validate
+/// options defined in the analysis options file. The object used as an
+/// extension must be an [OptionsValidator].
+final String OPTIONS_VALIDATOR_EXTENSION_POINT_ID = Plugin.join(
+ OptionsPlugin.UNIQUE_IDENTIFIER,
+ OptionsPlugin.OPTIONS_VALIDATOR_EXTENSION_POINT);
+
/// Processes options defined in the analysis options file.
///
+/// Clients may implement this class when implementing plugins.
+///
/// The options file format is intentionally very open-ended, giving clients
/// utmost flexibility in defining their own options. The only hardfast
/// expectation is that options files will contain a mapping from Strings
@@ -61,3 +71,14 @@ abstract class OptionsProcessor {
/// provided as well to allow for context-specific configuration.
void optionsProcessed(AnalysisContext context, Map<String, YamlNode> options);
}
+
+/// Validates options as defined in an analysis options file.
+///
+/// Clients may implement this class when implementing plugins.
+///
+/// See [OptionsProcessor] for a description of the options file format.
+///
+abstract class OptionsValidator {
+ /// Validate [options], reporting any errors to the given [reporter].
+ void validate(ErrorReporter reporter, Map<String, YamlNode> options);
+}
« no previous file with comments | « pkg/analysis_server/test/services/linter/linter_test.dart ('k') | pkg/analyzer/lib/src/plugin/options_plugin.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698