Skip to content
Permalink
Browse files

Fix: penalize outdated package constraints only for direct dependenci…

…es. (#540)
  • Loading branch information
isoos committed Jun 19, 2019
1 parent 1dfdeba commit 90da66e4e2b1e7b99ce530461be97fa2f1de1110
@@ -1,3 +1,7 @@
## 0.12.19

* Fix: penalize outdated package constraints only for direct dependencies.

## 0.12.18

* Penalize package constraints that does not support the latest published versions of their dependencies.
@@ -90,7 +90,7 @@ A package starts with `100` points, and the following detected issues have point
- `issue_tracker` is not helpful (e.g. pointing to `http://localhost/`) (-10 points)
- `issue_tracker` is insecure (not using `https`) (-5 points)
- `description` is too long (>180 characters) (-10 points)
- does not support the latest version of its dependencies (-10 points for direct, -5 for transitive)
- does not support the latest version of its direct dependencies (-10 points)
- package has no example file (-10 points)
- uses old `.analysis_options` file (-10 points)
- uses pre-v0.1 release versioning (`0.0.*`) (-10 points)
@@ -535,18 +535,17 @@ Future<Maintenance> detectMaintenance(
score: 20.0));
}

// Checking the dependencies that can't be used with their latest version.
final outdatedDeps = pkgResolution?.outdated ?? <PkgDependency>[];
if (outdatedDeps.isNotEmpty) {
final count = outdatedDeps.length;
// Checking the direct dependencies that can't be used with their latest version.
final outdatedPackages = pkgResolution?.outdated
?.where((pd) => pd.isDirect)
?.map((p) => p.package)
?.toList() ??
<PkgDependency>[];
if (outdatedPackages.isNotEmpty) {
final count = outdatedPackages.length;
final pluralized = count == 1 ? '1 dependency' : '$count dependencies';
final directPkgs =
outdatedDeps.where((pd) => pd.isDirect).map((p) => p.package).toList();
final nonDirectCount = count - directPkgs.length;
final penalty = directPkgs.length * 10.0 + nonDirectCount * 5.0;
final extraDescr = directPkgs.isEmpty
? ''
: ' (${directPkgs.length} direct: ${directPkgs.map((s) => '`$s`').join(', ')})';
final penalty = count * 10.0;
final extraDescr = ' (${outdatedPackages.map((s) => '`$s`').join(', ')})';
maintenanceSuggestions.add(Suggestion.warning(
SuggestionCode.pubspecDependenciesOutdated,
'Support latest dependencies.',

Some generated files are not rendered by default. Learn more.

@@ -1,6 +1,6 @@
name: pana
description: Evaluate the health and quality of a Dart package
version: 0.12.18
version: 0.12.19-dev
homepage: https://github.com/dart-lang/pana
author: Dart Team <misc@dartlang.org>

@@ -113,8 +113,8 @@
"code": "pubspec.dependencies.outdated",
"level": "warning",
"title": "Support latest dependencies.",
"description": "The version constraint in `pubspec.yaml` does not support the latest published versions for 12 dependencies (5 direct: `angular`, `angular_forms`, `build_config`, `protobuf`, `quiver`).",
"score": 85.0
"description": "The version constraint in `pubspec.yaml` does not support the latest published versions for 5 dependencies (`angular`, `angular_forms`, `build_config`, `protobuf`, `quiver`).",
"score": 50.0
},
{
"code": "pubspec.documentation.isNotHelpful",
@@ -504,7 +504,7 @@
"package": "yaml",
"dependencyType": "transitive",
"constraintType": "inherited",
"resolved": "2.1.15"
"resolved": "2.1.16"
}
]
},
@@ -125,8 +125,8 @@
"code": "pubspec.dependencies.outdated",
"level": "warning",
"title": "Support latest dependencies.",
"description": "The version constraint in `pubspec.yaml` does not support the latest published versions for 5 dependencies (2 direct: `analyzer`, `html`).",
"score": 35.0
"description": "The version constraint in `pubspec.yaml` does not support the latest published versions for 2 dependencies (`analyzer`, `html`).",
"score": 20.0
},
{
"code": "pubspec.description.tooShort",
@@ -425,7 +425,7 @@
"dependencyType": "direct",
"constraintType": "normal",
"constraint": "^2.1.0",
"resolved": "2.1.15"
"resolved": "2.1.16"
}
]
},
@@ -217,7 +217,7 @@
"dependencyType": "direct",
"constraintType": "normal",
"constraint": "^2.1.2",
"resolved": "2.1.15"
"resolved": "2.1.16"
}
]
},

0 comments on commit 90da66e

Please sign in to comment.
You can’t perform that action at this time.