linter: Migrate reportLint to reportAtNode for rules q-z
Change-Id: Idc5711338e0cae4232d680634d8b85a7c57fbad0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425400
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
diff --git a/pkg/linter/lib/src/rules/pub/depend_on_referenced_packages.dart b/pkg/linter/lib/src/rules/pub/depend_on_referenced_packages.dart
index f14b958..6463241 100644
--- a/pkg/linter/lib/src/rules/pub/depend_on_referenced_packages.dart
+++ b/pkg/linter/lib/src/rules/pub/depend_on_referenced_packages.dart
@@ -81,6 +81,6 @@
var packageName = uriContent.substring(8, firstSlash);
if (virtualPackages.contains(packageName)) return;
if (availableDeps.contains(packageName)) return;
- rule.reportLint(node.uri, arguments: [packageName]);
+ rule.reportAtNode(node.uri, arguments: [packageName]);
}
}
diff --git a/pkg/linter/lib/src/rules/recursive_getters.dart b/pkg/linter/lib/src/rules/recursive_getters.dart
index 18a59ee..02daea1 100644
--- a/pkg/linter/lib/src/rules/recursive_getters.dart
+++ b/pkg/linter/lib/src/rules/recursive_getters.dart
@@ -58,7 +58,7 @@
@override
void visitSimpleIdentifier(SimpleIdentifier node) {
if (isSelfReference(node)) {
- rule.reportLint(node, arguments: [node.name]);
+ rule.reportAtNode(node, arguments: [node.name]);
}
// No need to call super visit (SimpleIdentifiers have no children).
diff --git a/pkg/linter/lib/src/rules/sized_box_for_whitespace.dart b/pkg/linter/lib/src/rules/sized_box_for_whitespace.dart
index fcf2951..280f763 100644
--- a/pkg/linter/lib/src/rules/sized_box_for_whitespace.dart
+++ b/pkg/linter/lib/src/rules/sized_box_for_whitespace.dart
@@ -40,7 +40,7 @@
}
if (_shouldReportForArguments(node.argumentList)) {
- rule.reportLint(node.constructorName);
+ rule.reportAtNode(node.constructorName);
}
}
diff --git a/pkg/linter/lib/src/rules/sized_box_shrink_expand.dart b/pkg/linter/lib/src/rules/sized_box_shrink_expand.dart
index 8623af32..6208438 100644
--- a/pkg/linter/lib/src/rules/sized_box_shrink_expand.dart
+++ b/pkg/linter/lib/src/rules/sized_box_shrink_expand.dart
@@ -48,10 +48,10 @@
}
if (data.width == 0 && data.height == 0) {
- rule.reportLint(node.constructorName, arguments: ['shrink']);
+ rule.reportAtNode(node.constructorName, arguments: ['shrink']);
} else if (data.width == double.infinity &&
data.height == double.infinity) {
- rule.reportLint(node.constructorName, arguments: ['expand']);
+ rule.reportAtNode(node.constructorName, arguments: ['expand']);
}
}
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 3d84afb..6110fbd 100644
--- a/pkg/linter/lib/src/rules/slash_for_doc_comments.dart
+++ b/pkg/linter/lib/src/rules/slash_for_doc_comments.dart
@@ -59,7 +59,7 @@
void checkComment(Comment? comment) {
if (comment != null && isJavaStyle(comment)) {
- rule.reportLint(comment);
+ rule.reportAtNode(comment);
}
}
diff --git a/pkg/linter/lib/src/rules/sort_child_properties_last.dart b/pkg/linter/lib/src/rules/sort_child_properties_last.dart
index 7071a09..dd3ef27 100644
--- a/pkg/linter/lib/src/rules/sort_child_properties_last.dart
+++ b/pkg/linter/lib/src/rules/sort_child_properties_last.dart
@@ -59,7 +59,7 @@
if (!onlyClosuresAfterChild) {
var argument = arguments.firstWhere(isChildArg);
var name = (argument as NamedExpression).name.label.name;
- rule.reportLint(argument, arguments: [name]);
+ rule.reportAtNode(argument, arguments: [name]);
}
}
diff --git a/pkg/linter/lib/src/rules/sort_constructors_first.dart b/pkg/linter/lib/src/rules/sort_constructors_first.dart
index 9d359d9..9627bb8 100644
--- a/pkg/linter/lib/src/rules/sort_constructors_first.dart
+++ b/pkg/linter/lib/src/rules/sort_constructors_first.dart
@@ -39,7 +39,7 @@
for (var member in members) {
if (member is ConstructorDeclaration) {
if (other) {
- rule.reportLint(member.returnType);
+ rule.reportAtNode(member.returnType);
}
} else {
other = true;
diff --git a/pkg/linter/lib/src/rules/sort_unnamed_constructors_first.dart b/pkg/linter/lib/src/rules/sort_unnamed_constructors_first.dart
index e7b0271..104f925 100644
--- a/pkg/linter/lib/src/rules/sort_unnamed_constructors_first.dart
+++ b/pkg/linter/lib/src/rules/sort_unnamed_constructors_first.dart
@@ -43,7 +43,7 @@
if (member is ConstructorDeclaration) {
if (member.name == null) {
if (seenConstructor) {
- rule.reportLint(member.returnType);
+ rule.reportAtNode(member.returnType);
}
} else {
seenConstructor = true;
diff --git a/pkg/linter/lib/src/rules/specify_nonobvious_local_variable_types.dart b/pkg/linter/lib/src/rules/specify_nonobvious_local_variable_types.dart
index 6a3525c..f4af344 100644
--- a/pkg/linter/lib/src/rules/specify_nonobvious_local_variable_types.dart
+++ b/pkg/linter/lib/src/rules/specify_nonobvious_local_variable_types.dart
@@ -55,7 +55,7 @@
!staticType.isDartCoreNull) {
return;
}
- rule.reportLint(node);
+ rule.reportAtNode(node);
}
}
@@ -79,7 +79,7 @@
if (iterable.hasObviousType) {
return;
}
- rule.reportLint(loopParts.loopVariable);
+ rule.reportAtNode(loopParts.loopVariable);
}
}
@@ -133,10 +133,10 @@
}
if (aDeclaredTypeIsNeeded) {
if (node.variables.length == 1) {
- rule.reportLint(node);
+ rule.reportAtNode(node);
} else {
// Multiple variables, report each of them separately. No fix.
- variablesThatNeedAType.forEach(rule.reportLint);
+ variablesThatNeedAType.forEach(rule.reportAtNode);
}
}
}
diff --git a/pkg/linter/lib/src/rules/specify_nonobvious_property_types.dart b/pkg/linter/lib/src/rules/specify_nonobvious_property_types.dart
index b7b8534..820abac 100644
--- a/pkg/linter/lib/src/rules/specify_nonobvious_property_types.dart
+++ b/pkg/linter/lib/src/rules/specify_nonobvious_property_types.dart
@@ -107,10 +107,10 @@
}
if (aDeclaredTypeIsNeeded) {
if (node.variables.length == 1) {
- rule.reportLint(node);
+ rule.reportAtNode(node);
} else {
// Multiple variables, report each of them separately. No fix.
- variablesThatNeedAType.forEach(rule.reportLint);
+ variablesThatNeedAType.forEach(rule.reportAtNode);
}
}
}
diff --git a/pkg/linter/lib/src/rules/test_types_in_equals.dart b/pkg/linter/lib/src/rules/test_types_in_equals.dart
index a9f00fb..f18e7a9 100644
--- a/pkg/linter/lib/src/rules/test_types_in_equals.dart
+++ b/pkg/linter/lib/src/rules/test_types_in_equals.dart
@@ -43,7 +43,7 @@
var parameterName = parameters?.parameterFragments.first?.name2;
if (expression.name == parameterName) {
var typeName = _getTypeName(declaration!);
- rule.reportLint(node, arguments: [typeName]);
+ rule.reportAtNode(node, arguments: [typeName]);
}
}
diff --git a/pkg/linter/lib/src/rules/tighten_type_of_initializing_formals.dart b/pkg/linter/lib/src/rules/tighten_type_of_initializing_formals.dart
index cf75bc9..e0580d9 100644
--- a/pkg/linter/lib/src/rules/tighten_type_of_initializing_formals.dart
+++ b/pkg/linter/lib/src/rules/tighten_type_of_initializing_formals.dart
@@ -72,7 +72,7 @@
void _check(Element? element, ConstructorDeclaration node) {
if (element is FieldFormalParameterElement ||
element is SuperFormalParameterElement) {
- rule.reportLint(
+ rule.reportAtNode(
node.parameters.parameters.firstWhere(
(p) => p.declaredFragment?.element == element,
),
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 fedb946..0d47911 100644
--- a/pkg/linter/lib/src/rules/type_annotate_public_apis.dart
+++ b/pkg/linter/lib/src/rules/type_annotate_public_apis.dart
@@ -114,7 +114,7 @@
if (param.type == null) {
var paramName = param.name?.lexeme;
if (paramName != null && !paramName.isJustUnderscores) {
- rule.reportLint(param);
+ rule.reportAtNode(param);
}
}
}
diff --git a/pkg/linter/lib/src/rules/type_init_formals.dart b/pkg/linter/lib/src/rules/type_init_formals.dart
index 2dfe02c..dba2a07 100644
--- a/pkg/linter/lib/src/rules/type_init_formals.dart
+++ b/pkg/linter/lib/src/rules/type_init_formals.dart
@@ -44,7 +44,7 @@
var field = paramElement.field2;
// If no such field exists, the code is invalid; do not report lint.
if (field != null && nodeType.type == field.type) {
- rule.reportLint(nodeType);
+ rule.reportAtNode(nodeType);
}
}
@@ -60,7 +60,7 @@
if (superConstructorParameter == null) return;
if (superConstructorParameter.type == nodeType.type) {
- rule.reportLint(nodeType);
+ rule.reportAtNode(nodeType);
}
}
}
diff --git a/pkg/linter/lib/src/rules/type_literal_in_constant_pattern.dart b/pkg/linter/lib/src/rules/type_literal_in_constant_pattern.dart
index 3c1d724..797b43e 100644
--- a/pkg/linter/lib/src/rules/type_literal_in_constant_pattern.dart
+++ b/pkg/linter/lib/src/rules/type_literal_in_constant_pattern.dart
@@ -44,7 +44,7 @@
var expressionType = node.expression.staticType;
if (expressionType != null && expressionType.isDartCoreType) {
- rule.reportLint(node);
+ rule.reportAtNode(node);
}
}
}
diff --git a/pkg/linter/lib/src/rules/unawaited_futures.dart b/pkg/linter/lib/src/rules/unawaited_futures.dart
index 9ecc59f..fefe5a9 100644
--- a/pkg/linter/lib/src/rules/unawaited_futures.dart
+++ b/pkg/linter/lib/src/rules/unawaited_futures.dart
@@ -71,7 +71,7 @@
if (_isEnclosedInAsyncFunctionBody(node)) {
// Future expression statement that isn't awaited in an async function:
// while this is legal, it's a very frequent sign of an error.
- rule.reportLint(node);
+ rule.reportAtNode(node);
}
}
@@ -111,7 +111,7 @@
if ((expr.staticType?.isDartAsyncFuture ?? false) &&
_isEnclosedInAsyncFunctionBody(expr) &&
expr is! AssignmentExpression) {
- rule.reportLint(expr);
+ rule.reportAtNode(expr);
}
}
}
diff --git a/pkg/linter/lib/src/rules/unnecessary_brace_in_string_interps.dart b/pkg/linter/lib/src/rules/unnecessary_brace_in_string_interps.dart
index 53fad13..cc0950f 100644
--- a/pkg/linter/lib/src/rules/unnecessary_brace_in_string_interps.dart
+++ b/pkg/linter/lib/src/rules/unnecessary_brace_in_string_interps.dart
@@ -59,7 +59,7 @@
void _check(InterpolationExpression expression) {
var bracket = expression.rightBracket;
if (bracket != null && !isIdentifierPart(bracket.next)) {
- rule.reportLint(expression);
+ rule.reportAtNode(expression);
}
}
}
diff --git a/pkg/linter/lib/src/rules/unnecessary_breaks.dart b/pkg/linter/lib/src/rules/unnecessary_breaks.dart
index d25713d..04dce96 100644
--- a/pkg/linter/lib/src/rules/unnecessary_breaks.dart
+++ b/pkg/linter/lib/src/rules/unnecessary_breaks.dart
@@ -43,7 +43,7 @@
var statements = parent.statements;
if (statements.length == 1) return;
if (node == statements.last) {
- rule.reportLint(node);
+ rule.reportAtNode(node);
}
}
}
diff --git a/pkg/linter/lib/src/rules/unnecessary_lambdas.dart b/pkg/linter/lib/src/rules/unnecessary_lambdas.dart
index 5c5d929..513ec40 100644
--- a/pkg/linter/lib/src/rules/unnecessary_lambdas.dart
+++ b/pkg/linter/lib/src/rules/unnecessary_lambdas.dart
@@ -170,7 +170,7 @@
}
}
- rule.reportLint(node);
+ rule.reportAtNode(node);
}
void _visitInvocationExpression(
@@ -195,7 +195,7 @@
// see: https://github.com/dart-lang/linter/issues/1561
var checker = _FinalExpressionChecker(parameters);
if (checker.isFinalNode(node.function)) {
- rule.reportLint(nodeToLint);
+ rule.reportAtNode(nodeToLint);
}
} else if (node is MethodInvocation) {
if (node.target.mightBeDeferred) return;
@@ -221,7 +221,7 @@
checker.isFinalNode(node.target) &&
node.methodName.element.isFinal &&
node.typeArguments == null) {
- rule.reportLint(nodeToLint);
+ rule.reportAtNode(nodeToLint);
}
}
}
diff --git a/pkg/linter/lib/src/rules/unnecessary_library_directive.dart b/pkg/linter/lib/src/rules/unnecessary_library_directive.dart
index 1cffe40..976820b 100644
--- a/pkg/linter/lib/src/rules/unnecessary_library_directive.dart
+++ b/pkg/linter/lib/src/rules/unnecessary_library_directive.dart
@@ -43,7 +43,7 @@
}
if (node.sortedCommentAndAnnotations.isEmpty) {
- rule.reportLint(node);
+ rule.reportAtNode(node);
}
}
}
diff --git a/pkg/linter/lib/src/rules/unnecessary_library_name.dart b/pkg/linter/lib/src/rules/unnecessary_library_name.dart
index 91378d4..b358d7e 100644
--- a/pkg/linter/lib/src/rules/unnecessary_library_name.dart
+++ b/pkg/linter/lib/src/rules/unnecessary_library_name.dart
@@ -39,7 +39,7 @@
void visitLibraryDirective(LibraryDirective node) {
var name = node.name2;
if (name != null) {
- rule.reportLint(name);
+ rule.reportAtNode(name);
}
}
}
diff --git a/pkg/linter/lib/src/rules/unnecessary_null_aware_assignments.dart b/pkg/linter/lib/src/rules/unnecessary_null_aware_assignments.dart
index 3f1b8df..b58af12 100644
--- a/pkg/linter/lib/src/rules/unnecessary_null_aware_assignments.dart
+++ b/pkg/linter/lib/src/rules/unnecessary_null_aware_assignments.dart
@@ -43,7 +43,7 @@
if (node.operator.type == TokenType.QUESTION_QUESTION_EQ &&
node.rightHandSide.isNullLiteral) {
- rule.reportLint(node);
+ rule.reportAtNode(node);
}
}
}
diff --git a/pkg/linter/lib/src/rules/unnecessary_null_in_if_null_operators.dart b/pkg/linter/lib/src/rules/unnecessary_null_in_if_null_operators.dart
index b8efcc78..ab2f090 100644
--- a/pkg/linter/lib/src/rules/unnecessary_null_in_if_null_operators.dart
+++ b/pkg/linter/lib/src/rules/unnecessary_null_in_if_null_operators.dart
@@ -40,9 +40,9 @@
void visitBinaryExpression(BinaryExpression node) {
if (node.operator.type == TokenType.QUESTION_QUESTION) {
if (node.rightOperand.isNullLiteral) {
- rule.reportLint(node.rightOperand);
+ rule.reportAtNode(node.rightOperand);
} else if (node.leftOperand.isNullLiteral) {
- rule.reportLint(node.leftOperand);
+ rule.reportAtNode(node.leftOperand);
}
}
}
diff --git a/pkg/linter/lib/src/rules/unnecessary_parenthesis.dart b/pkg/linter/lib/src/rules/unnecessary_parenthesis.dart
index 6edf6d7..f2cb38a 100644
--- a/pkg/linter/lib/src/rules/unnecessary_parenthesis.dart
+++ b/pkg/linter/lib/src/rules/unnecessary_parenthesis.dart
@@ -94,7 +94,7 @@
(parent is DoStatement && node == parent.condition) ||
(parent is SwitchStatement && node == parent.expression) ||
(parent is SwitchExpression && node == parent.expression)) {
- rule.reportLint(node);
+ rule.reportAtNode(node);
return;
}
@@ -155,14 +155,14 @@
return;
}
}
- rule.reportLint(node);
+ rule.reportAtNode(node);
return;
}
if (expression is ConstructorReference) {
if (parent is! FunctionExpressionInvocation ||
parent.typeArguments == null) {
- rule.reportLint(node);
+ rule.reportAtNode(node);
return;
}
}
@@ -267,7 +267,7 @@
// interpreted as a set-or-map literal.
if (node.wouldBeParsedAsStatementBlock) return;
}
- rule.reportLint(node);
+ rule.reportAtNode(node);
}
}
diff --git a/pkg/linter/lib/src/rules/unnecessary_raw_strings.dart b/pkg/linter/lib/src/rules/unnecessary_raw_strings.dart
index 5a3a8a1..c576f63 100644
--- a/pkg/linter/lib/src/rules/unnecessary_raw_strings.dart
+++ b/pkg/linter/lib/src/rules/unnecessary_raw_strings.dart
@@ -34,7 +34,7 @@
@override
void visitSimpleStringLiteral(SimpleStringLiteral node) {
if (node.isRaw && ![r'\', r'$'].any(node.literal.lexeme.contains)) {
- rule.reportLint(node);
+ rule.reportAtNode(node);
}
}
}
diff --git a/pkg/linter/lib/src/rules/unnecessary_statements.dart b/pkg/linter/lib/src/rules/unnecessary_statements.dart
index d02f591..d8d32d0 100644
--- a/pkg/linter/lib/src/rules/unnecessary_statements.dart
+++ b/pkg/linter/lib/src/rules/unnecessary_statements.dart
@@ -108,7 +108,7 @@
@override
void visitNode(AstNode expression) {
- rule.reportLint(expression);
+ rule.reportAtNode(expression);
}
@override
@@ -190,7 +190,7 @@
void visitCascadeExpression(CascadeExpression node) {
for (var section in node.cascadeSections) {
if (section is PropertyAccess && section.staticType is FunctionType) {
- reportNoClearEffect.rule.reportLint(section);
+ reportNoClearEffect.rule.reportAtNode(section);
}
}
}
diff --git a/pkg/linter/lib/src/rules/unnecessary_string_interpolations.dart b/pkg/linter/lib/src/rules/unnecessary_string_interpolations.dart
index 3d13db2..1a475e6 100644
--- a/pkg/linter/lib/src/rules/unnecessary_string_interpolations.dart
+++ b/pkg/linter/lib/src/rules/unnecessary_string_interpolations.dart
@@ -47,7 +47,7 @@
if (staticType != null &&
staticType.isDartCoreString &&
staticType.nullabilitySuffix != NullabilitySuffix.question) {
- rule.reportLint(node);
+ rule.reportAtNode(node);
}
}
}
diff --git a/pkg/linter/lib/src/rules/unnecessary_to_list_in_spreads.dart b/pkg/linter/lib/src/rules/unnecessary_to_list_in_spreads.dart
index 079c235..ed304f3 100644
--- a/pkg/linter/lib/src/rules/unnecessary_to_list_in_spreads.dart
+++ b/pkg/linter/lib/src/rules/unnecessary_to_list_in_spreads.dart
@@ -42,7 +42,7 @@
if (expression.methodName.name == 'toList' &&
target != null &&
target.staticType.implementsInterface('Iterable', 'dart.core')) {
- rule.reportLint(expression.methodName);
+ rule.reportAtNode(expression.methodName);
}
}
}
diff --git a/pkg/linter/lib/src/rules/unreachable_from_main.dart b/pkg/linter/lib/src/rules/unreachable_from_main.dart
index 174cdf1..4cdde79 100644
--- a/pkg/linter/lib/src/rules/unreachable_from_main.dart
+++ b/pkg/linter/lib/src/rules/unreachable_from_main.dart
@@ -531,7 +531,10 @@
if (member is ConstructorDeclaration) {
var name = member.name;
if (name == null) {
- rule.reportLint(member.returnType, arguments: [member.nameForError]);
+ rule.reportAtNode(
+ member.returnType,
+ arguments: [member.nameForError],
+ );
} else {
rule.reportAtToken(name, arguments: [member.nameForError]);
}
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 6cae0bc..ccd63b9 100644
--- a/pkg/linter/lib/src/rules/unrelated_type_equality_checks.dart
+++ b/pkg/linter/lib/src/rules/unrelated_type_equality_checks.dart
@@ -73,7 +73,7 @@
if (operandType == null) return;
if (_comparable(valueType, operandType)) return;
- rule.reportLint(
+ rule.reportAtNode(
node,
errorCode: LinterLintCode.unrelated_type_equality_checks_in_pattern,
arguments: [operandType.getDisplayString(), valueType.getDisplayString()],
diff --git a/pkg/linter/lib/src/rules/unsafe_variance.dart b/pkg/linter/lib/src/rules/unsafe_variance.dart
index 83b9045..53ec611 100644
--- a/pkg/linter/lib/src/rules/unsafe_variance.dart
+++ b/pkg/linter/lib/src/rules/unsafe_variance.dart
@@ -55,7 +55,7 @@
if (typeParameterElement is TypeParameterElementImpl2) {
if (typeParameterElement.firstFragment.isLegacyCovariant &&
variance != Variance.out) {
- rule.reportLint(typeAnnotation);
+ rule.reportAtNode(typeAnnotation);
}
}
}
diff --git a/pkg/linter/lib/src/rules/use_build_context_synchronously.dart b/pkg/linter/lib/src/rules/use_build_context_synchronously.dart
index 0f8adaa..aac7c2c 100644
--- a/pkg/linter/lib/src/rules/use_build_context_synchronously.dart
+++ b/pkg/linter/lib/src/rules/use_build_context_synchronously.dart
@@ -1124,7 +1124,7 @@
asyncStateTracker.hasUnrelatedMountedCheck
? LinterLintCode.use_build_context_synchronously_wrong_mounted
: LinterLintCode.use_build_context_synchronously_async_use;
- rule.reportLint(node, errorCode: errorCode);
+ rule.reportAtNode(node, errorCode: errorCode);
return;
}
@@ -1266,7 +1266,7 @@
);
if (argument == null) continue;
if (callback == argument.expression) {
- rule.reportLint(
+ rule.reportAtNode(
errorNode,
errorCode: LinterLintCode.use_build_context_synchronously_async_use,
);
@@ -1285,7 +1285,7 @@
for (var position in positions) {
if (positionalArguments.length > position &&
callback == positionalArguments[position]) {
- rule.reportLint(
+ rule.reportAtNode(
errorNode,
errorCode: LinterLintCode.use_build_context_synchronously_async_use,
);
diff --git a/pkg/linter/lib/src/rules/use_colored_box.dart b/pkg/linter/lib/src/rules/use_colored_box.dart
index 326d921..e5f9eb7 100644
--- a/pkg/linter/lib/src/rules/use_colored_box.dart
+++ b/pkg/linter/lib/src/rules/use_colored_box.dart
@@ -40,7 +40,7 @@
}
if (_shouldReportForArguments(node.argumentList)) {
- rule.reportLint(node.constructorName);
+ rule.reportAtNode(node.constructorName);
}
}
diff --git a/pkg/linter/lib/src/rules/use_decorated_box.dart b/pkg/linter/lib/src/rules/use_decorated_box.dart
index fc8333d..2842786 100644
--- a/pkg/linter/lib/src/rules/use_decorated_box.dart
+++ b/pkg/linter/lib/src/rules/use_decorated_box.dart
@@ -40,7 +40,7 @@
}
if (_shouldReportForArguments(node.argumentList)) {
- rule.reportLint(node.constructorName);
+ rule.reportAtNode(node.constructorName);
}
}
diff --git a/pkg/linter/lib/src/rules/use_full_hex_values_for_flutter_colors.dart b/pkg/linter/lib/src/rules/use_full_hex_values_for_flutter_colors.dart
index 015287a..304cc54d 100644
--- a/pkg/linter/lib/src/rules/use_full_hex_values_for_flutter_colors.dart
+++ b/pkg/linter/lib/src/rules/use_full_hex_values_for_flutter_colors.dart
@@ -56,7 +56,7 @@
var value = argument.literal.lexeme.toLowerCase();
value = value.replaceAll(_underscoresPattern, '');
if (!value.startsWith('0x') || value.length != 10) {
- rule.reportLint(argument);
+ rule.reportAtNode(argument);
}
}
}
diff --git a/pkg/linter/lib/src/rules/use_function_type_syntax_for_parameters.dart b/pkg/linter/lib/src/rules/use_function_type_syntax_for_parameters.dart
index 975e6b4..0dc73ff 100644
--- a/pkg/linter/lib/src/rules/use_function_type_syntax_for_parameters.dart
+++ b/pkg/linter/lib/src/rules/use_function_type_syntax_for_parameters.dart
@@ -40,6 +40,6 @@
@override
void visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) {
- rule.reportLint(node, arguments: [node.name.lexeme]);
+ rule.reportAtNode(node, arguments: [node.name.lexeme]);
}
}
diff --git a/pkg/linter/lib/src/rules/use_if_null_to_convert_nulls_to_bools.dart b/pkg/linter/lib/src/rules/use_if_null_to_convert_nulls_to_bools.dart
index aa603de..98040ee 100644
--- a/pkg/linter/lib/src/rules/use_if_null_to_convert_nulls_to_bools.dart
+++ b/pkg/linter/lib/src/rules/use_if_null_to_convert_nulls_to_bools.dart
@@ -50,13 +50,13 @@
isNullableBool(type) &&
right is BooleanLiteral &&
right.value) {
- rule.reportLint(node);
+ rule.reportAtNode(node);
}
if (node.operator.type == TokenType.BANG_EQ &&
isNullableBool(type) &&
right is BooleanLiteral &&
!right.value) {
- rule.reportLint(node);
+ rule.reportAtNode(node);
}
}
}
diff --git a/pkg/linter/lib/src/rules/use_is_even_rather_than_modulo.dart b/pkg/linter/lib/src/rules/use_is_even_rather_than_modulo.dart
index 6ce4785..729a598 100644
--- a/pkg/linter/lib/src/rules/use_is_even_rather_than_modulo.dart
+++ b/pkg/linter/lib/src/rules/use_is_even_rather_than_modulo.dart
@@ -75,6 +75,6 @@
}
}
- rule.reportLint(node, arguments: [value == 0 ? 'isEven' : 'isOdd']);
+ rule.reportAtNode(node, arguments: [value == 0 ? 'isEven' : 'isOdd']);
}
}
diff --git a/pkg/linter/lib/src/rules/use_named_constants.dart b/pkg/linter/lib/src/rules/use_named_constants.dart
index 533e817..fe3874e 100644
--- a/pkg/linter/lib/src/rules/use_named_constants.dart
+++ b/pkg/linter/lib/src/rules/use_named_constants.dart
@@ -64,7 +64,7 @@
)) {
if (field.isAccessibleIn2(library) &&
field.computeConstantValue() == value) {
- rule.reportLint(
+ rule.reportAtNode(
node,
arguments: ['${element.name3}.${field.name3}'],
);
diff --git a/pkg/linter/lib/src/rules/use_raw_strings.dart b/pkg/linter/lib/src/rules/use_raw_strings.dart
index 2a9ae38..eba4d2b 100644
--- a/pkg/linter/lib/src/rules/use_raw_strings.dart
+++ b/pkg/linter/lib/src/rules/use_raw_strings.dart
@@ -51,7 +51,7 @@
}
}
if (hasEscape) {
- rule.reportLint(node);
+ rule.reportAtNode(node);
}
}
}
diff --git a/pkg/linter/lib/src/rules/use_rethrow_when_possible.dart b/pkg/linter/lib/src/rules/use_rethrow_when_possible.dart
index daf52ca..e5068f1 100644
--- a/pkg/linter/lib/src/rules/use_rethrow_when_possible.dart
+++ b/pkg/linter/lib/src/rules/use_rethrow_when_possible.dart
@@ -42,7 +42,7 @@
var exceptionParameter =
catchClause?.exceptionParameter?.declaredElement2;
if (element == exceptionParameter) {
- rule.reportLint(node);
+ rule.reportAtNode(node);
}
}
}
diff --git a/pkg/linter/lib/src/rules/use_string_buffers.dart b/pkg/linter/lib/src/rules/use_string_buffers.dart
index 4ca9709..9bbd2fc 100644
--- a/pkg/linter/lib/src/rules/use_string_buffers.dart
+++ b/pkg/linter/lib/src/rules/use_string_buffers.dart
@@ -66,7 +66,7 @@
@override
void visitSimpleIdentifier(SimpleIdentifier node) {
if (node.element == identifier.element) {
- rule.reportLint(identifier);
+ rule.reportAtNode(identifier);
}
}
@@ -99,7 +99,7 @@
writeType.isDartCoreString) {
if (node.operator.type == TokenType.PLUS_EQ &&
!localElements.contains(node.writeElement2)) {
- rule.reportLint(node);
+ rule.reportAtNode(node);
}
if (node.operator.type == TokenType.EQ) {
var visitor = _IdentifierIsPrefixVisitor(rule, left);
diff --git a/pkg/linter/lib/src/rules/use_string_in_part_of_directives.dart b/pkg/linter/lib/src/rules/use_string_in_part_of_directives.dart
index 2b88e92..a5d008e 100644
--- a/pkg/linter/lib/src/rules/use_string_in_part_of_directives.dart
+++ b/pkg/linter/lib/src/rules/use_string_in_part_of_directives.dart
@@ -42,7 +42,7 @@
@override
void visitPartOfDirective(PartOfDirective node) {
if (node.libraryName != null) {
- rule.reportLint(node);
+ rule.reportAtNode(node);
}
}
}
diff --git a/pkg/linter/lib/src/rules/use_test_throws_matchers.dart b/pkg/linter/lib/src/rules/use_test_throws_matchers.dart
index c58dc31..194a2c5 100644
--- a/pkg/linter/lib/src/rules/use_test_throws_matchers.dart
+++ b/pkg/linter/lib/src/rules/use_test_throws_matchers.dart
@@ -51,7 +51,7 @@
if (isTestInvocation(lastBodyStatement, 'fail') &&
node.finallyBlock == null) {
- rule.reportLint(lastBodyStatement);
+ rule.reportAtNode(lastBodyStatement);
}
}
}
diff --git a/pkg/linter/lib/src/rules/use_truncating_division.dart b/pkg/linter/lib/src/rules/use_truncating_division.dart
index a25c53d..48f3257 100644
--- a/pkg/linter/lib/src/rules/use_truncating_division.dart
+++ b/pkg/linter/lib/src/rules/use_truncating_division.dart
@@ -63,7 +63,7 @@
if (grandParent is MethodInvocation &&
grandParent.methodName.name == 'toInt' &&
grandParent.argumentList.arguments.isEmpty) {
- rule.reportLint(grandParent);
+ rule.reportAtNode(grandParent);
}
}
}
diff --git a/pkg/linter/lib/src/rules/valid_regexps.dart b/pkg/linter/lib/src/rules/valid_regexps.dart
index 33d25ae..0b415d2 100644
--- a/pkg/linter/lib/src/rules/valid_regexps.dart
+++ b/pkg/linter/lib/src/rules/valid_regexps.dart
@@ -55,7 +55,7 @@
try {
RegExp(source, unicode: unicode);
} on FormatException {
- rule.reportLint(sourceExpression);
+ rule.reportAtNode(sourceExpression);
}
}
}
diff --git a/pkg/linter/lib/src/rules/void_checks.dart b/pkg/linter/lib/src/rules/void_checks.dart
index 56df59d..b259dd2 100644
--- a/pkg/linter/lib/src/rules/void_checks.dart
+++ b/pkg/linter/lib/src/rules/void_checks.dart
@@ -155,11 +155,11 @@
return;
}
if (expectedType is VoidType && !isTypeAcceptableWhenExpectingVoid(type)) {
- rule.reportLint(node);
+ rule.reportAtNode(node);
} else if (expectedType.isDartAsyncFutureOr &&
(expectedType as InterfaceType).typeArguments.first is VoidType &&
!isTypeAcceptableWhenExpectingFutureOrVoid(type)) {
- rule.reportLint(node);
+ rule.reportAtNode(node);
} else if (checkedNode is FunctionExpression &&
checkedNode.body is! ExpressionFunctionBody &&
expectedType is FunctionType &&
diff --git a/pkg/linter/lib/src/util/leak_detector_visitor.dart b/pkg/linter/lib/src/util/leak_detector_visitor.dart
index 91c650b..5938bd3 100644
--- a/pkg/linter/lib/src/util/leak_detector_visitor.dart
+++ b/pkg/linter/lib/src/util/leak_detector_visitor.dart
@@ -44,7 +44,7 @@
return;
}
- rule.reportLint(variable);
+ rule.reportAtNode(variable);
};
/// Whether any of the [predicates] applies to [methodName] and holds true for
diff --git a/pkg/linter/tool/checks/rules/no_solo_tests.dart b/pkg/linter/tool/checks/rules/no_solo_tests.dart
index 1b3556a..6465208 100644
--- a/pkg/linter/tool/checks/rules/no_solo_tests.dart
+++ b/pkg/linter/tool/checks/rules/no_solo_tests.dart
@@ -51,7 +51,7 @@
for (var annotation in node.metadata) {
if (annotation.isSoloTest) {
- rule.reportLint(annotation);
+ rule.reportAtNode(annotation);
}
}
}
diff --git a/pkg/linter/tool/checks/rules/visit_registered_nodes.dart b/pkg/linter/tool/checks/rules/visit_registered_nodes.dart
index ac59252..e75b7fc 100644
--- a/pkg/linter/tool/checks/rules/visit_registered_nodes.dart
+++ b/pkg/linter/tool/checks/rules/visit_registered_nodes.dart
@@ -70,7 +70,7 @@
if (visitor is! ClassElement) return;
if (implements(visitor, 'visit$nodeType')) return;
- rule.reportLint(node.methodName);
+ rule.reportAtNode(node.methodName);
}
}