You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by el...@apache.org on 2025/06/30 10:14:44 UTC

(maven-enforcer) 01/01: More conventional variable names

This is an automated email from the ASF dual-hosted git repository.

elharo pushed a commit to branch the
in repository https://gitbox.apache.org/repos/asf/maven-enforcer.git

commit 1c73f4e6c432916238d12008168efdd0548e1a54
Author: Elliotte Rusty Harold <el...@ibiblio.org>
AuthorDate: Mon Jun 30 06:14:03 2025 -0400

    More conventional variable names
---
 .../rules/version/AbstractVersionEnforcer.java     | 25 +++++++++++-----------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/enforcer-rules/src/main/java/org/apache/maven/enforcer/rules/version/AbstractVersionEnforcer.java b/enforcer-rules/src/main/java/org/apache/maven/enforcer/rules/version/AbstractVersionEnforcer.java
index 80ffbb4..5413787 100644
--- a/enforcer-rules/src/main/java/org/apache/maven/enforcer/rules/version/AbstractVersionEnforcer.java
+++ b/enforcer-rules/src/main/java/org/apache/maven/enforcer/rules/version/AbstractVersionEnforcer.java
@@ -65,7 +65,6 @@ abstract class AbstractVersionEnforcer extends AbstractStandardEnforcerRule {
             throw new EnforcerRuleException(variableName + " version can't be empty.");
         } else {
 
-            VersionRange vr;
             String msg = "Detected " + variableName + " Version: " + actualVersion;
 
             // short circuit check if the strings are exactly equal
@@ -73,15 +72,15 @@ abstract class AbstractVersionEnforcer extends AbstractStandardEnforcerRule {
                 getLog().debug(msg + " is allowed in the range " + requiredVersionRange + ".");
             } else {
                 try {
-                    vr = VersionRange.createFromVersionSpec(requiredVersionRange);
+                    VersionRange versionRange = VersionRange.createFromVersionSpec(requiredVersionRange);
 
-                    if (containsVersion(vr, actualVersion)) {
-                        getLog().debug(msg + " is allowed in the range " + toString(vr) + ".");
+                    if (containsVersion(versionRange, actualVersion)) {
+                        getLog().debug(msg + " is allowed in the range " + toString(versionRange) + ".");
                     } else {
                         String message = getMessage();
 
                         if (message == null || message.isEmpty()) {
-                            message = msg + " is not in the allowed range " + toString(vr) + ".";
+                            message = msg + " is not in the allowed range " + toString(versionRange) + ".";
                         }
 
                         throw new EnforcerRuleException(message);
@@ -94,19 +93,19 @@ abstract class AbstractVersionEnforcer extends AbstractStandardEnforcerRule {
         }
     }
 
-    protected static String toString(VersionRange vr) {
+    protected static String toString(VersionRange versionRange) {
         // as recommended version is used as lower bound in this context modify the string representation
-        if (vr.getRecommendedVersion() != null) {
-            return "[" + vr.getRecommendedVersion().toString() + ",)";
+        if (versionRange.getRecommendedVersion() != null) {
+            return "[" + versionRange.getRecommendedVersion().toString() + ",)";
         } else {
-            return vr.toString();
+            return versionRange.toString();
         }
     }
 
     @Override
     public String getCacheId() {
         if (version != null && !version.isEmpty()) {
-            // return the hashcodes of the parameter that matters
+            // return the hash codes of the parameter that matters
             return "" + version.hashCode();
         } else {
             return "0";
@@ -132,9 +131,9 @@ abstract class AbstractVersionEnforcer extends AbstractStandardEnforcerRule {
      * <li><code>(,2.0.5],[2.1.1,)</code> Versions up to 2.0.5 (included) and 2.1.1 or higher</li>
      * </ul>
      *
-     * @param theVersion the required version to set
+     * @param version the required version to set
      */
-    public void setVersion(String theVersion) {
-        this.version = theVersion;
+    public void setVersion(String version) {
+        this.version = version;
     }
 }