-
Notifications
You must be signed in to change notification settings - Fork 54
feat: minor version strategy rules #1687
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like that every project now needs to define a ktlint-rules module. Can we move the rule registration to aws-kotlin-repo-tools? We already have a reference to the Gradle Project
there and should be able to get the sdkVersion
and anything else you need
* Ruleset provider for AWS SDK Kotlin minor-version-bump-specific Ktlint rules. | ||
*/ | ||
class MinorVersionStrategyRuleSetProvider : RuleSetProviderV3(RuleSetId("minor-version-strategy-rules")) { | ||
private val sdkVersion = System.getProperty("sdkVersion").split(".") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correctness: this looks at JVM system properties, not Gradle properties right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, I don't think we can access gradle.properties
at runtime unless we explicitly read the file. We're setting the Gradle property as a system property here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I missed that, I'm not a fan of that approach but I'm not sure there's anything better
We can't move it to repo tools because the rule would need to be published and then consumed downstream i.e. the minor and major version would be hardcoded. We can access the minor and major version using the |
build.gradle.kts
Outdated
configureMinorVersionStrategyRules(lintPaths) | ||
|
||
// Set SDK version from gradle.properties as a system property for 'configureMinorVersionStrategyRules' to use | ||
tasks.withType<JavaExec> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can be refined to only a single task using tasks.named("...")
* Ruleset provider for AWS SDK Kotlin minor-version-bump-specific Ktlint rules. | ||
*/ | ||
class MinorVersionStrategyRuleSetProvider : RuleSetProviderV3(RuleSetId("minor-version-strategy-rules")) { | ||
private val sdkVersion = System.getProperty("sdkVersion").split(".") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I missed that, I'm not a fan of that approach but I'm not sure there's anything better
A new generated diff is ready to view.
|
A new generated diff is ready to view.
|
A new generated diff is ready to view.
|
A new generated diff is ready to view.
|
A new generated diff is ready to view. |
Issue #
N/A
Description of changes
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.