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 (!_watchMethods.contains(node.methodName.name)) return;
// Check if target chain contains customSelect
final target = node.target;
if (target == null) return;
final targetSource = target.toSource();
if (!RegExp(r'\bcustomSelect\b').hasMatch(targetSource)) return;
if (RegExp(r'\breadsFrom\b').hasMatch(targetSource)) return;
reporter.atNode(node.methodName);
});
}