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

Side by Side Diff: pkg/analysis_server/lib/src/services/linter/linter.dart

Issue 1752183003: Handle incomplete rule options gracefully. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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 | « no previous file | pkg/analysis_server/test/services/linter/linter_test.dart » ('j') | 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library services.src.linter; 5 library services.src.linter;
6 6
7 import 'package:analyzer/analyzer.dart'; 7 import 'package:analyzer/analyzer.dart';
8 import 'package:analyzer/plugin/options.dart'; 8 import 'package:analyzer/plugin/options.dart';
9 import 'package:linter/src/rules.dart'; 9 import 'package:linter/src/rules.dart';
10 import 'package:yaml/yaml.dart'; 10 import 'package:yaml/yaml.dart';
(...skipping 22 matching lines...) Expand all
33 validateRules(rules, reporter); 33 validateRules(rules, reporter);
34 } 34 }
35 return errors; 35 return errors;
36 } 36 }
37 37
38 validateRules(dynamic rules, ErrorReporter reporter) { 38 validateRules(dynamic rules, ErrorReporter reporter) {
39 if (rules is YamlList) { 39 if (rules is YamlList) {
40 //TODO(pq): migrate this to a proper API once there is one. 40 //TODO(pq): migrate this to a proper API once there is one.
41 Iterable<String> registeredLints = ruleRegistry.map((r) => r.name); 41 Iterable<String> registeredLints = ruleRegistry.map((r) => r.name);
42 rules.nodes.forEach((YamlNode ruleNode) { 42 rules.nodes.forEach((YamlNode ruleNode) {
43 if (!registeredLints.contains(ruleNode.value)) { 43 Object value = ruleNode.value;
44 if (value != null && !registeredLints.contains(value)) {
44 reporter.reportErrorForSpan( 45 reporter.reportErrorForSpan(
45 UNDEFINED_LINT_WARNING, ruleNode.span, [ruleNode.value]); 46 UNDEFINED_LINT_WARNING, ruleNode.span, [value]);
46 } 47 }
47 }); 48 });
48 } 49 }
49 } 50 }
50 } 51 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/linter/linter_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698