run method
void
run(
- CustomLintResolver resolver,
- ErrorReporter reporter,
- CustomLintContext context
Emits lints for a given file.
run will only be invoked with files respecting filesToAnalyze
Implementation
@override
void run(
CustomLintResolver resolver,
ErrorReporter reporter,
CustomLintContext context,
) {
context.registry.addInstanceCreationExpression((node) {
final type = node.staticType;
if (type == null) return;
final isFirebaseMatch = firebaseMatchChecker.isAssignableFromType(type);
final isDatabaseMatch = databaseMatchChecker.isAssignableFromType(type);
if (!isFirebaseMatch && !isDatabaseMatch) return;
final arguments = node.argumentList.arguments;
final path = resolveMatchPath(arguments: arguments);
if (path == null) return;
final wildcards =
RegExp(isFirebaseMatch ? r'{(\w+)}' : r'\$(\w+)').allMatches(path);
if (wildcards.length > 1) {
reporter.deprecatedReportErrorForNode(_code, arguments.first);
}
});
}