You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "ppalaga (via GitHub)" <gi...@apache.org> on 2023/08/10 10:03:18 UTC

[GitHub] [camel-quarkus] ppalaga commented on a diff in pull request #5166: Fix compareVersion in sanity-checks.groovy #5165

ppalaga commented on code in PR #5166:
URL: https://github.com/apache/camel-quarkus/pull/5166#discussion_r1289882075


##########
tooling/scripts/sanity-checks.groovy:
##########
@@ -68,10 +68,11 @@ int compareVersion(String a, String b) {
     List verB = b.tokenize('.')
 
     def commonIndices = Math.min(verA.size(), verB.size())
+    def versionRegex = ~/\-.*/
 
     for (int i = 0; i < commonIndices; ++i) {
        def numA = verA[i].toInteger()
-       def numB = verB[i].toInteger()
+       def numB = (verB[i] - versionRegex).toInteger()

Review Comment:
   I am bit lost what is this doing. The minus operator removes the matching part from the string, right?
   I this way we are effectively disregard the `-RC` qualifiers, right? 
   That's definitely OK for this current versions check, but I wonder whether it would not be safer for future copy-and-paste visitors, to move the suffix stripping before the compareVersion() method. After all we strip `-SNAPSHOT` from project.version before passing it to compareVersion() too. 



-- 
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: commits-unsubscribe@camel.apache.org

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