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.addPropertyAccess((PropertyAccess node) {
if (node.propertyName.name != 'isDirectory') return;
final targetType = node.realTarget.staticType;
if (!_isFileSystemDeleteEventFromDartIo(targetType)) return;
reporter.atNode(node.propertyName);
});
context.addPrefixedIdentifier((PrefixedIdentifier node) {
if (node.identifier.name != 'isDirectory') return;
final targetType = node.prefix.staticType;
if (!_isFileSystemDeleteEventFromDartIo(targetType)) return;
reporter.atNode(node.identifier);
});
}