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 library analyzer.src.task.options; | 5 library analyzer.src.task.options; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 | 8 |
9 import 'package:analyzer/analyzer.dart'; | 9 import 'package:analyzer/analyzer.dart'; |
10 import 'package:analyzer/plugin/options.dart'; | 10 import 'package:analyzer/plugin/options.dart'; |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 var filters = analyzer[AnalyzerOptions.errors]; | 509 var filters = analyzer[AnalyzerOptions.errors]; |
510 _applyProcessors(options, filters); | 510 _applyProcessors(options, filters); |
511 | 511 |
512 // Process language options. | 512 // Process language options. |
513 var language = analyzer[AnalyzerOptions.language]; | 513 var language = analyzer[AnalyzerOptions.language]; |
514 _applyLanguageOptions(options, language); | 514 _applyLanguageOptions(options, language); |
515 | 515 |
516 // Process excludes. | 516 // Process excludes. |
517 var excludes = analyzer[AnalyzerOptions.exclude]; | 517 var excludes = analyzer[AnalyzerOptions.exclude]; |
518 _applyExcludes(options, excludes); | 518 _applyExcludes(options, excludes); |
| 519 |
| 520 // Process plugins. |
| 521 var names = analyzer[AnalyzerOptions.plugins]; |
| 522 List<String> pluginNames = <String>[]; |
| 523 if (names is String) { |
| 524 pluginNames.add(names); |
| 525 } else if (names is YamlList) { |
| 526 for (var element in names) { |
| 527 if (element is String) { |
| 528 pluginNames.add(element); |
| 529 } |
| 530 } |
| 531 } else if (names is YamlMap) { |
| 532 for (var key in names.keys) { |
| 533 if (key is String) { |
| 534 pluginNames.add(key); |
| 535 } |
| 536 } |
| 537 } |
| 538 options.enabledPluginNames = pluginNames; |
519 } | 539 } |
520 | 540 |
521 LintConfig config = parseConfig(optionMap); | 541 LintConfig config = parseConfig(optionMap); |
522 if (config != null) { | 542 if (config != null) { |
523 Iterable<LintRule> lintRules = Registry.ruleRegistry.enabled(config); | 543 Iterable<LintRule> lintRules = Registry.ruleRegistry.enabled(config); |
524 if (lintRules.isNotEmpty) { | 544 if (lintRules.isNotEmpty) { |
525 options.lint = true; | 545 options.lint = true; |
526 options.lintRules = lintRules.toList(); | 546 options.lintRules = lintRules.toList(); |
527 } | 547 } |
528 } | 548 } |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 } | 615 } |
596 }); | 616 }); |
597 } else if (config is Map) { | 617 } else if (config is Map) { |
598 options.strongMode = true; | 618 options.strongMode = true; |
599 config.forEach((k, v) => _applyStrongModeOption(options, k, v)); | 619 config.forEach((k, v) => _applyStrongModeOption(options, k, v)); |
600 } else { | 620 } else { |
601 options.strongMode = config is bool ? config : false; | 621 options.strongMode = config is bool ? config : false; |
602 } | 622 } |
603 } | 623 } |
604 } | 624 } |
OLD | NEW |