prepareLintAnalysis method

(LintAnalysisConfig, Set<String>, LintFileReport?) prepareLintAnalysis(
  1. AnalysisContext context,
  2. Iterable<String> folders,
  3. String rootFolder,
  4. LintConfig config,
  5. AnalysisContextCollection collection,
)

Implementation

(
  LintAnalysisConfig lintAnalysisConfig,
  Set<String> analyzedFiles,
  LintFileReport? report,
) prepareLintAnalysis(
  AnalysisContext context,
  Iterable<String> folders,
  String rootFolder,
  LintConfig config,
  AnalysisContextCollection collection,
) {
  final lintAnalysisConfig = _getAnalysisConfig(context, rootFolder, config);
  final report = LintAnalysisOptionsValidator.validateOptions(
    lintAnalysisConfig,
    rootFolder,
  );

  if (config.shouldPrintConfig) {
    _logger?.printConfig(lintAnalysisConfig.toJson());
  }

  final filePaths = getFilePaths(
    folders,
    context,
    rootFolder,
    lintAnalysisConfig.globalExcludes,
  );
  final analyzedFiles =
      filePaths.intersection(context.contextRoot.analyzedFiles().toSet());

  final contextsLength = collection.contexts.length;
  final filesLength = analyzedFiles.length;
  final updateMessage = contextsLength == 1
      ? 'Processing $filesLength file(s)'
      : 'Processing ${collection.contexts.indexOf(context) + 1}/$contextsLength contexts with $filesLength file(s)';
  _logger?.progress.update(updateMessage);

  return (lintAnalysisConfig, analyzedFiles, report);
}