eric-maynard commented on code in PR #1170:
URL: https://github.com/apache/polaris/pull/1170#discussion_r2002440025
##########
build-logic/src/main/kotlin/polaris-java.gradle.kts:
##########
@@ -160,6 +160,45 @@ tasks.withType(Jar::class).configureEach {
}
}
+class StaleBehaviorChangeConfigurationChecker(private val appVersion: String)
: FormatterFunc {
+
+ // Helper function for spotless to check for stale
BehaviorChangeConfigurations
+ fun isStaleVersion(
+ annotatedVersion: String,
+ expiresVersion: String?,
+ polarisVersion: String,
+ ): Boolean {
+ val (majorA, minorA, patchA) = annotatedVersion.split(".").map {
it.toInt() }
+ if (expiresVersion == null) {
+ val (majorB, minorB, _) = polarisVersion.split(".").map { it.toInt() }
+ return (majorB > majorA || (majorB == majorA && minorB > minorA + 1))
+ } else {
+ val (majorB, minorB, patchB) = expiresVersion.split(".").map {
it.toInt() }
+ return (majorA > majorB ||
+ (majorA == majorB && minorA > minorB) ||
+ (majorA == majorB && minorA == minorB && patchB > patchA))
+ }
+ }
+
+ override fun apply(input: String): String {
+ val versionRegex =
+
"""@BehaviorChangeScope\s*\(\s*since\s*=\s*"(\d+\.\d+\.\d+)"(?:\s*,\s*expires\s*=\s*"(\d+\.\d+\.\d+)")?\s*\)"""
Review Comment:
It more or less should work because of all the `\s*` -- but agreed that a
lint check is relatively brittle here. We can always add another check later
though
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]