run method

  1. @override
void run(
  1. CustomLintResolver resolver,
  2. ChangeReporter reporter,
  3. CustomLintContext context,
  4. AnalysisError analysisError,
  5. List<AnalysisError> errors,
)

Emits lints for a given file.

run will only be invoked with files respecting filesToAnalyze Emits source changes for a given error.

Optionally others can be specified with a list of similar errors within the same file. This can be used to provide an option for fixing multiple errors at once.

Implementation

@override
void run(
  CustomLintResolver resolver,
  ChangeReporter reporter,
  CustomLintContext context,
  error.AnalysisError analysisError,
  List<error.AnalysisError> errors,
) {
  reporter
      .createChangeBuilder(message: 'Replace with $widgetName', priority: 1)
      .addDartFileEdit(
        (builder) => builder.addSimpleReplacement(
          analysisError.sourceRange,
          widgetName,
        ),
      );
}