Enable more lints in analyzer_cli/

Change-Id: I8e6bf80d0c9b888dad5dcd10a1e0463e8a7f641d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235721
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
Konstantin Shcheglov 2022-03-07 19:53:53 +00:00 committed by Commit Bot
parent dc88311556
commit bc21d4f901
4 changed files with 22 additions and 6 deletions

View file

@ -9,11 +9,27 @@ analyzer:
linter:
rules:
always_declare_return_types: true
avoid_empty_else: true
avoid_relative_lib_imports: true
avoid_shadowing_type_parameters: true
avoid_types_as_parameter_names: true
avoid_unused_constructor_parameters: true
camel_case_extensions: true
curly_braces_in_flow_control_structures: true
depend_on_referenced_packages: true
directives_ordering: true
empty_catches: true
# We import heavily from package:analyzer/src.
implementation_imports: false
# This rule does not work well with package:test_reflective_loader.
no_duplicate_case_values: true
non_constant_identifier_names: false
omit_local_variable_types: true
prefer_is_empty: true
prefer_is_not_empty: true
prefer_iterable_whereType: true
prefer_single_quotes: true
unawaited_futures: true
unrelated_type_equality_checks: true

View file

@ -464,7 +464,7 @@ class OptionsTest extends BaseTest {
]);
expect(processorFor(missing_return).severity, ErrorSeverity.ERROR);
expect(bulletToDash(outSink),
contains("error - The body might complete normally"));
contains('error - The body might complete normally'));
expect(outSink.toString(), contains('1 error and 1 warning found.'));
}

View file

@ -116,7 +116,7 @@ class MockErrorCode implements ErrorCode {
}
@override
noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
dynamic noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
}
class MockLineInfo implements LineInfo {
@ -163,5 +163,5 @@ class MockSource implements Source {
MockSource(this.fullName, this.uri);
@override
noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
dynamic noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
}

View file

@ -108,11 +108,11 @@ ErrorsResultImpl mockResult(ErrorType type, ErrorSeverity severity) {
var source = MockSource(path, package_path.toUri(path));
var error = MockAnalysisError(source, code, 20, 'MSG');
return ErrorsResultImpl(_MockAnslysisSession(), source.fullName,
return ErrorsResultImpl(_MockAnalysisSession(), source.fullName,
Uri.file('/'), lineInfo, false, [error]);
}
class _MockAnslysisSession implements AnalysisSession {
class _MockAnalysisSession implements AnalysisSession {
@override
noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
dynamic noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
}