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

Unified Diff: pkg/analyzer/lib/src/lint/linter.dart

Issue 2992463003: Update linter engine to use driver (linter#743). (Closed)
Patch Set: Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/lint/analysis.dart ('k') | pkg/analyzer/lib/src/lint/project.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/lint/linter.dart
diff --git a/pkg/analyzer/lib/src/lint/linter.dart b/pkg/analyzer/lib/src/lint/linter.dart
index 67bae7e38efa0ce096212db326f7a1bab7077791..09c62c65d01cdbcb9e0483f113cc4d4cd2c2f75e 100644
--- a/pkg/analyzer/lib/src/lint/linter.dart
+++ b/pkg/analyzer/lib/src/lint/linter.dart
@@ -2,10 +2,12 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+import 'dart:async';
import 'dart:io';
import 'package:analyzer/analyzer.dart';
import 'package:analyzer/dart/ast/token.dart';
+import 'package:analyzer/file_system/file_system.dart' as file_system;
import 'package:analyzer/src/generated/engine.dart'
show AnalysisErrorInfo, AnalysisErrorInfoImpl, Logger;
import 'package:analyzer/src/generated/java_engine.dart' show CaughtException;
@@ -60,11 +62,11 @@ class DartLinter implements AnalysisErrorListener {
/// Creates a new linter.
DartLinter(this.options, {this.reporter: const PrintingReporter()});
- Iterable<AnalysisErrorInfo> lintFiles(List<File> files) {
+ Future<Iterable<AnalysisErrorInfo>> lintFiles(List<File> files) async {
List<AnalysisErrorInfo> errors = [];
- var analysisDriver = new LintDriver(options);
- errors.addAll(analysisDriver.analyze(files.where((f) => isDartFile(f))));
- numSourcesAnalyzed = analysisDriver.numSourcesAnalyzed;
+ final lintDriver = new LintDriver(options);
+ errors.addAll(await lintDriver.analyze(files.where((f) => isDartFile(f))));
+ numSourcesAnalyzed = lintDriver.numSourcesAnalyzed;
files.where((f) => isPubspecFile(f)).forEach((p) {
numSourcesAnalyzed++;
return errors.addAll(_lintPubspecFile(p));
@@ -193,6 +195,7 @@ class LinterException implements Exception {
class LinterOptions extends DriverOptions {
Iterable<LintRule> enabledLints;
LintFilter filter;
+ file_system.ResourceProvider resourceProvider;
LinterOptions([this.enabledLints]) {
enabledLints ??= Registry.ruleRegistry;
}
@@ -361,11 +364,11 @@ class SourceLinter implements DartLinter, AnalysisErrorListener {
SourceLinter(this.options, {this.reporter: const PrintingReporter()});
@override
- Iterable<AnalysisErrorInfo> lintFiles(List<File> files) {
+ Future<Iterable<AnalysisErrorInfo>> lintFiles(List<File> files) async {
List<AnalysisErrorInfo> errors = [];
- var analysisDriver = new LintDriver(options);
- errors.addAll(analysisDriver.analyze(files.where((f) => isDartFile(f))));
- numSourcesAnalyzed = analysisDriver.numSourcesAnalyzed;
+ final lintDriver = new LintDriver(options);
+ errors.addAll(await lintDriver.analyze(files.where((f) => isDartFile(f))));
+ numSourcesAnalyzed = lintDriver.numSourcesAnalyzed;
files.where((f) => isPubspecFile(f)).forEach((p) {
numSourcesAnalyzed++;
return errors.addAll(_lintPubspecFile(p));
« no previous file with comments | « pkg/analyzer/lib/src/lint/analysis.dart ('k') | pkg/analyzer/lib/src/lint/project.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698