analyzer: deprecate reportLintForToken; migrate all SDK callers
Change-Id: I23c5d3d3f7ee1657f17b3d507e1d4edf1afd65d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/424701
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
diff --git a/pkg/analyzer/lib/src/lint/linter.dart b/pkg/analyzer/lib/src/lint/linter.dart
index dbf05fb..bd8fbfc 100644
--- a/pkg/analyzer/lib/src/lint/linter.dart
+++ b/pkg/analyzer/lib/src/lint/linter.dart
@@ -359,7 +359,7 @@
errorCode: errorCode,
);
- // TODO(srawlins): Deprecate this in favor of [reportToken].
+ @Deprecated('Use reportAtToken')
void reportLintForToken(
Token token, {
List<Object> arguments = const [],
diff --git a/pkg/analyzer/test/src/diagnostics/unignorable_ignore_test.dart b/pkg/analyzer/test/src/diagnostics/unignorable_ignore_test.dart
index 2ad1ee7..ea77845 100644
--- a/pkg/analyzer/test/src/diagnostics/unignorable_ignore_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/unignorable_ignore_test.dart
@@ -115,7 +115,7 @@
@override
void visitNamedType(NamedType node) {
if (node.name2.lexeme == 'int') {
- rule.reportLintForToken(node.name2);
+ rule.reportAtToken(node.name2);
}
}
}
diff --git a/pkg/analyzer/test/src/lint/lint_rule_test.dart b/pkg/analyzer/test/src/lint/lint_rule_test.dart
index 29c1a3f..90fd1eb 100644
--- a/pkg/analyzer/test/src/lint/lint_rule_test.dart
+++ b/pkg/analyzer/test/src/lint/lint_rule_test.dart
@@ -26,7 +26,7 @@
);
rule.reporter = reporter;
- rule.reportLintForToken(
+ rule.reportAtToken(
SimpleToken(TokenType.SEMICOLON, 0),
errorCode: customCode,
);
@@ -40,7 +40,7 @@
);
rule.reporter = reporter;
- rule.reportLintForToken(SimpleToken(TokenType.SEMICOLON, 0));
+ rule.reportAtToken(SimpleToken(TokenType.SEMICOLON, 0));
expect(reporter.code, rule.lintCode);
});
test('reportLint (custom)', () {
diff --git a/pkg/linter/lib/src/rules/always_declare_return_types.dart b/pkg/linter/lib/src/rules/always_declare_return_types.dart
index dbb1cc0..97694e9 100644
--- a/pkg/linter/lib/src/rules/always_declare_return_types.dart
+++ b/pkg/linter/lib/src/rules/always_declare_return_types.dart
@@ -42,7 +42,7 @@
@override
void visitFunctionDeclaration(FunctionDeclaration node) {
if (!node.isSetter && node.returnType == null && !node.isAugmentation) {
- rule.reportLintForToken(
+ rule.reportAtToken(
node.name,
arguments: [node.name.lexeme],
errorCode: LinterLintCode.always_declare_return_types_of_functions,
@@ -53,7 +53,7 @@
@override
void visitFunctionTypeAlias(FunctionTypeAlias node) {
if (node.returnType == null) {
- rule.reportLintForToken(
+ rule.reportAtToken(
node.name,
arguments: [node.name.lexeme],
errorCode: LinterLintCode.always_declare_return_types_of_functions,
@@ -75,7 +75,7 @@
}
}
- rule.reportLintForToken(
+ rule.reportAtToken(
node.name,
arguments: [node.name.lexeme],
errorCode: LinterLintCode.always_declare_return_types_of_methods,
diff --git a/pkg/linter/lib/src/rules/always_put_control_body_on_new_line.dart b/pkg/linter/lib/src/rules/always_put_control_body_on_new_line.dart
index 48c3fac..afbd1a9 100644
--- a/pkg/linter/lib/src/rules/always_put_control_body_on_new_line.dart
+++ b/pkg/linter/lib/src/rules/always_put_control_body_on_new_line.dart
@@ -71,7 +71,7 @@
var lineInfo = unit.lineInfo;
if (lineInfo.getLocation(controlEnd).lineNumber ==
lineInfo.getLocation(offsetFirstStatement).lineNumber) {
- rule.reportLintForToken(node.beginToken);
+ rule.reportAtToken(node.beginToken);
}
}
}
diff --git a/pkg/linter/lib/src/rules/always_put_required_named_parameters_first.dart b/pkg/linter/lib/src/rules/always_put_required_named_parameters_first.dart
index 3dc1040..f27ed6e 100644
--- a/pkg/linter/lib/src/rules/always_put_required_named_parameters_first.dart
+++ b/pkg/linter/lib/src/rules/always_put_required_named_parameters_first.dart
@@ -45,7 +45,7 @@
if (nonRequiredSeen) {
var name = param.name;
if (name != null) {
- rule.reportLintForToken(name);
+ rule.reportAtToken(name);
}
}
} else {
diff --git a/pkg/linter/lib/src/rules/always_specify_types.dart b/pkg/linter/lib/src/rules/always_specify_types.dart
index 46f074a..96f82b9 100644
--- a/pkg/linter/lib/src/rules/always_specify_types.dart
+++ b/pkg/linter/lib/src/rules/always_specify_types.dart
@@ -57,7 +57,7 @@
void checkLiteral(TypedLiteral literal) {
if (literal.typeArguments == null) {
- rule.reportLintForToken(
+ rule.reportAtToken(
literal.beginToken,
errorCode: LinterLintCode.always_specify_types_add_type,
);
@@ -71,13 +71,13 @@
var element = node.declaredElement2;
if (element is VariableElement2) {
if (keyword.keyword == Keyword.VAR) {
- rule.reportLintForToken(
+ rule.reportAtToken(
keyword,
arguments: [keyword.lexeme, element!.type],
errorCode: LinterLintCode.always_specify_types_replace_keyword,
);
} else {
- rule.reportLintForToken(
+ rule.reportAtToken(
keyword,
arguments: [element!.type],
errorCode: LinterLintCode.always_specify_types_specify_type,
@@ -94,13 +94,13 @@
var keyword = node.keyword;
var tokenToLint = keyword ?? node.name;
if (keyword != null && keyword.keyword == Keyword.VAR) {
- rule.reportLintForToken(
+ rule.reportAtToken(
tokenToLint,
arguments: [keyword.lexeme, type],
errorCode: LinterLintCode.always_specify_types_replace_keyword,
);
} else {
- rule.reportLintForToken(
+ rule.reportAtToken(
tokenToLint,
arguments: [type],
errorCode: LinterLintCode.always_specify_types_specify_type,
@@ -147,13 +147,13 @@
if (keyword.type == Keyword.VAR &&
type != null &&
type is! DynamicType) {
- rule.reportLintForToken(
+ rule.reportAtToken(
keyword,
arguments: [keyword.lexeme, type],
errorCode: LinterLintCode.always_specify_types_replace_keyword,
);
} else {
- rule.reportLintForToken(
+ rule.reportAtToken(
keyword,
errorCode: LinterLintCode.always_specify_types_add_type,
);
@@ -217,11 +217,7 @@
errorCode = LinterLintCode.always_specify_types_add_type;
}
}
- rule.reportLintForToken(
- keyword,
- arguments: arguments,
- errorCode: errorCode,
- );
+ rule.reportAtToken(keyword, arguments: arguments, errorCode: errorCode);
}
}
diff --git a/pkg/linter/lib/src/rules/analyzer_use_new_elements.dart b/pkg/linter/lib/src/rules/analyzer_use_new_elements.dart
index 83851bc..6f5fe21 100644
--- a/pkg/linter/lib/src/rules/analyzer_use_new_elements.dart
+++ b/pkg/linter/lib/src/rules/analyzer_use_new_elements.dart
@@ -147,7 +147,7 @@
}
if (_isOldModelElement(node.element2)) {
- rule.reportLintForToken(node.name2);
+ rule.reportAtToken(node.name2);
}
}
diff --git a/pkg/linter/lib/src/rules/annotate_overrides.dart b/pkg/linter/lib/src/rules/annotate_overrides.dart
index 5d7660b..9748eba 100644
--- a/pkg/linter/lib/src/rules/annotate_overrides.dart
+++ b/pkg/linter/lib/src/rules/annotate_overrides.dart
@@ -42,7 +42,7 @@
var member = context.inheritanceManager.overriddenMember(element);
if (member != null) {
- rule.reportLintForToken(target, arguments: [member.name3!]);
+ rule.reportAtToken(target, arguments: [member.name3!]);
}
}
diff --git a/pkg/linter/lib/src/rules/annotate_redeclares.dart b/pkg/linter/lib/src/rules/annotate_redeclares.dart
index 1110e3b..4020d0c 100644
--- a/pkg/linter/lib/src/rules/annotate_redeclares.dart
+++ b/pkg/linter/lib/src/rules/annotate_redeclares.dart
@@ -56,7 +56,7 @@
if (extensionType == null) return;
if (_redeclaresMember(element, extensionType)) {
- rule.reportLintForToken(node.name, arguments: [element.displayName]);
+ rule.reportAtToken(node.name, arguments: [element.displayName]);
}
}
diff --git a/pkg/linter/lib/src/rules/avoid_catches_without_on_clauses.dart b/pkg/linter/lib/src/rules/avoid_catches_without_on_clauses.dart
index 4d13769..796bdf5 100644
--- a/pkg/linter/lib/src/rules/avoid_catches_without_on_clauses.dart
+++ b/pkg/linter/lib/src/rules/avoid_catches_without_on_clauses.dart
@@ -147,6 +147,6 @@
var catchKeyword = node.catchKeyword;
if (catchKeyword == null) return;
- rule.reportLintForToken(catchKeyword);
+ rule.reportAtToken(catchKeyword);
}
}
diff --git a/pkg/linter/lib/src/rules/avoid_equals_and_hash_code_on_mutable_classes.dart b/pkg/linter/lib/src/rules/avoid_equals_and_hash_code_on_mutable_classes.dart
index ceebc99..0dbadc0 100644
--- a/pkg/linter/lib/src/rules/avoid_equals_and_hash_code_on_mutable_classes.dart
+++ b/pkg/linter/lib/src/rules/avoid_equals_and_hash_code_on_mutable_classes.dart
@@ -47,7 +47,7 @@
if (node.name.type == TokenType.EQ_EQ || isHashCode(node)) {
var classElement = node.classElement;
if (classElement != null && !classElement.hasImmutableAnnotation) {
- rule.reportLintForToken(
+ rule.reportAtToken(
node.firstTokenAfterCommentAndMetadata,
arguments: [node.name.lexeme],
);
diff --git a/pkg/linter/lib/src/rules/avoid_multiple_declarations_per_line.dart b/pkg/linter/lib/src/rules/avoid_multiple_declarations_per_line.dart
index 8b98c76..b57284b 100644
--- a/pkg/linter/lib/src/rules/avoid_multiple_declarations_per_line.dart
+++ b/pkg/linter/lib/src/rules/avoid_multiple_declarations_per_line.dart
@@ -42,7 +42,7 @@
var variables = node.variables;
if (variables.length > 1) {
var secondVariable = variables[1];
- rule.reportLintForToken(secondVariable.name);
+ rule.reportAtToken(secondVariable.name);
}
}
}
diff --git a/pkg/linter/lib/src/rules/avoid_private_typedef_functions.dart b/pkg/linter/lib/src/rules/avoid_private_typedef_functions.dart
index a27f37d..62b84d7 100644
--- a/pkg/linter/lib/src/rules/avoid_private_typedef_functions.dart
+++ b/pkg/linter/lib/src/rules/avoid_private_typedef_functions.dart
@@ -73,7 +73,7 @@
unit.unit.accept(visitor);
}
if (visitor.count <= 1) {
- rule.reportLintForToken(identifier);
+ rule.reportAtToken(identifier);
}
}
}
diff --git a/pkg/linter/lib/src/rules/avoid_renaming_method_parameters.dart b/pkg/linter/lib/src/rules/avoid_renaming_method_parameters.dart
index d6cbed8..5ea56e0 100644
--- a/pkg/linter/lib/src/rules/avoid_renaming_method_parameters.dart
+++ b/pkg/linter/lib/src/rules/avoid_renaming_method_parameters.dart
@@ -107,7 +107,7 @@
if (isWildcardIdentifier(paramLexeme)) continue;
if (paramLexeme != parentParameterName) {
- rule.reportLintForToken(
+ rule.reportAtToken(
parameterName,
arguments: [paramLexeme, parentParameterName],
);
diff --git a/pkg/linter/lib/src/rules/avoid_returning_this.dart b/pkg/linter/lib/src/rules/avoid_returning_this.dart
index 0702fa1..3f7c4d5 100644
--- a/pkg/linter/lib/src/rules/avoid_returning_this.dart
+++ b/pkg/linter/lib/src/rules/avoid_returning_this.dart
@@ -99,7 +99,7 @@
}
} else if (body is ExpressionFunctionBody) {
if (body.expression is ThisExpression) {
- rule.reportLintForToken(node.name);
+ rule.reportAtToken(node.name);
}
}
}
diff --git a/pkg/linter/lib/src/rules/avoid_setters_without_getters.dart b/pkg/linter/lib/src/rules/avoid_setters_without_getters.dart
index ad16fec..e006bb2 100644
--- a/pkg/linter/lib/src/rules/avoid_setters_without_getters.dart
+++ b/pkg/linter/lib/src/rules/avoid_setters_without_getters.dart
@@ -79,7 +79,7 @@
);
if (getter == null) {
- rule.reportLintForToken(member.name);
+ rule.reportAtToken(member.name);
}
}
}
diff --git a/pkg/linter/lib/src/rules/avoid_types_as_parameter_names.dart b/pkg/linter/lib/src/rules/avoid_types_as_parameter_names.dart
index ee5a7ea..8f850ee 100644
--- a/pkg/linter/lib/src/rules/avoid_types_as_parameter_names.dart
+++ b/pkg/linter/lib/src/rules/avoid_types_as_parameter_names.dart
@@ -56,7 +56,7 @@
declaredElement.hasImplicitType &&
name != null &&
_isTypeName(node, name)) {
- rule.reportLintForToken(name, arguments: [name.lexeme]);
+ rule.reportAtToken(name, arguments: [name.lexeme]);
}
}
}
diff --git a/pkg/linter/lib/src/rules/avoid_void_async.dart b/pkg/linter/lib/src/rules/avoid_void_async.dart
index 65e75e5..cc8aa76 100644
--- a/pkg/linter/lib/src/rules/avoid_void_async.dart
+++ b/pkg/linter/lib/src/rules/avoid_void_async.dart
@@ -54,7 +54,7 @@
if (fragment.isGenerator) return;
if (!fragment.isAsynchronous) return;
if (fragment.element.returnType is VoidType) {
- rule.reportLintForToken(errorNode);
+ rule.reportAtToken(errorNode);
}
}
}
diff --git a/pkg/linter/lib/src/rules/await_only_futures.dart b/pkg/linter/lib/src/rules/await_only_futures.dart
index 00f4d49..72ecb55 100644
--- a/pkg/linter/lib/src/rules/await_only_futures.dart
+++ b/pkg/linter/lib/src/rules/await_only_futures.dart
@@ -47,7 +47,7 @@
type.extendsClass('Future', 'dart.async') ||
type.implementsInterface('Future', 'dart.async') ||
type.isDartAsyncFutureOr)) {
- rule.reportLintForToken(node.awaitKeyword, arguments: [type]);
+ rule.reportAtToken(node.awaitKeyword, arguments: [type]);
}
}
}
diff --git a/pkg/linter/lib/src/rules/camel_case_extensions.dart b/pkg/linter/lib/src/rules/camel_case_extensions.dart
index a1dc893..9f92975 100644
--- a/pkg/linter/lib/src/rules/camel_case_extensions.dart
+++ b/pkg/linter/lib/src/rules/camel_case_extensions.dart
@@ -39,7 +39,7 @@
var name = node.name;
if (name != null && !isCamelCase(name.lexeme)) {
- rule.reportLintForToken(name, arguments: [name.lexeme]);
+ rule.reportAtToken(name, arguments: [name.lexeme]);
}
}
}
diff --git a/pkg/linter/lib/src/rules/camel_case_types.dart b/pkg/linter/lib/src/rules/camel_case_types.dart
index 272fc43..95c2d31 100644
--- a/pkg/linter/lib/src/rules/camel_case_types.dart
+++ b/pkg/linter/lib/src/rules/camel_case_types.dart
@@ -43,7 +43,7 @@
void check(Token name) {
var lexeme = name.lexeme;
if (!isCamelCase(lexeme)) {
- rule.reportLintForToken(name, arguments: [lexeme]);
+ rule.reportAtToken(name, arguments: [lexeme]);
}
}
diff --git a/pkg/linter/lib/src/rules/constant_identifier_names.dart b/pkg/linter/lib/src/rules/constant_identifier_names.dart
index 75dde9f..fee616f 100644
--- a/pkg/linter/lib/src/rules/constant_identifier_names.dart
+++ b/pkg/linter/lib/src/rules/constant_identifier_names.dart
@@ -40,7 +40,7 @@
void checkIdentifier(Token id) {
var name = id.lexeme;
if (!isLowerCamelCase(name)) {
- rule.reportLintForToken(id, arguments: [name]);
+ rule.reportAtToken(id, arguments: [name]);
}
}
diff --git a/pkg/linter/lib/src/rules/dangling_library_doc_comments.dart b/pkg/linter/lib/src/rules/dangling_library_doc_comments.dart
index 265eed2..8f25e68 100644
--- a/pkg/linter/lib/src/rules/dangling_library_doc_comments.dart
+++ b/pkg/linter/lib/src/rules/dangling_library_doc_comments.dart
@@ -50,7 +50,7 @@
var docComment = firstDirective.documentationComment;
if (docComment != null) {
- rule.reportLintForToken(docComment.beginToken);
+ rule.reportAtToken(docComment.beginToken);
return;
}
@@ -63,7 +63,7 @@
Token? endComment = node.endToken.precedingComments;
while (endComment is CommentToken) {
if (endComment is DocumentationCommentToken) {
- rule.reportLintForToken(endComment);
+ rule.reportAtToken(endComment);
}
endComment = endComment.next;
}
@@ -86,7 +86,7 @@
lineInfo.getLocation(followingCommentToken.offset).lineNumber;
if (followingCommentLine > commentEndLine + 1) {
// There is a blank line within the declaration's doc comments.
- rule.reportLintForToken(commentToken);
+ rule.reportAtToken(commentToken);
return;
}
}
diff --git a/pkg/linter/lib/src/rules/diagnostic_describe_all_properties.dart b/pkg/linter/lib/src/rules/diagnostic_describe_all_properties.dart
index 684220d..4842d8f 100644
--- a/pkg/linter/lib/src/rules/diagnostic_describe_all_properties.dart
+++ b/pkg/linter/lib/src/rules/diagnostic_describe_all_properties.dart
@@ -120,7 +120,7 @@
removeReferences(debugDescribeChildren, properties);
// Flag the rest.
- properties.forEach(rule.reportLintForToken);
+ properties.forEach(rule.reportAtToken);
}
bool _isOverridingMember(Element2? member) {
diff --git a/pkg/linter/lib/src/rules/document_ignores.dart b/pkg/linter/lib/src/rules/document_ignores.dart
index b3022d3..63ed251 100644
--- a/pkg/linter/lib/src/rules/document_ignores.dart
+++ b/pkg/linter/lib/src/rules/document_ignores.dart
@@ -74,7 +74,7 @@
}
}
- rule.reportLintForToken(comment);
+ rule.reportAtToken(comment);
}
}
diff --git a/pkg/linter/lib/src/rules/flutter_style_todos.dart b/pkg/linter/lib/src/rules/flutter_style_todos.dart
index 0c884d1..0a82817 100644
--- a/pkg/linter/lib/src/rules/flutter_style_todos.dart
+++ b/pkg/linter/lib/src/rules/flutter_style_todos.dart
@@ -66,7 +66,7 @@
void _checkComment(Token node) {
var content = node.lexeme;
if (FlutterStyleTodos.invalidTodo(content)) {
- rule.reportLintForToken(node);
+ rule.reportAtToken(node);
}
}
}
diff --git a/pkg/linter/lib/src/rules/hash_and_equals.dart b/pkg/linter/lib/src/rules/hash_and_equals.dart
index 54310ca..e1ea493 100644
--- a/pkg/linter/lib/src/rules/hash_and_equals.dart
+++ b/pkg/linter/lib/src/rules/hash_and_equals.dart
@@ -49,21 +49,18 @@
if (eq == null) {
if (!node.hasMethod('==')) {
if (hash is MethodDeclaration) {
- rule.reportLintForToken(hash.name, arguments: ['==', 'hashCode']);
+ rule.reportAtToken(hash.name, arguments: ['==', 'hashCode']);
} else if (hash is FieldDeclaration) {
var hashCodeFieldName = getFieldName(hash, 'hashCode');
if (hashCodeFieldName == null) return;
- rule.reportLintForToken(
- hashCodeFieldName,
- arguments: ['==', 'hashCode'],
- );
+ rule.reportAtToken(hashCodeFieldName, arguments: ['==', 'hashCode']);
}
}
}
if (hash == null) {
if (!node.hasField('hashCode') && !node.hasMethod('hashCode')) {
- rule.reportLintForToken(eq!.name, arguments: ['hashCode', '==']);
+ rule.reportAtToken(eq!.name, arguments: ['hashCode', '==']);
}
}
}
diff --git a/pkg/linter/lib/src/rules/implicit_reopen.dart b/pkg/linter/lib/src/rules/implicit_reopen.dart
index 7223971..32dc779 100644
--- a/pkg/linter/lib/src/rules/implicit_reopen.dart
+++ b/pkg/linter/lib/src/rules/implicit_reopen.dart
@@ -96,7 +96,7 @@
var targetName = target.name3;
var otherName = other.name3;
if (targetName != null && otherName != null) {
- rule.reportLintForToken(
+ rule.reportAtToken(
member.name,
arguments: [type, targetName, otherName, reason],
);
diff --git a/pkg/linter/lib/src/rules/library_private_types_in_public_api.dart b/pkg/linter/lib/src/rules/library_private_types_in_public_api.dart
index 7439b69..12648fb 100644
--- a/pkg/linter/lib/src/rules/library_private_types_in_public_api.dart
+++ b/pkg/linter/lib/src/rules/library_private_types_in_public_api.dart
@@ -136,7 +136,7 @@
if (element is FieldFormalParameterElement2) {
var type = element.type;
if (type is InterfaceType && isPrivateName(type.element3.name3)) {
- rule.reportLintForToken(node.name);
+ rule.reportAtToken(node.name);
}
}
}
@@ -216,7 +216,7 @@
void visitNamedType(NamedType node) {
var element = node.element2;
if (element != null && isPrivate(element)) {
- rule.reportLintForToken(node.name2);
+ rule.reportAtToken(node.name2);
}
node.typeArguments?.accept(this);
}
@@ -248,7 +248,7 @@
if (element is SuperFormalParameterElement2) {
var type = element.type;
if (type is InterfaceType && isPrivateName(type.element3.name3)) {
- rule.reportLintForToken(node.name);
+ rule.reportAtToken(node.name);
}
}
}
diff --git a/pkg/linter/lib/src/rules/no_leading_underscores_for_local_identifiers.dart b/pkg/linter/lib/src/rules/no_leading_underscores_for_local_identifiers.dart
index fdc33d1..b786349 100644
--- a/pkg/linter/lib/src/rules/no_leading_underscores_for_local_identifiers.dart
+++ b/pkg/linter/lib/src/rules/no_leading_underscores_for_local_identifiers.dart
@@ -49,7 +49,7 @@
if (!id.lexeme.hasLeadingUnderscore) return;
if (id.lexeme.isJustUnderscores) return;
- rule.reportLintForToken(id, arguments: [id.lexeme]);
+ rule.reportAtToken(id, arguments: [id.lexeme]);
}
@override
diff --git a/pkg/linter/lib/src/rules/non_constant_identifier_names.dart b/pkg/linter/lib/src/rules/non_constant_identifier_names.dart
index 1122eff..29a922d 100644
--- a/pkg/linter/lib/src/rules/non_constant_identifier_names.dart
+++ b/pkg/linter/lib/src/rules/non_constant_identifier_names.dart
@@ -57,7 +57,7 @@
return;
}
if (!isLowerCamelCase(name)) {
- rule.reportLintForToken(id, arguments: [name]);
+ rule.reportAtToken(id, arguments: [name]);
}
}
diff --git a/pkg/linter/lib/src/rules/null_check_on_nullable_type_parameter.dart b/pkg/linter/lib/src/rules/null_check_on_nullable_type_parameter.dart
index de38cba..55ae947 100644
--- a/pkg/linter/lib/src/rules/null_check_on_nullable_type_parameter.dart
+++ b/pkg/linter/lib/src/rules/null_check_on_nullable_type_parameter.dart
@@ -46,7 +46,7 @@
@override
void visitNullAssertPattern(NullAssertPattern node) {
if (isNullableTypeParameterType(node.matchedValueType)) {
- rule.reportLintForToken(node.operator);
+ rule.reportAtToken(node.operator);
}
}
@@ -61,7 +61,7 @@
context.typeSystem.isPotentiallyNullable(expectedType) &&
context.typeSystem.promoteToNonNull(type!) ==
context.typeSystem.promoteToNonNull(expectedType)) {
- rule.reportLintForToken(node.operator);
+ rule.reportAtToken(node.operator);
}
}
}
diff --git a/pkg/linter/lib/src/rules/one_member_abstracts.dart b/pkg/linter/lib/src/rules/one_member_abstracts.dart
index 68ab997..66beb1d 100644
--- a/pkg/linter/lib/src/rules/one_member_abstracts.dart
+++ b/pkg/linter/lib/src/rules/one_member_abstracts.dart
@@ -56,6 +56,6 @@
var name = method.name3;
if (name == null) return;
- rule.reportLintForToken(node.name, arguments: [name]);
+ rule.reportAtToken(node.name, arguments: [name]);
}
}
diff --git a/pkg/linter/lib/src/rules/overridden_fields.dart b/pkg/linter/lib/src/rules/overridden_fields.dart
index d84f1df..53c2877 100644
--- a/pkg/linter/lib/src/rules/overridden_fields.dart
+++ b/pkg/linter/lib/src/rules/overridden_fields.dart
@@ -51,7 +51,7 @@
if (overriddenMember is GetterElement2OrMember &&
overriddenMember.isSynthetic) {
var definingInterface = overriddenMember.enclosingElement2;
- rule.reportLintForToken(
+ rule.reportAtToken(
variable.name,
arguments: [definingInterface.displayName],
);
diff --git a/pkg/linter/lib/src/rules/prefer_adjacent_string_concatenation.dart b/pkg/linter/lib/src/rules/prefer_adjacent_string_concatenation.dart
index d537ef6..14a0e3b 100644
--- a/pkg/linter/lib/src/rules/prefer_adjacent_string_concatenation.dart
+++ b/pkg/linter/lib/src/rules/prefer_adjacent_string_concatenation.dart
@@ -39,7 +39,7 @@
if (node.operator.type.lexeme == '+' &&
node.leftOperand is StringLiteral &&
node.rightOperand is StringLiteral) {
- rule.reportLintForToken(node.operator);
+ rule.reportAtToken(node.operator);
}
}
}
diff --git a/pkg/linter/lib/src/rules/prefer_asserts_in_initializer_lists.dart b/pkg/linter/lib/src/rules/prefer_asserts_in_initializer_lists.dart
index 467a0d6..ae8b72b 100644
--- a/pkg/linter/lib/src/rules/prefer_asserts_in_initializer_lists.dart
+++ b/pkg/linter/lib/src/rules/prefer_asserts_in_initializer_lists.dart
@@ -149,7 +149,7 @@
);
statement.visitChildren(assertVisitor);
if (!assertVisitor.needInstance) {
- rule.reportLintForToken(statement.beginToken);
+ rule.reportAtToken(statement.beginToken);
}
}
}
diff --git a/pkg/linter/lib/src/rules/prefer_const_constructors_in_immutables.dart b/pkg/linter/lib/src/rules/prefer_const_constructors_in_immutables.dart
index d484448..f187c41 100644
--- a/pkg/linter/lib/src/rules/prefer_const_constructors_in_immutables.dart
+++ b/pkg/linter/lib/src/rules/prefer_const_constructors_in_immutables.dart
@@ -52,12 +52,12 @@
var isRedirected =
element.isFactory && element.redirectedConstructor2 != null;
if (isRedirected && (element.redirectedConstructor2?.isConst ?? false)) {
- rule.reportLintForToken(node.firstTokenAfterCommentAndMetadata);
+ rule.reportAtToken(node.firstTokenAfterCommentAndMetadata);
}
if (!isRedirected &&
_hasConstConstructorInvocation(node) &&
node.canBeConst) {
- rule.reportLintForToken(node.firstTokenAfterCommentAndMetadata);
+ rule.reportAtToken(node.firstTokenAfterCommentAndMetadata);
}
}
@@ -67,7 +67,7 @@
var element = node.declaredFragment?.element;
if (element == null) return;
if (element.metadata2.hasImmutable) {
- rule.reportLintForToken(node.name);
+ rule.reportAtToken(node.name);
}
}
diff --git a/pkg/linter/lib/src/rules/prefer_constructors_over_static_methods.dart b/pkg/linter/lib/src/rules/prefer_constructors_over_static_methods.dart
index 9a7fb42..bc504f0 100644
--- a/pkg/linter/lib/src/rules/prefer_constructors_over_static_methods.dart
+++ b/pkg/linter/lib/src/rules/prefer_constructors_over_static_methods.dart
@@ -75,7 +75,7 @@
if (interfaceType != returnType) return;
if (_hasNewInvocation(returnType, node.body)) {
- rule.reportLintForToken(node.name);
+ rule.reportAtToken(node.name);
}
}
}
diff --git a/pkg/linter/lib/src/rules/prefer_final_in_for_each.dart b/pkg/linter/lib/src/rules/prefer_final_in_for_each.dart
index e716868..f31ca82 100644
--- a/pkg/linter/lib/src/rules/prefer_final_in_for_each.dart
+++ b/pkg/linter/lib/src/rules/prefer_final_in_for_each.dart
@@ -51,7 +51,7 @@
loopVariableElement != null &&
!function.isPotentiallyMutatedInScope2(loopVariableElement)) {
var name = loopVariable.name;
- rule.reportLintForToken(
+ rule.reportAtToken(
name,
errorCode: LinterLintCode.prefer_final_in_for_each_variable,
arguments: [name.lexeme],
diff --git a/pkg/linter/lib/src/rules/prefer_final_locals.dart b/pkg/linter/lib/src/rules/prefer_final_locals.dart
index ad4e098..1eece0e 100644
--- a/pkg/linter/lib/src/rules/prefer_final_locals.dart
+++ b/pkg/linter/lib/src/rules/prefer_final_locals.dart
@@ -113,7 +113,7 @@
} else {
if (!node.hasPotentiallyMutatedDeclaredVariableInScope(function)) {
if (node.pattern.containsJustWildcards) return;
- rule.reportLintForToken(node.keyword);
+ rule.reportAtToken(node.keyword);
}
}
}
@@ -138,7 +138,7 @@
}
var keyword = node.keyword;
if (keyword != null) {
- rule.reportLintForToken(keyword);
+ rule.reportAtToken(keyword);
} else if (node.type != null) {
rule.reportLint(node.type);
}
diff --git a/pkg/linter/lib/src/rules/prefer_generic_function_type_aliases.dart b/pkg/linter/lib/src/rules/prefer_generic_function_type_aliases.dart
index 1a1832e..e2822da 100644
--- a/pkg/linter/lib/src/rules/prefer_generic_function_type_aliases.dart
+++ b/pkg/linter/lib/src/rules/prefer_generic_function_type_aliases.dart
@@ -52,6 +52,6 @@
var parameterSource = parameters.toSource();
var replacement =
'${returnTypeSource}Function$typeParameterSource$parameterSource';
- rule.reportLintForToken(node.name, arguments: [replacement]);
+ rule.reportAtToken(node.name, arguments: [replacement]);
}
}
diff --git a/pkg/linter/lib/src/rules/prefer_single_quotes.dart b/pkg/linter/lib/src/rules/prefer_single_quotes.dart
index cb09786..84555a5 100644
--- a/pkg/linter/lib/src/rules/prefer_single_quotes.dart
+++ b/pkg/linter/lib/src/rules/prefer_single_quotes.dart
@@ -58,7 +58,7 @@
// Bail out on 'strings ${x ? "containing" : "other"} strings'
if (!isNestedString(node)) {
- rule.reportLintForToken(node.literal);
+ rule.reportAtToken(node.literal);
}
}
diff --git a/pkg/linter/lib/src/rules/prefer_void_to_null.dart b/pkg/linter/lib/src/rules/prefer_void_to_null.dart
index a70f4f3..144aa8d 100644
--- a/pkg/linter/lib/src/rules/prefer_void_to_null.dart
+++ b/pkg/linter/lib/src/rules/prefer_void_to_null.dart
@@ -122,6 +122,6 @@
if (declaration?.isAugmentation ?? false) return;
}
- rule.reportLintForToken(node.name2);
+ rule.reportAtToken(node.name2);
}
}
diff --git a/pkg/linter/lib/src/rules/require_trailing_commas.dart b/pkg/linter/lib/src/rules/require_trailing_commas.dart
index 279e12b..6afc5c0 100644
--- a/pkg/linter/lib/src/rules/require_trailing_commas.dart
+++ b/pkg/linter/lib/src/rules/require_trailing_commas.dart
@@ -141,7 +141,7 @@
// Check the last parameter to determine if there are any exceptions.
if (_shouldAllowTrailingCommaException(lastNode)) return;
- rule.reportLintForToken(errorToken);
+ rule.reportAtToken(errorToken);
}
bool _isSameLine(Token token1, Token token2) =>
diff --git a/pkg/linter/lib/src/rules/slash_for_doc_comments.dart b/pkg/linter/lib/src/rules/slash_for_doc_comments.dart
index fda5c7e..3d84afb 100644
--- a/pkg/linter/lib/src/rules/slash_for_doc_comments.dart
+++ b/pkg/linter/lib/src/rules/slash_for_doc_comments.dart
@@ -115,7 +115,7 @@
void visitFunctionDeclarationStatement(FunctionDeclarationStatement node) {
var comment = node.beginToken.precedingComments;
if (comment != null && comment.lexeme.startsWith('/**')) {
- rule.reportLintForToken(comment);
+ rule.reportAtToken(comment);
}
}
diff --git a/pkg/linter/lib/src/rules/strict_top_level_inference.dart b/pkg/linter/lib/src/rules/strict_top_level_inference.dart
index d7ecdce..5a6224a 100644
--- a/pkg/linter/lib/src/rules/strict_top_level_inference.dart
+++ b/pkg/linter/lib/src/rules/strict_top_level_inference.dart
@@ -117,7 +117,7 @@
variable.declaredFragment?.element,
);
if (overriddenMember == null) {
- rule.reportLintForToken(
+ rule.reportAtToken(
variable.name,
errorCode: LinterLintCode.strict_top_level_inference_split_to_types,
);
@@ -177,7 +177,7 @@
if (node.returnType != null) return;
if (!_isOverride(node, element)) {
- rule.reportLintForToken(
+ rule.reportAtToken(
node.name,
errorCode: LinterLintCode.strict_top_level_inference_add_type,
);
@@ -199,7 +199,7 @@
if (noOverride) {
if (node.returnType == null) {
- rule.reportLintForToken(
+ rule.reportAtToken(
node.name,
errorCode: LinterLintCode.strict_top_level_inference_add_type,
);
@@ -234,7 +234,7 @@
if (parameter.type != null) return;
if (!_isOverride(node, element)) {
- rule.reportLintForToken(
+ rule.reportAtToken(
node.name,
errorCode: LinterLintCode.strict_top_level_inference_add_type,
);
@@ -254,12 +254,12 @@
void _report(Token errorToken, {Token? keyword}) {
if (keyword == null || keyword.type == Keyword.FINAL) {
- rule.reportLintForToken(
+ rule.reportAtToken(
errorToken,
errorCode: LinterLintCode.strict_top_level_inference_add_type,
);
} else if (keyword.type == Keyword.VAR) {
- rule.reportLintForToken(
+ rule.reportAtToken(
errorToken,
arguments: [keyword.lexeme],
errorCode: LinterLintCode.strict_top_level_inference_replace_keyword,
diff --git a/pkg/linter/lib/src/rules/type_annotate_public_apis.dart b/pkg/linter/lib/src/rules/type_annotate_public_apis.dart
index a8e48a4..fedb946 100644
--- a/pkg/linter/lib/src/rules/type_annotate_public_apis.dart
+++ b/pkg/linter/lib/src/rules/type_annotate_public_apis.dart
@@ -56,7 +56,7 @@
// scope of another function.
node.parent is CompilationUnit) {
if (node.returnType == null && !node.isSetter) {
- rule.reportLintForToken(node.name);
+ rule.reportAtToken(node.name);
} else {
node.functionExpression.parameters?.accept(v);
}
@@ -67,7 +67,7 @@
void visitFunctionTypeAlias(FunctionTypeAlias node) {
if (!node.name.isPrivate) {
if (node.returnType == null) {
- rule.reportLintForToken(node.name);
+ rule.reportAtToken(node.name);
} else {
node.parameters.accept(v);
}
@@ -80,7 +80,7 @@
if (!node.name.isPrivate) {
if (node.returnType == null && !node.isSetter) {
- rule.reportLintForToken(node.name);
+ rule.reportAtToken(node.name);
} else {
node.parameters?.accept(v);
}
@@ -124,7 +124,7 @@
if (!node.name.isPrivate &&
!node.isConst &&
!(node.isFinal && hasInferredType(node))) {
- rule.reportLintForToken(node.name);
+ rule.reportAtToken(node.name);
}
}
}
diff --git a/pkg/linter/lib/src/rules/unnecessary_async.dart b/pkg/linter/lib/src/rules/unnecessary_async.dart
index a021096..f47418d 100644
--- a/pkg/linter/lib/src/rules/unnecessary_async.dart
+++ b/pkg/linter/lib/src/rules/unnecessary_async.dart
@@ -153,21 +153,21 @@
// If no imposed return type, then any type is OK.
if (returnType == null) {
- rule.reportLintForToken(asyncKeyword);
+ rule.reportAtToken(asyncKeyword);
return;
}
// We don't have to return anything.
// So, the generated `Future` is not necessary.
if (returnType is VoidType) {
- rule.reportLintForToken(asyncKeyword);
+ rule.reportAtToken(asyncKeyword);
return;
}
// It is OK to return values into `FutureOr`.
// So, wrapping values into `Future` is not necessary.
if (returnType.isDartAsyncFutureOr) {
- rule.reportLintForToken(asyncKeyword);
+ rule.reportAtToken(asyncKeyword);
return;
}
@@ -185,7 +185,7 @@
// If every `return` returns `Future`, we don't need wrapping.
if (visitor.everyReturnHasValue && visitor.returnsOnlyFuture) {
- rule.reportLintForToken(asyncKeyword);
+ rule.reportAtToken(asyncKeyword);
return;
}
}
diff --git a/pkg/linter/lib/src/rules/unnecessary_await_in_return.dart b/pkg/linter/lib/src/rules/unnecessary_await_in_return.dart
index 0af7901..061d847 100644
--- a/pkg/linter/lib/src/rules/unnecessary_await_in_return.dart
+++ b/pkg/linter/lib/src/rules/unnecessary_await_in_return.dart
@@ -77,7 +77,7 @@
if (returnType != null &&
returnType.isDartAsyncFuture &&
typeSystem.isSubtypeOf(type!, returnType)) {
- rule.reportLintForToken(expression.awaitKeyword);
+ rule.reportAtToken(expression.awaitKeyword);
}
}
}
diff --git a/pkg/linter/lib/src/rules/unnecessary_const.dart b/pkg/linter/lib/src/rules/unnecessary_const.dart
index 573607d..ff30f38 100644
--- a/pkg/linter/lib/src/rules/unnecessary_const.dart
+++ b/pkg/linter/lib/src/rules/unnecessary_const.dart
@@ -43,7 +43,7 @@
if (keyword == null || keyword.type != Keyword.CONST) return;
if (node.inConstantContext) {
- rule.reportLintForToken(keyword);
+ rule.reportAtToken(keyword);
}
}
@@ -59,7 +59,7 @@
if (constKeyword == null) return;
if (node.inConstantContext) {
- rule.reportLintForToken(constKeyword);
+ rule.reportAtToken(constKeyword);
}
}
@@ -74,7 +74,7 @@
if (constKeyword == null || constKeyword.type != Keyword.CONST) return;
if (node.inConstantContext) {
- rule.reportLintForToken(constKeyword);
+ rule.reportAtToken(constKeyword);
}
}
}
diff --git a/pkg/linter/lib/src/rules/unnecessary_constructor_name.dart b/pkg/linter/lib/src/rules/unnecessary_constructor_name.dart
index 8d190ab..2a44b39 100644
--- a/pkg/linter/lib/src/rules/unnecessary_constructor_name.dart
+++ b/pkg/linter/lib/src/rules/unnecessary_constructor_name.dart
@@ -57,7 +57,7 @@
void _check(Token? name) {
if (name != null && name.lexeme == 'new') {
- rule.reportLintForToken(name);
+ rule.reportAtToken(name);
}
}
}
diff --git a/pkg/linter/lib/src/rules/unnecessary_final.dart b/pkg/linter/lib/src/rules/unnecessary_final.dart
index b87922e..aa03def 100644
--- a/pkg/linter/lib/src/rules/unnecessary_final.dart
+++ b/pkg/linter/lib/src/rules/unnecessary_final.dart
@@ -70,7 +70,7 @@
if (keyword == null || keyword.type != Keyword.FINAL) return;
var errorCode = getErrorCode(node.matchedValueType);
- rule.reportLintForToken(keyword, errorCode: errorCode);
+ rule.reportAtToken(keyword, errorCode: errorCode);
}
@override
@@ -81,7 +81,7 @@
if (keyword == null) continue;
var errorCode = getErrorCode(type);
- rule.reportLintForToken(keyword, errorCode: errorCode);
+ rule.reportAtToken(keyword, errorCode: errorCode);
}
}
}
@@ -99,12 +99,12 @@
if (keyword == null) return;
if (loopVariable.isFinal) {
var errorCode = getErrorCode(loopVariable.type);
- rule.reportLintForToken(keyword, errorCode: errorCode);
+ rule.reportAtToken(keyword, errorCode: errorCode);
}
} else if (forLoopParts is ForEachPartsWithPattern) {
var keyword = forLoopParts.keyword;
if (keyword.isFinal) {
- rule.reportLintForToken(
+ rule.reportAtToken(
keyword,
errorCode: LinterLintCode.unnecessary_final_without_type,
);
@@ -118,7 +118,7 @@
if (keyword == null) return;
if (node.variables.isFinal) {
var errorCode = getErrorCode(node.variables.type);
- rule.reportLintForToken(keyword, errorCode: errorCode);
+ rule.reportAtToken(keyword, errorCode: errorCode);
}
}
}
diff --git a/pkg/linter/lib/src/rules/unnecessary_getters_setters.dart b/pkg/linter/lib/src/rules/unnecessary_getters_setters.dart
index fc47ff3..ed96f2f 100644
--- a/pkg/linter/lib/src/rules/unnecessary_getters_setters.dart
+++ b/pkg/linter/lib/src/rules/unnecessary_getters_setters.dart
@@ -79,7 +79,7 @@
getterElement.metadata2.annotations.isEmpty &&
setterElement.metadata2.annotations.isEmpty) {
// Just flag the getter (https://github.com/dart-lang/linter/issues/2851)
- rule.reportLintForToken(getter.name);
+ rule.reportAtToken(getter.name);
}
}
}
diff --git a/pkg/linter/lib/src/rules/unnecessary_late.dart b/pkg/linter/lib/src/rules/unnecessary_late.dart
index 057845e..00257b4 100644
--- a/pkg/linter/lib/src/rules/unnecessary_late.dart
+++ b/pkg/linter/lib/src/rules/unnecessary_late.dart
@@ -51,6 +51,6 @@
return;
}
- rule.reportLintForToken(lateKeyword);
+ rule.reportAtToken(lateKeyword);
}
}
diff --git a/pkg/linter/lib/src/rules/unnecessary_new.dart b/pkg/linter/lib/src/rules/unnecessary_new.dart
index 3f3e1ca..5ac97b7 100644
--- a/pkg/linter/lib/src/rules/unnecessary_new.dart
+++ b/pkg/linter/lib/src/rules/unnecessary_new.dart
@@ -37,7 +37,7 @@
void visitInstanceCreationExpression(InstanceCreationExpression node) {
var keyword = node.keyword;
if (keyword != null && keyword.type == Keyword.NEW) {
- rule.reportLintForToken(keyword);
+ rule.reportAtToken(keyword);
}
}
}
diff --git a/pkg/linter/lib/src/rules/unnecessary_null_aware_operator_on_extension_on_nullable.dart b/pkg/linter/lib/src/rules/unnecessary_null_aware_operator_on_extension_on_nullable.dart
index 14a5034..4c5f48c 100644
--- a/pkg/linter/lib/src/rules/unnecessary_null_aware_operator_on_extension_on_nullable.dart
+++ b/pkg/linter/lib/src/rules/unnecessary_null_aware_operator_on_extension_on_nullable.dart
@@ -54,7 +54,7 @@
?.enclosingElement2
: node.element?.enclosingElement2,
)) {
- rule.reportLintForToken(question);
+ rule.reportAtToken(question);
}
}
@@ -66,7 +66,7 @@
_isExtensionOnNullableType(
node.methodName.element?.enclosingElement2,
)) {
- rule.reportLintForToken(operator);
+ rule.reportAtToken(operator);
}
}
@@ -81,7 +81,7 @@
? realParent.writeElement2?.enclosingElement2
: node.propertyName.element?.enclosingElement2,
)) {
- rule.reportLintForToken(node.operator);
+ rule.reportAtToken(node.operator);
}
}
}
diff --git a/pkg/linter/lib/src/rules/unnecessary_null_checks.dart b/pkg/linter/lib/src/rules/unnecessary_null_checks.dart
index 0e5019d..556bba1 100644
--- a/pkg/linter/lib/src/rules/unnecessary_null_checks.dart
+++ b/pkg/linter/lib/src/rules/unnecessary_null_checks.dart
@@ -165,7 +165,7 @@
void visitNullAssertPattern(NullAssertPattern node) {
var expectedType = node.matchedValueType;
if (expectedType != null && context.typeSystem.isNullable(expectedType)) {
- rule.reportLintForToken(node.operator);
+ rule.reportAtToken(node.operator);
}
}
@@ -175,7 +175,7 @@
var expectedType = getExpectedType(node);
if (expectedType != null && context.typeSystem.isNullable(expectedType)) {
- rule.reportLintForToken(node.operator);
+ rule.reportAtToken(node.operator);
}
}
}
diff --git a/pkg/linter/lib/src/rules/unnecessary_nullable_for_final_variable_declarations.dart b/pkg/linter/lib/src/rules/unnecessary_nullable_for_final_variable_declarations.dart
index b4e8649..230606c 100644
--- a/pkg/linter/lib/src/rules/unnecessary_nullable_for_final_variable_declarations.dart
+++ b/pkg/linter/lib/src/rules/unnecessary_nullable_for_final_variable_declarations.dart
@@ -52,7 +52,7 @@
if (valueType == null) return;
if (context.typeSystem.isNullable(type) &&
context.typeSystem.isNonNullable(valueType)) {
- rule.reportLintForToken(node.name);
+ rule.reportAtToken(node.name);
}
}
@@ -105,7 +105,7 @@
if (context.typeSystem.isNullable(declaredElement.type) &&
context.typeSystem.isNonNullable(initializerType)) {
- rule.reportLintForToken(variable.name);
+ rule.reportAtToken(variable.name);
}
}
}
diff --git a/pkg/linter/lib/src/rules/unnecessary_overrides.dart b/pkg/linter/lib/src/rules/unnecessary_overrides.dart
index 44afe01..b31e0f8 100644
--- a/pkg/linter/lib/src/rules/unnecessary_overrides.dart
+++ b/pkg/linter/lib/src/rules/unnecessary_overrides.dart
@@ -105,7 +105,7 @@
@override
void visitSuperExpression(SuperExpression node) {
if (node.beginToken.precedingComments != null) return;
- rule.reportLintForToken(declaration.name);
+ rule.reportAtToken(declaration.name);
}
/// Returns whether [declaration] is annotated with any metadata (other than
diff --git a/pkg/linter/lib/src/rules/unnecessary_this.dart b/pkg/linter/lib/src/rules/unnecessary_this.dart
index d3fd6ef..ca719fe 100644
--- a/pkg/linter/lib/src/rules/unnecessary_this.dart
+++ b/pkg/linter/lib/src/rules/unnecessary_this.dart
@@ -41,7 +41,7 @@
void visitConstructorFieldInitializer(ConstructorFieldInitializer node) {
var thisKeyword = node.thisKeyword;
if (thisKeyword != null) {
- rule.reportLintForToken(thisKeyword);
+ rule.reportAtToken(thisKeyword);
}
}
@@ -60,7 +60,7 @@
element = element?.baseElement;
if (_canReferenceElementWithoutThisPrefix(element, node)) {
- rule.reportLintForToken(node.thisKeyword);
+ rule.reportAtToken(node.thisKeyword);
}
}
diff --git a/pkg/linter/lib/src/rules/unnecessary_underscores.dart b/pkg/linter/lib/src/rules/unnecessary_underscores.dart
index bc17c2f..1eac9b7 100644
--- a/pkg/linter/lib/src/rules/unnecessary_underscores.dart
+++ b/pkg/linter/lib/src/rules/unnecessary_underscores.dart
@@ -61,7 +61,7 @@
var name = element?.name3;
if (isJustUnderscores(name)) {
if (!referencedElements.contains(element)) {
- rule.reportLintForToken(parameterName);
+ rule.reportAtToken(parameterName);
}
}
}
@@ -75,7 +75,7 @@
if (isJustUnderscores(node.name.lexeme)) {
var parent = node.thisOrAncestorOfType<FunctionBody>();
if (!collectReferences(parent).contains(node.declaredFragment?.element)) {
- rule.reportLintForToken(node.name);
+ rule.reportAtToken(node.name);
}
}
}
diff --git a/pkg/linter/lib/src/rules/unreachable_from_main.dart b/pkg/linter/lib/src/rules/unreachable_from_main.dart
index 5b9c3b4..e531046e 100644
--- a/pkg/linter/lib/src/rules/unreachable_from_main.dart
+++ b/pkg/linter/lib/src/rules/unreachable_from_main.dart
@@ -533,17 +533,17 @@
if (name == null) {
rule.reportLint(member.returnType, arguments: [member.nameForError]);
} else {
- rule.reportLintForToken(name, arguments: [member.nameForError]);
+ rule.reportAtToken(name, arguments: [member.nameForError]);
}
} else if (member is NamedCompilationUnitMember) {
- rule.reportLintForToken(member.name, arguments: [member.nameForError]);
+ rule.reportAtToken(member.name, arguments: [member.nameForError]);
} else if (member is MethodDeclaration) {
- rule.reportLintForToken(member.name, arguments: [member.name.lexeme]);
+ rule.reportAtToken(member.name, arguments: [member.name.lexeme]);
} else if (member is VariableDeclaration) {
- rule.reportLintForToken(member.name, arguments: [member.nameForError]);
+ rule.reportAtToken(member.name, arguments: [member.nameForError]);
} else if (member is ExtensionDeclaration) {
var name = member.name;
- rule.reportLintForToken(
+ rule.reportAtToken(
name ?? member.extensionKeyword,
arguments: [name?.lexeme ?? '<unnamed>'],
);
diff --git a/pkg/linter/lib/src/rules/unrelated_type_equality_checks.dart b/pkg/linter/lib/src/rules/unrelated_type_equality_checks.dart
index 0c23364..6cae0bc 100644
--- a/pkg/linter/lib/src/rules/unrelated_type_equality_checks.dart
+++ b/pkg/linter/lib/src/rules/unrelated_type_equality_checks.dart
@@ -57,7 +57,7 @@
if (rightType == null) return;
if (_comparable(leftType, rightType)) return;
- rule.reportLintForToken(
+ rule.reportAtToken(
node.operator,
errorCode: LinterLintCode.unrelated_type_equality_checks_in_expression,
arguments: [rightType.getDisplayString(), leftType.getDisplayString()],
diff --git a/pkg/linter/lib/src/rules/use_enums.dart b/pkg/linter/lib/src/rules/use_enums.dart
index 83b37d4..0f780c7 100644
--- a/pkg/linter/lib/src/rules/use_enums.dart
+++ b/pkg/linter/lib/src/rules/use_enums.dart
@@ -196,6 +196,6 @@
return;
}
- rule.reportLintForToken(node.name);
+ rule.reportAtToken(node.name);
}
}
diff --git a/pkg/linter/lib/src/rules/use_key_in_widget_constructors.dart b/pkg/linter/lib/src/rules/use_key_in_widget_constructors.dart
index 9b2451d..9befca6 100644
--- a/pkg/linter/lib/src/rules/use_key_in_widget_constructors.dart
+++ b/pkg/linter/lib/src/rules/use_key_in_widget_constructors.dart
@@ -43,7 +43,7 @@
classElement.isPublic &&
classElement.extendsWidget &&
classElement.constructors2.where((e) => !e.isSynthetic).isEmpty) {
- rule.reportLintForToken(node.name);
+ rule.reportAtToken(node.name);
}
super.visitClassDeclaration(node);
}
diff --git a/pkg/linter/lib/src/rules/use_null_aware_elements.dart b/pkg/linter/lib/src/rules/use_null_aware_elements.dart
index 65ebcaa..f9d4e98 100644
--- a/pkg/linter/lib/src/rules/use_null_aware_elements.dart
+++ b/pkg/linter/lib/src/rules/use_null_aware_elements.dart
@@ -69,20 +69,20 @@
//
// [if (x != null) x]
// {if (x != null) x}
- rule.reportLintForToken(node.ifKeyword);
+ rule.reportAtToken(node.ifKeyword);
} else if (thenElement case MapLiteralEntry(:var key, :var value)) {
if (key is SimpleIdentifier &&
nullCheckTarget == key.canonicalElement) {
// Map keys, such as the following:
//
// {if (x != null) x: value}
- rule.reportLintForToken(node.ifKeyword);
+ rule.reportAtToken(node.ifKeyword);
} else if (value is SimpleIdentifier &&
nullCheckTarget == value.canonicalElement) {
// Map keys, such as the following:
//
// {if (x != null) key: x}
- rule.reportLintForToken(node.ifKeyword);
+ rule.reportAtToken(node.ifKeyword);
}
}
}
diff --git a/pkg/linter/lib/src/rules/use_setters_to_change_properties.dart b/pkg/linter/lib/src/rules/use_setters_to_change_properties.dart
index 7b00d25..8f7259f 100644
--- a/pkg/linter/lib/src/rules/use_setters_to_change_properties.dart
+++ b/pkg/linter/lib/src/rules/use_setters_to_change_properties.dart
@@ -57,7 +57,7 @@
var parameterElement =
node.declaredFragment?.element.formalParameters.first;
if (rightOperand == parameterElement && leftOperand is FieldElement2) {
- rule.reportLintForToken(node.name);
+ rule.reportAtToken(node.name);
}
}
}
diff --git a/pkg/linter/lib/src/rules/use_to_and_as_if_applicable.dart b/pkg/linter/lib/src/rules/use_to_and_as_if_applicable.dart
index 5ebece9..628a81a 100644
--- a/pkg/linter/lib/src/rules/use_to_and_as_if_applicable.dart
+++ b/pkg/linter/lib/src/rules/use_to_and_as_if_applicable.dart
@@ -53,7 +53,7 @@
!_beginsWithAsOrTo(node.name.lexeme) &&
!node.hasInheritedMethod(inheritanceManager) &&
_checkBody(node.body)) {
- rule.reportLintForToken(node.name);
+ rule.reportAtToken(node.name);
}
}
diff --git a/pkg/linter/tool/checks/rules/no_solo_tests.dart b/pkg/linter/tool/checks/rules/no_solo_tests.dart
index d003ae2..1b3556a 100644
--- a/pkg/linter/tool/checks/rules/no_solo_tests.dart
+++ b/pkg/linter/tool/checks/rules/no_solo_tests.dart
@@ -45,7 +45,7 @@
// TODO(pq): we *could* ensure we're in a reflective test too.
// Handle both 'solo_test_' and 'solo_fail_'.
if (node.name.lexeme.startsWith('solo_')) {
- rule.reportLintForToken(node.name);
+ rule.reportAtToken(node.name);
return;
}
diff --git a/pkg/linter/tool/checks/rules/no_trailing_spaces.dart b/pkg/linter/tool/checks/rules/no_trailing_spaces.dart
index 42dbbec..4fefeec 100644
--- a/pkg/linter/tool/checks/rules/no_trailing_spaces.dart
+++ b/pkg/linter/tool/checks/rules/no_trailing_spaces.dart
@@ -48,7 +48,7 @@
if (literal is! StringToken) return;
if (literal.lexeme.contains(' \n')) {
- rule.reportLintForToken(literal);
+ rule.reportAtToken(literal);
}
}
}