You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "kwin (via GitHub)" <gi...@apache.org> on 2023/03/26 09:16:08 UTC

[GitHub] [maven-enforcer] kwin commented on a diff in pull request #262: [MENFORCER-467] banDynamicVersions excludedScopes on project level

kwin commented on code in PR #262:
URL: https://github.com/apache/maven-enforcer/pull/262#discussion_r1148512607


##########
enforcer-rules/src/main/java/org/apache/maven/enforcer/rules/dependency/BanDynamicVersions.java:
##########
@@ -256,10 +231,8 @@ public boolean test(DependencyNode depNode) {
         }
     }
 
-    private int emitDependenciesWithBannedDynamicVersions(
-            Dependency rootDependency, RepositorySystemSession repoSession) throws DependencyCollectionException {
-        CollectRequest collectRequest = new CollectRequest(rootDependency, project.getRemoteProjectRepositories());
-        CollectResult collectResult = repoSystem.collectDependencies(repoSession, collectRequest);
+    private List<String> emitDependenciesWithBannedDynamicVersions(DependencyNode rootDependency)

Review Comment:
   ```suggestion
       private List<String> collectDependenciesWithBannedDynamicVersions(DependencyNode rootDependency)
   ```



##########
enforcer-rules/src/main/java/org/apache/maven/enforcer/rules/dependency/ResolverUtil.java:
##########
@@ -96,6 +96,19 @@ DependencyNode resolveTransitiveDependencies() throws EnforcerRuleException {
         return resolveTransitiveDependencies(false, true, Arrays.asList(SCOPE_TEST, SCOPE_PROVIDED));
     }
 
+    /**
+     * Retrieves the {@link DependencyNode} instance containing the result of the transitive dependency
+     * for the current {@link MavenProject}.
+     *
+     * @param excludedScopes a project dependency scope to excluded

Review Comment:
   ```suggestion
        * @param excludedScopes the scopes of direct dependencies to ignore
   ```



##########
enforcer-rules/src/main/java/org/apache/maven/enforcer/rules/dependency/BanDynamicVersions.java:
##########
@@ -138,19 +124,19 @@ private final class BannedDynamicVersionCollector implements DependencyVisitor {
 
         private boolean isRoot = true;
 
-        private int numViolations;
+        private List<String> violations;
 
         private final Predicate<DependencyNode> predicate;
 
-        public int getNumViolations() {
-            return numViolations;
+        public List<String> getNumViolations() {

Review Comment:
   ```suggestion
           public List<String> getViolations() {
   ```



##########
enforcer-rules/src/main/java/org/apache/maven/enforcer/rules/dependency/ResolverUtil.java:
##########
@@ -96,6 +96,19 @@ DependencyNode resolveTransitiveDependencies() throws EnforcerRuleException {
         return resolveTransitiveDependencies(false, true, Arrays.asList(SCOPE_TEST, SCOPE_PROVIDED));
     }
 
+    /**
+     * Retrieves the {@link DependencyNode} instance containing the result of the transitive dependency
+     * for the current {@link MavenProject}.
+     *
+     * @param excludedScopes a project dependency scope to excluded
+     * @return a Dependency Node which is the root of the project's dependency tree
+     * @throws EnforcerRuleException thrown if the lookup fails
+     */
+    DependencyNode resolveTransitiveDependencies(boolean excludeOptional, List<String> excludedScopes)

Review Comment:
   the javadoc for `excludeOptional` is missing



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org