fromDependency static method
Generate lints for a dependency
Implementation
static List<GdpLint> fromDependency(GitDependencyReference dependency) {
final lints = <GdpLint>[];
final ignorePlacement = dependency.ignore.contains(GdpLint.placement);
final correctPlacement = dependency.location == 'dependency_overrides';
if (!ignorePlacement && !correctPlacement) {
lints.add(GdpLint.placement);
}
final ignoreSpecifyPrs = dependency.ignore.contains(GdpLint.specifyPrs);
final hasPrs = dependency.prs.isNotEmpty;
if (!ignoreSpecifyPrs && !hasPrs) {
lints.add(GdpLint.specifyPrs);
}
final ignoreSpecifyHash = dependency.ignore.contains(GdpLint.specifyHash);
final hasHash = _commitHashRegex.hasMatch(dependency.ref ?? '');
if (!ignoreSpecifyHash && !hasHash) {
lints.add(GdpLint.specifyHash);
}
return lints;
}