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

Side by Side Diff: pkg/analyzer/lib/src/lint/registry.dart

Issue 2561573003: Revert "Move the linter core to the analyzer package" (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « pkg/analyzer/lib/src/lint/pub.dart ('k') | pkg/analyzer/lib/src/lint/util.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 import 'dart:collection';
6
7 import 'package:analyzer/src/lint/config.dart';
8 import 'package:analyzer/src/lint/linter.dart';
9
10 /**
11 * Registry of contributed lint rules.
12 */
13 class Registry extends Object with IterableMixin<LintRule> {
14 /**
15 * The default registry to be used by clients.
16 */
17 static final Registry ruleRegistry = new Registry();
18
19 Map<String, LintRule> _ruleMap = <String, LintRule>{};
20
21 @override
22 Iterator<LintRule> get iterator => _ruleMap.values.iterator;
23
24 Iterable<LintRule> get rules => _ruleMap.values;
25
26 LintRule operator [](String key) => _ruleMap[key];
27
28 /// All lint rules explicitly enabled by the given [config].
29 ///
30 /// For example:
31 /// my_rule: true
32 ///
33 /// enables `my_rule`.
34 ///
35 /// Unspecified rules are treated as disabled by default.
36 Iterable<LintRule> enabled(LintConfig config) => rules
37 .where((rule) => config.ruleConfigs.any((rc) => rc.enables(rule.name)));
38
39 void register(LintRule rule) {
40 _ruleMap[rule.name] = rule;
41 }
42 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/lint/pub.dart ('k') | pkg/analyzer/lib/src/lint/util.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698