run method
void
run(
- CustomLintResolver resolver,
- ErrorReporter reporter,
- CustomLintContext context
Emits lints for a given file.
run will only be invoked with files respecting filesToAnalyze
Implementation
@override
void run(
CustomLintResolver resolver,
ErrorReporter reporter,
CustomLintContext context,
) {
context.registry.addHookWidgetBody(
isExactly: true,
(node, diagnosticTarget) {
// get all hook expressions from build method
final hookExpressions = switch (node) {
ExpressionFunctionBody(expression: final AstNode node) ||
BlockFunctionBody(block: final AstNode node) =>
getAllInnerHookExpressions(node),
_ => <Expression>[],
};
if (hookExpressions.isNotEmpty) {
return;
}
reporter.reportErrorForNode(_getLintCode(), diagnosticTarget);
},
);
}