problems method
The problems of the package in the directory root, the current
directory by default, which is the package's own when dart test runs
its tests: one line for every package and every URI of a file that
breaks a rule.
Implementation
List<String> problems({
String root = '.',
FileSystem fileSystem = const LocalFileSystem(),
}) {
final directory = fileSystem.directory(root);
final pubspecFile = directory.childFile('pubspec.yaml');
final pubspec = pubspecFile.existsSync()
? loadYaml(pubspecFile.readAsStringSync())
: null;
if (pubspec is! YamlMap || pubspec['name'] != name) {
return ['The directory $root has no pubspec.yaml of $name.'];
}
Set<String> packagesOf(String section) => switch (pubspec[section]) {
final YamlMap packages => {...packages.keys.cast<String>()},
_ => const {},
};
final code = {'smf_contracts', ...dependencies};
final tests = {'smf_pipeline', ...testModules};
return [
..._dependencyProblems(code, packagesOf('dependencies')),
..._devDependencyProblems(tests, packagesOf('dev_dependencies')),
..._libProblems(directory, code),
..._testProblems(directory, tests),
];
}