-
Notifications
You must be signed in to change notification settings - Fork 50
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
[#250 clone] Run ktlint
in process isolation + allow overriding ktlint
version
#279
Conversation
9584ae9
to
2fd861d
Compare
Potential blocker: gradle/gradle#21964 |
Hey @mateuszkwiecinski! Looking forward to this PR! I'm wondering if you have considered just manually loading the custom rules using something like:
Where |
2fd861d
to
fe8c721
Compare
@Karn Thanks for sharing the idea💡 |
fe8c721
to
3ebc2a7
Compare
ktlint
in process isolation + allow overriding ktlint
version
869e1c7
to
4eb8585
Compare
@@ -157,6 +157,7 @@ kotlinter { | |||
reporters = arrayOf("checkstyle", "plain") | |||
experimentalRules = false | |||
disabledRules = emptyArray() | |||
ktlintVersion = "x.y.z" |
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 wasn't sure how to reflect the ktlint
version can be overriden. the text block above mentions these are the defaults, and the default value is the current ktlint version (the one kotlinter is compiled with, to be more precise)
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.
As an alternative, I can propose having some sort of hardcoded value that will be mapped into "our" ktlint version, i.e.
ktlintVersion = "x.y.z" | |
ktlintVersion = "default" // or `latest` or `current`? but that might be too confusing |
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 usually show the default value if you don't configure anything.
Which I suppose also causes a little confusion because people explicitly configure it not realizing that's what they get by default.
src/main/kotlin/org/jmailen/gradle/kotlinter/support/RuleSets.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/org/jmailen/gradle/kotlinter/support/RuleSets.kt
Outdated
Show resolved
Hide resolved
build("lintKotlin", "--info").apply { | ||
assertEquals(SUCCESS, task(":lintKotlin")?.outcome) | ||
assertTrue(output.contains("Resolved 45 RuleSetProviders")) | ||
} | ||
|
||
build("formatKotlin", "--info").apply { | ||
assertEquals(SUCCESS, task(":formatKotlin")?.outcome) | ||
assertTrue(output.contains("Resolved 45 RuleSetProviders")) | ||
} |
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 is not ideal tests, and will likely fail when upgrading ktlint version, but I was out of ideas and decided to defer writing better assertion to somewhen later 😬
What I want to test here is to somehow replace the old test relying on test classpath, with something that covers the dynamic loading part.
4eb8585
to
203414b
Compare
203414b
to
9c8f09d
Compare
Friendly reminder - it would be great to have the functionality for custom rules. Thank you. |
9c8f09d
to
dd2b917
Compare
dd2b917
to
1036d33
Compare
…encies. Add tests covering new features
6b229e8
to
ff27fdf
Compare
Thanks, this example was very helpful. The feature has been incorporated in 5.0.0. Cheers |
Clone of #250 with my suggested improvements/changes
ktlint
versionktlint
dependency anymore to its consumer (it's defined ascompileOnly
now)ktlint
APIs, but also resolves rules from thektlint
version provided via plugin extensionFixes #280
Fixes #34