Replace deprecated lint rules in front-end packages

Two rules, `iterable_contains_unrelated_type` and
`list_remove_unrelated_type` are deprecated (which fails the CI) and
replaced with `collection_methods_unrelated_type`.

See https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket/8780614474452305057/+/u/analyze_pkg_/stdout for the failures resulting from referencing deprecated rules.

Change-Id: I00087e684bfb230b5dc94ab832c969ed67a631f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304780
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
This commit is contained in:
Sam Rawlins 2023-05-23 14:01:49 +00:00 committed by Commit Queue
parent a7c8d997ab
commit f292b20dfd
6 changed files with 12 additions and 6 deletions

View file

@ -7,14 +7,13 @@ include: analysis_options_no_lints.yaml
linter:
rules:
- annotate_overrides
- collection_methods_unrelated_type
- curly_braces_in_flow_control_structures
- prefer_adjacent_string_concatenation
- unawaited_futures
- recursive_getters
- avoid_empty_else
- empty_statements
- list_remove_unrelated_type
- iterable_contains_unrelated_type
- valid_regexps
- package_api_docs
- lines_longer_than_80_chars

View file

@ -88,6 +88,9 @@ class TestEnvironment implements ObjectPropertyLookup {
if (fields.isNotEmpty) {
Map<Key, _Type> fieldMap = _fields[cls] ??= {};
for (MapEntry<String, StaticType> entry in fields.entries) {
// TODO(srawlins): Look into fixing this code. Right now we get:
// "The argument type 'String' isn't related to 'Key'."
// ignore: collection_methods_unrelated_type
assert(!fieldMap.containsKey(entry.key),
"Duplicate field '${entry.key}' in $cls.");
fieldMap[new NameKey(entry.key)] = _typeFromStaticType(entry.value);

View file

@ -3628,6 +3628,9 @@ main() {
var s = FlowModel<Type>(Reachability.initial)._write(
h, null, objectQVar, Type('Object?'), new SsaNode<Type>(null));
// TODO(srawlins): Look into fixing this code. Right now we get:
// "The argument type 'Var' isn't related to 'int'."
// ignore: collection_methods_unrelated_type
expect(s.variableInfo[objectQVar], isNull);
});

View file

@ -10,6 +10,7 @@ analyzer:
linter:
rules:
- collection_methods_unrelated_type
- curly_braces_in_flow_control_structures
- prefer_adjacent_string_concatenation
- unawaited_futures
@ -17,8 +18,6 @@ linter:
- recursive_getters
- avoid_empty_else
- empty_statements
- list_remove_unrelated_type
- iterable_contains_unrelated_type
- valid_regexps
- package_api_docs
- lines_longer_than_80_chars

View file

@ -24,6 +24,9 @@ void main(List<String> args) {
Map<String, TopLevelDeclarationEnd> classes = {};
for (TopLevelDeclarationEnd cls in ast.getClasses()) {
IdentifierHandle identifier = cls.getIdentifier();
// TODO(srawlins): Look into fixing this code. Right now we get:
// "The argument type 'Token' isn't related to 'String'."
// ignore: collection_methods_unrelated_type
assert(classes[identifier.token] == null);
classes[identifier.token.toString()] = cls;
}

View file

@ -4,14 +4,13 @@ analyzer:
linter:
rules:
- collection_methods_unrelated_type
- curly_braces_in_flow_control_structures
- prefer_adjacent_string_concatenation
- unawaited_futures
- recursive_getters
- avoid_empty_else
- empty_statements
- list_remove_unrelated_type
- iterable_contains_unrelated_type
- valid_regexps
- package_api_docs
- lines_longer_than_80_chars