OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 /// Support for client code that wants to consume options contributed to the | 5 /// Support for client code that wants to consume options contributed to the |
6 /// analysis options file. | 6 /// analysis options file. |
7 library analyzer.plugin.options; | 7 library analyzer.plugin.options; |
8 | 8 |
9 import 'package:analyzer/error/listener.dart'; | 9 import 'package:analyzer/error/listener.dart'; |
10 import 'package:analyzer/src/plugin/options_plugin.dart'; | |
11 import 'package:plugin/plugin.dart'; | |
12 import 'package:yaml/yaml.dart'; | 10 import 'package:yaml/yaml.dart'; |
13 | 11 |
14 /// The identifier of the extension point that allows plugins to validate | |
15 /// options defined in the analysis options file. The object used as an | |
16 /// extension must be an [OptionsValidator]. | |
17 final String OPTIONS_VALIDATOR_EXTENSION_POINT_ID = Plugin.join( | |
18 OptionsPlugin.UNIQUE_IDENTIFIER, | |
19 OptionsPlugin.OPTIONS_VALIDATOR_EXTENSION_POINT); | |
20 | |
21 /// Validates options as defined in an analysis options file. | 12 /// Validates options as defined in an analysis options file. |
22 /// | 13 /// |
23 /// The options file format is intentionally very open-ended, giving clients | 14 /// The options file format is intentionally very open-ended, giving clients |
24 /// utmost flexibility in defining their own options. The only hardfast | 15 /// utmost flexibility in defining their own options. The only hardfast |
25 /// expectation is that options files will contain a mapping from Strings | 16 /// expectation is that options files will contain a mapping from Strings |
26 /// (identifying 'scopes') to associated options. For example, the given | 17 /// (identifying 'scopes') to associated options. For example, the given |
27 /// content | 18 /// content |
28 /// | 19 /// |
29 /// linter: | 20 /// linter: |
30 /// rules: | 21 /// rules: |
(...skipping 14 matching lines...) Expand all Loading... |
45 /// | 36 /// |
46 /// bool useMultiPackage = | 37 /// bool useMultiPackage = |
47 /// options['compiler']['resolver']['useMultiPackage']; | 38 /// options['compiler']['resolver']['useMultiPackage']; |
48 /// | 39 /// |
49 /// Clients may implement this class when implementing plugins. | 40 /// Clients may implement this class when implementing plugins. |
50 /// | 41 /// |
51 abstract class OptionsValidator { | 42 abstract class OptionsValidator { |
52 /// Validate [options], reporting any errors to the given [reporter]. | 43 /// Validate [options], reporting any errors to the given [reporter]. |
53 void validate(ErrorReporter reporter, Map<String, YamlNode> options); | 44 void validate(ErrorReporter reporter, Map<String, YamlNode> options); |
54 } | 45 } |
OLD | NEW |