analyzer_utilities: tidy static analysis

* Stop using `implicit-casts: false`
* Don't list rules which are found in package:lints
* Fix strict-inference issues

Change-Id: Ibe350548e3d6bef486ef2ef82430cda23d684baf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271780
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
This commit is contained in:
Sam Rawlins
2022-11-28 18:11:03 +00:00
committed by Commit Queue
parent f2b4152159
commit eaff33f439
2 changed files with 8 additions and 9 deletions
+4 -6
View File
@@ -1,8 +1,10 @@
include: package:lints/recommended.yaml
analyzer:
strong-mode:
implicit-casts: false
language:
strict-casts: true
strict-inference: true
strict-raw-types: true
linter:
rules:
@@ -10,14 +12,10 @@ linter:
# Enable when we require Dart 2.19.0.
#- dangling_library_doc_comments
- depend_on_referenced_packages
- empty_constructor_bodies
- empty_statements
- enable_null_safety
- implicit_call_tearoffs
- library_annotations
- unawaited_futures
- unnecessary_brace_in_string_interps
- unnecessary_library_directive
- unnecessary_parenthesis
- unreachable_from_main
- valid_regexps
@@ -5,13 +5,14 @@
import 'package:test/test.dart';
/// Matches a [MapEntry] with matching [MapEntry.key] and [MapEntry.value].
MapEntryMatcher isMapEntry(key, value) => MapEntryMatcher(key, value);
MapEntryMatcher isMapEntry(Object? key, Object? value) =>
MapEntryMatcher(key, value);
class MapEntryMatcher extends Matcher {
final Matcher keyMatcher;
final Matcher valueMatcher;
MapEntryMatcher(key, value)
MapEntryMatcher(Object? key, Object? value)
: keyMatcher = wrapMatcher(key),
valueMatcher = wrapMatcher(value);
@@ -24,7 +25,7 @@ class MapEntryMatcher extends Matcher {
.add(')');
@override
bool matches(item, Map matchState) =>
bool matches(item, Map<dynamic, dynamic> matchState) =>
item is MapEntry &&
keyMatcher.matches(item.key, {}) &&
valueMatcher.matches(item.value, {});