[analyzer_cli] switch pkg/analyzer_cli to using package:lints

Change-Id: Ibc9c6edb6f745a6b177ceca133af5c868734b3f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200481
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
This commit is contained in:
Devon Carew 2021-05-18 21:45:23 +00:00 committed by commit-bot@chromium.org
parent d7ccc3ca6a
commit 16d173f7d2
5 changed files with 17 additions and 21 deletions

View file

@ -1,24 +1,19 @@
include: package:pedantic/analysis_options.1.9.0.yaml
include: package:lints/recommended.yaml
analyzer:
strong-mode:
implicit-casts: false
errors:
# Increase the severity of the unused_import hint.
unused_import: warning
language:
strict-inference: true
exclude:
- test/data/**
linter:
rules:
- avoid_single_cascade_in_expression_statements
- avoid_unused_constructor_parameters
- await_only_futures
- empty_statements
- iterable_contains_unrelated_type
- list_remove_unrelated_type
- provide_deprecation_message
- unnecessary_brace_in_string_interps
- unnecessary_overrides
- void_checks
avoid_unused_constructor_parameters: true
directives_ordering: true
# We import heavily from package:analyzer/src.
implementation_imports: false
# This rule does not work well with package:test_reflective_loader.
non_constant_identifier_names: false

View file

@ -171,7 +171,8 @@ class Driver implements CommandLineStarter {
// Note: This references analysisDriver via closure, so it will change over
// time during the following analysis.
var defaultSeverityProcessor = (AnalysisError error) {
SeverityProcessor defaultSeverityProcessor;
defaultSeverityProcessor = (AnalysisError error) {
return determineProcessedSeverity(
error, options, analysisDriver.analysisOptions);
};

View file

@ -8,7 +8,7 @@ import 'dart:io' show Platform;
import 'package:analyzer_cli/src/error_formatter.dart';
import 'package:analyzer_cli/src/options.dart' show CommandLineOptions;
const _JSON = JsonEncoder.withIndent(' ');
const _jsonEncoder = JsonEncoder.withIndent(' ');
final String _osType = () {
if (Platform.isLinux) {
@ -53,5 +53,5 @@ String makePerfReport(int startTime, int endTime, CommandLineOptions options,
'reportedDiagnostics': stats.filteredCount,
};
return _JSON.convert(reportJson);
return _jsonEncoder.convert(reportJson);
}

View file

@ -19,6 +19,6 @@ dependencies:
yaml: any
dev_dependencies:
pedantic: ^1.9.0
lints: any
test_reflective_loader: ^0.1.8
test: ^1.0.0

View file

@ -247,9 +247,9 @@ class Package implements Comparable<Package> {
var extraDevDeclarations = Set<String>.from(_declaredDevDependencies)
..removeAll(devdeps);
// Remove package:pedantic as it is often declared as a dev dependency in
// order to bring in its analysis_options.yaml file.
extraDevDeclarations.remove('pedantic');
// Remove package:pedantic and package:lints as they are often declared as
// dev dependencies in order to bring in their analysis_options.yaml files.
extraDevDeclarations.removeAll(['lints', 'pedantic']);
if (extraDevDeclarations.isNotEmpty) {
out(' ${_printSet(extraDevDeclarations)} declared in '
"'dev_dependencies:' but not used in dev dirs.");