getLintAnalysisConfig static method

LintAnalysisConfig getLintAnalysisConfig(
  1. LintConfig config,
  2. String rootFolder, {
  3. Iterable<Metric<num>>? classMetrics,
  4. Iterable<Metric<num>>? fileMetrics,
  5. Iterable<Metric<num>>? functionMetrics,
})

Creates a lint config from given raw config.

Implementation

static LintAnalysisConfig getLintAnalysisConfig(
  LintConfig config,
  String rootFolder, {
  Iterable<Metric>? classMetrics,
  Iterable<Metric>? fileMetrics,
  Iterable<Metric>? functionMetrics,
}) {
  final patterns = getPatternsById(config);
  final patternsDependencies = patterns
      .map((pattern) => pattern.dependentMetricIds)
      .expand((e) => e)
      .toSet();

  return LintAnalysisConfig(
    createAbsolutePatterns(config.excludePatterns, rootFolder),
    getRulesById(config.rules),
    createAbsolutePatterns(config.excludeForRulesPatterns, rootFolder),
    patterns,
    classMetrics ??
        getMetrics(
          config: config.metrics,
          patternsDependencies: patternsDependencies,
          measuredType: EntityType.classEntity,
        ),
    fileMetrics ??
        getMetrics(
          config: config.metrics,
          patternsDependencies: patternsDependencies,
          measuredType: EntityType.fileEntity,
        ),
    functionMetrics ??
        getMetrics(
          config: config.metrics,
          patternsDependencies: patternsDependencies,
          measuredType: EntityType.methodEntity,
        ),
    createAbsolutePatterns(config.excludeForMetricsPatterns, rootFolder),
    config.metrics,
    rootFolder,
    config.analysisOptionsPath,
  );
}