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.addMethodInvocation((MethodInvocation node) {
if (!_insertMethods.contains(node.methodName.name)) return;
if (!fileImportsPackage(node, PackageImports.drift)) return;
// Check if inside a loop
if (_isInsideLoop(node)) {
reporter.atNode(node.methodName);
}
});
}