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,
) {
// This is a simplified version - full implementation would track
// all call sites across the codebase
context.addFunctionDeclaration((FunctionDeclaration node) {
final FormalParameterList? params = node.functionExpression.parameters;
if (params == null) return;
for (final FormalParameter param in params.parameters) {
// Check if parameter type is nullable
TypeAnnotation? type;
if (param is RegularFormalParameter &&
param.functionTypedSuffix == null) {
type = param.type;
}
if (type == null) continue;
// Check if nullable
if (type.question != null) {
// This is a simplified heuristic
// Full implementation would analyze call sites
}
}
});
}