runWithReporter method
Override this method to implement your lint rule.
Use context to register callbacks for AST node types:
context.addMethodInvocation((node) {
if (condition) {
reporter.atNode(node);
}
});
Implementation
@override
void runWithReporter(
SaropaDiagnosticReporter reporter,
SaropaContext context,
) {
context.addFunctionDeclaration((FunctionDeclaration node) {
_checkFunctionBody(node.functionExpression.body, node.name, reporter);
});
context.addMethodDeclaration((MethodDeclaration node) {
_checkFunctionBody(node.body, node.name, reporter);
});
}