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); |
+} |