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

Side by Side Diff: pkg/analyzer_cli/lib/src/driver.dart

Issue 2553203002: Move the linter core to the analyzer package (Closed)
Patch Set: Add missed files 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/util.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 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
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
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
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 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/lint/util.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698