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

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

Issue 2821943003: Fix an issue with restoring certain lint issues from summary files. (Closed)
Patch Set: use const instead of final Created 3 years, 8 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
« no previous file with comments | « pkg/analyzer/lib/src/dart/error/lint_codes.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 import 'dart:collection'; 5 import 'dart:collection';
6 6
7 import 'package:analyzer/src/lint/config.dart'; 7 import 'package:analyzer/src/lint/config.dart';
8 import 'package:analyzer/src/lint/linter.dart'; 8 import 'package:analyzer/src/lint/linter.dart';
9 9
10 /** 10 /**
(...skipping 27 matching lines...) Expand all
38 * Return a list of the rules that are defined. 38 * Return a list of the rules that are defined.
39 */ 39 */
40 Iterable<LintRule> get rules => _ruleMap.values; 40 Iterable<LintRule> get rules => _ruleMap.values;
41 41
42 /** 42 /**
43 * Return the lint rule with the given [name]. 43 * Return the lint rule with the given [name].
44 */ 44 */
45 LintRule operator [](String name) => _ruleMap[name]; 45 LintRule operator [](String name) => _ruleMap[name];
46 46
47 /** 47 /**
48 * Return the lint rule with the given [name].
49 */
50 LintRule getRule(String name) => _ruleMap[name];
51
52 /**
48 * Return a list of the lint rules explicitly enabled by the given [config]. 53 * Return a list of the lint rules explicitly enabled by the given [config].
49 * 54 *
50 * For example: 55 * For example:
51 * my_rule: true 56 * my_rule: true
52 * 57 *
53 * enables `my_rule`. 58 * enables `my_rule`.
54 * 59 *
55 * Unspecified rules are treated as disabled by default. 60 * Unspecified rules are treated as disabled by default.
56 */ 61 */
57 Iterable<LintRule> enabled(LintConfig config) => rules 62 Iterable<LintRule> enabled(LintConfig config) => rules
58 .where((rule) => config.ruleConfigs.any((rc) => rc.enables(rule.name))); 63 .where((rule) => config.ruleConfigs.any((rc) => rc.enables(rule.name)));
59 64
60 /** 65 /**
61 * Add the given lint [rule] to this registry. 66 * Add the given lint [rule] to this registry.
62 */ 67 */
63 void register(LintRule rule) { 68 void register(LintRule rule) {
64 _ruleMap[rule.name] = rule; 69 _ruleMap[rule.name] = rule;
65 } 70 }
66 71
67 /** 72 /**
68 * Add the given lint [rule] to this registry and mark it as being a default 73 * Add the given lint [rule] to this registry and mark it as being a default
69 * lint (one that will be run if lints are requested but no rules are enabled. 74 * lint (one that will be run if lints are requested but no rules are enabled.
70 */ 75 */
71 void registerDefault(LintRule rule) { 76 void registerDefault(LintRule rule) {
72 register(rule); 77 register(rule);
73 _defaultRules.add(rule); 78 _defaultRules.add(rule);
74 } 79 }
75 } 80 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/dart/error/lint_codes.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698