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.addSimpleStringLiteral((SimpleStringLiteral node) {
final String value = node.value;
for (final String api in _deprecatedSecurityApis) {
if (value.contains(api)) {
reporter.atNode(node);
return;
}
}
});
context.addMethodInvocation((MethodInvocation node) {
final String methodName = node.methodName.name;
if (_deprecatedSecurityApis.contains(methodName)) {
reporter.atNode(node);
}
});
}