findInconsistentDependencySpecs function

List<DependencyUsageReport<PackageDependencySpec>> findInconsistentDependencySpecs(
  1. Map<String, PubspecYaml> pubspecYamls
)

Finds inconsistent set of external dependency specifications in the provided set of pubspec.yaml content and generates report on inconsistent references. As analysis focuses on consistency of external dependencies, consistency of path dependencies is ignored. However, if a dependency is specified by a mix of path and other dependency types in different pubspec.yaml files, this case is reported as inconsistency.

Implementation

List<DependencyUsageReport<PackageDependencySpec>>
    findInconsistentDependencySpecs(Map<String, PubspecYaml> pubspecYamls) {
  final specsPerPubspecYaml = _collectAllDepSpecsPerPubspecYaml(pubspecYamls);

  final allSpecs = _collectAllDepSpecs(specsPerPubspecYaml);
  final externalSpecs = _filterOutPathOnlySpecs(allSpecs).toSet();
  final specsWithRelevantHostedSpecs =
      _filterOutRedundantHostedSpecs(externalSpecs).toSet();
  final inconsistentSpecs =
      _filterOutSingularReferences(specsWithRelevantHostedSpecs).toSet();
  return _createReport(inconsistentSpecs, specsPerPubspecYaml);
}