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_cli.src.driver; | 5 library analyzer_cli.src.driver; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:convert'; | 8 import 'dart:convert'; |
9 import 'dart:io' as io; | 9 import 'dart:io' as io; |
10 | 10 |
(...skipping 24 matching lines...) Expand all Loading... |
35 import 'package:analyzer/src/summary/package_bundle_reader.dart'; | 35 import 'package:analyzer/src/summary/package_bundle_reader.dart'; |
36 import 'package:analyzer/src/summary/summary_sdk.dart' show SummaryBasedDartSdk; | 36 import 'package:analyzer/src/summary/summary_sdk.dart' show SummaryBasedDartSdk; |
37 import 'package:analyzer/src/task/options.dart'; | 37 import 'package:analyzer/src/task/options.dart'; |
38 import 'package:analyzer_cli/src/analyzer_impl.dart'; | 38 import 'package:analyzer_cli/src/analyzer_impl.dart'; |
39 import 'package:analyzer_cli/src/build_mode.dart'; | 39 import 'package:analyzer_cli/src/build_mode.dart'; |
40 import 'package:analyzer_cli/src/error_formatter.dart'; | 40 import 'package:analyzer_cli/src/error_formatter.dart'; |
41 import 'package:analyzer_cli/src/options.dart'; | 41 import 'package:analyzer_cli/src/options.dart'; |
42 import 'package:analyzer_cli/src/perf_report.dart'; | 42 import 'package:analyzer_cli/src/perf_report.dart'; |
43 import 'package:analyzer_cli/starter.dart'; | 43 import 'package:analyzer_cli/starter.dart'; |
44 import 'package:linter/src/plugin/linter_plugin.dart'; | 44 import 'package:linter/src/plugin/linter_plugin.dart'; |
| 45 import 'package:linter/src/rules.dart' as linter; |
45 import 'package:package_config/discovery.dart' as pkg_discovery; | 46 import 'package:package_config/discovery.dart' as pkg_discovery; |
46 import 'package:package_config/packages.dart' show Packages; | 47 import 'package:package_config/packages.dart' show Packages; |
47 import 'package:package_config/packages_file.dart' as pkgfile show parse; | 48 import 'package:package_config/packages_file.dart' as pkgfile show parse; |
48 import 'package:package_config/src/packages_impl.dart' show MapPackages; | 49 import 'package:package_config/src/packages_impl.dart' show MapPackages; |
49 import 'package:path/path.dart' as path; | 50 import 'package:path/path.dart' as path; |
50 import 'package:plugin/manager.dart'; | 51 import 'package:plugin/manager.dart'; |
51 import 'package:plugin/plugin.dart'; | 52 import 'package:plugin/plugin.dart'; |
52 import 'package:yaml/yaml.dart'; | 53 import 'package:yaml/yaml.dart'; |
53 | 54 |
54 /// Shared IO sink for standard error reporting. | 55 /// Shared IO sink for standard error reporting. |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 void _processPlugins() { | 617 void _processPlugins() { |
617 List<Plugin> plugins = <Plugin>[]; | 618 List<Plugin> plugins = <Plugin>[]; |
618 plugins.addAll(AnalysisEngine.instance.requiredPlugins); | 619 plugins.addAll(AnalysisEngine.instance.requiredPlugins); |
619 plugins.add(AnalysisEngine.instance.commandLinePlugin); | 620 plugins.add(AnalysisEngine.instance.commandLinePlugin); |
620 plugins.add(AnalysisEngine.instance.optionsPlugin); | 621 plugins.add(AnalysisEngine.instance.optionsPlugin); |
621 plugins.add(linterPlugin); | 622 plugins.add(linterPlugin); |
622 plugins.addAll(_userDefinedPlugins); | 623 plugins.addAll(_userDefinedPlugins); |
623 | 624 |
624 ExtensionManager manager = new ExtensionManager(); | 625 ExtensionManager manager = new ExtensionManager(); |
625 manager.processPlugins(plugins); | 626 manager.processPlugins(plugins); |
| 627 |
| 628 linter.registerLintRules(); |
626 } | 629 } |
627 | 630 |
628 /// Analyze a single source. | 631 /// Analyze a single source. |
629 ErrorSeverity _runAnalyzer(Source source, CommandLineOptions options) { | 632 ErrorSeverity _runAnalyzer(Source source, CommandLineOptions options) { |
630 int startTime = currentTimeMillis(); | 633 int startTime = currentTimeMillis(); |
631 AnalyzerImpl analyzer = | 634 AnalyzerImpl analyzer = |
632 new AnalyzerImpl(_context, source, options, stats, startTime); | 635 new AnalyzerImpl(_context, source, options, stats, startTime); |
633 var errorSeverity = analyzer.analyzeSync(); | 636 var errorSeverity = analyzer.analyzeSync(); |
634 if (errorSeverity == ErrorSeverity.ERROR) { | 637 if (errorSeverity == ErrorSeverity.ERROR) { |
635 io.exitCode = errorSeverity.ordinal; | 638 io.exitCode = errorSeverity.ordinal; |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
878 for (var package in packages) { | 881 for (var package in packages) { |
879 var packageName = path.basename(package.path); | 882 var packageName = path.basename(package.path); |
880 var realPath = package.resolveSymbolicLinksSync(); | 883 var realPath = package.resolveSymbolicLinksSync(); |
881 result[packageName] = [ | 884 result[packageName] = [ |
882 PhysicalResourceProvider.INSTANCE.getFolder(realPath) | 885 PhysicalResourceProvider.INSTANCE.getFolder(realPath) |
883 ]; | 886 ]; |
884 } | 887 } |
885 return result; | 888 return result; |
886 } | 889 } |
887 } | 890 } |
OLD | NEW |