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

Side by Side 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: Reorder. 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 unified diff | Download patch
OLDNEW
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/analyzer.dart';
Brian Wilkerson 2015/10/24 15:32:17 Whatever we're importing from here is exported fro
pquitslund 2015/10/26 15:48:59 Interesting. Maybe we should cook up a lint for th
Brian Wilkerson 2015/10/26 16:07:14 I suspect that this doesn't come up very often. It
9 import 'package:analyzer/src/generated/engine.dart'; 10 import 'package:analyzer/src/generated/engine.dart';
10 import 'package:analyzer/src/plugin/options_plugin.dart'; 11 import 'package:analyzer/src/plugin/options_plugin.dart';
11 import 'package:plugin/plugin.dart'; 12 import 'package:plugin/plugin.dart';
12 import 'package:yaml/yaml.dart'; 13 import 'package:yaml/yaml.dart';
13 14
14 /// The identifier of the extension point that allows plugins to access 15 /// The identifier of the extension point that allows plugins to access
15 /// options defined in the analysis options file. The object used as an 16 /// options defined in the analysis options file. The object used as an
16 /// extension must be an [OptionsProcessor]. 17 /// extension must be an [OptionsProcessor].
17 final String OPTIONS_PROCESSOR_EXTENSION_POINT_ID = Plugin.join( 18 final String OPTIONS_PROCESSOR_EXTENSION_POINT_ID = Plugin.join(
18 OptionsPlugin.UNIQUE_IDENTIFIER, 19 OptionsPlugin.UNIQUE_IDENTIFIER,
19 OptionsPlugin.OPTIONS_PROCESSOR_EXTENSION_POINT); 20 OptionsPlugin.OPTIONS_PROCESSOR_EXTENSION_POINT);
20 21
22 /// The identifier of the extension point that allows plugins to validate
23 /// options defined in the analysis options file. The object used as an
24 /// extension must be an [OptionsValidator].
25 final String OPTIONS_VALIDATOR_EXTENSION_POINT_ID = Plugin.join(
26 OptionsPlugin.UNIQUE_IDENTIFIER,
27 OptionsPlugin.OPTIONS_VALIDATOR_EXTENSION_POINT);
28
21 /// Processes options defined in the analysis options file. 29 /// Processes options defined in the analysis options file.
22 /// 30 ///
23 /// The options file format is intentionally very open-ended, giving clients 31 /// The options file format is intentionally very open-ended, giving clients
24 /// utmost flexibility in defining their own options. The only hardfast 32 /// utmost flexibility in defining their own options. The only hardfast
25 /// expectation is that options files will contain a mapping from Strings 33 /// expectation is that options files will contain a mapping from Strings
26 /// (identifying 'scopes') to associated options. For example, the given 34 /// (identifying 'scopes') to associated options. For example, the given
27 /// content 35 /// content
28 /// 36 ///
29 /// linter: 37 /// linter:
30 /// rules: 38 /// rules:
(...skipping 23 matching lines...) Expand all
54 /// The options file is processed on analyzer initialization and 62 /// The options file is processed on analyzer initialization and
55 /// subsequently when the file is changed on disk. In the event of a 63 /// subsequently when the file is changed on disk. In the event of a
56 /// change notification, note that the notification simply indicates 64 /// change notification, note that the notification simply indicates
57 /// a change on disk. Content in specific option scopes may or may not 65 /// a change on disk. Content in specific option scopes may or may not
58 /// be different. It is up to the implementer to check whether specific 66 /// be different. It is up to the implementer to check whether specific
59 /// options have changed and to handle those changes appropriately. In 67 /// options have changed and to handle those changes appropriately. In
60 /// addition to the [options] map, the associated analysis [context] is 68 /// addition to the [options] map, the associated analysis [context] is
61 /// provided as well to allow for context-specific configuration. 69 /// provided as well to allow for context-specific configuration.
62 void optionsProcessed(AnalysisContext context, Map<String, YamlNode> options); 70 void optionsProcessed(AnalysisContext context, Map<String, YamlNode> options);
63 } 71 }
72
73 /// Validates options as defined in an analysis options file.
74 ///
75 /// See [OptionsProcessor] for a description of the options file format.
76 ///
Brian Wilkerson 2015/10/24 15:32:17 In the server plugins, I've been adding text indic
pquitslund 2015/10/26 15:48:59 Cool. Added. Do you have a doc anywhere with the
Brian Wilkerson 2015/10/26 16:07:14 No. We've been discussing the possibility of addin
77 abstract class OptionsValidator {
78 /// Validate [options], reporting any errors to the given [reporter].
79 void validate(ErrorReporter reporter, Map<String, YamlNode> options);
80 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698