Skip to content
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

Support custom rulesets and reporters on Java 9+ #573

Conversation

jacquerie
Copy link

Closes #259
Supersedes and closes #495

Abandons completely the approach of #351 in favor of a simpler idea proposed by @Tapchicoma.

Tested by first building the ktlint-ruleset-template.jar and then running

$ ./gradlew ktlint --args="--ruleset ~/Code/ktlint/ktlint-ruleset-template/build/libs/ktlint-ruleset-template.jar ~/Code/ktlint/ktlint/src/**/*.kt"

@Tapchicoma
Copy link
Collaborator

I see following warning, when running on OpenJDK 11.0.4:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.pinterest.ktlint.KtlintCommandLine (file:/command/ktlint/build/run/ktlint) to method java.net.URLClassLoader.addURL(java.net.URL)
WARNING: Please consider reporting this to the maintainers of com.pinterest.ktlint.KtlintCommandLine
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

Another thing, I've noticed, is with this approach custom ruleset violations are not failing the build 😞

@Tapchicoma
Copy link
Collaborator

I think, I found a solution. Will open a PR soon.

@shashachu
Copy link
Contributor

sorry for the delay- i just merged in @Tapchicoma 's PR - will this unblock you?

@jacquerie jacquerie closed this Sep 17, 2019
@jacquerie
Copy link
Author

sorry for the delay- i just merged in @Tapchicoma 's PR - will this unblock you?

Great, thanks! Well, the last step would be to get a 0.35.0 release containing this fix... but I guess I just need to wait for it to happen.

@shashachu
Copy link
Contributor

sorry for the delay- i just merged in @Tapchicoma 's PR - will this unblock you?

Great, thanks! Well, the last step would be to get a 0.35.0 release containing this fix... but I guess I just need to wait for it to happen.

If you like, you should be able to use a snapshot version of ktlint (see the README) to verify that it works until we release 0.35.0. There are a couple bugs I'd like to squash before our next release.

@jacquerie
Copy link
Author

jacquerie commented Sep 19, 2019

If you like, you should be able to use a snapshot version of ktlint (see the README) to verify that it works until we release 0.35.0.

I'd love to, but we use ktlint through ktlint-gradle, so I ran into the issue that this PR will fix: JLLeitschuh/ktlint-gradle#281. So I'll still have to wait, either for a new version of ktlint or a new version of ktlint-gradle !

@jacquerie jacquerie deleted the support-custom-rulesets-and-reporters-on-java-9+ branch September 23, 2019 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

--reporter/--ruleset Java 9+ compatibility
3 participants