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

Problem with custom rule set provider #697

Closed
SumeraMartin opened this issue Aug 3, 2023 · 4 comments · Fixed by #698
Closed

Problem with custom rule set provider #697

SumeraMartin opened this issue Aug 3, 2023 · 4 comments · Fixed by #698
Assignees

Comments

@SumeraMartin
Copy link

Hi, I updated ktlint o version 0.50. and ktilint-gradle to 11.5.0

I the past I was using custom rule set which worked fine but then it suddenly stopped to work (not sure which version). I updated API to new ktlint API which is using RuleSetProviderV3 for example. When I run tests in this module then it works fine. But these rules are ignored when I try to run ktlintCheck task.

Not sure if it is related but I found that file KtLintInvocation50 is using only one specific ruleset but in previous versions of this file were custom providers loaded. Is it intentionally due some limitations or it is just bug? Do you think that it could be fixed somehow? Is there a way of how can I help with it? Thanks

@wakingrufus
Copy link
Collaborator

Yeah i think you are right. I need to wire up the ruleProviders to load using ServiceProvider like we used to do.
Ill also add a test to make sure that this feature is exercised for all ktlintVersions to ensure we dont miss this again.

@wakingrufus
Copy link
Collaborator

I have a potential fix, but I am still working out how to test this properly

wakingrufus added a commit that referenced this issue Aug 7, 2023
fixes #697 and #695

test custom rule loading in ktlin 0.50.0 by updating sample project

To Test: Edit Main.kt in the kotlin-rulesets-using projects according to inline comment, then
run ./gradlew samples:kotlin-rulesets-using:build
wakingrufus added a commit that referenced this issue Aug 7, 2023
fixes #697 and #695

test custom rule loading in ktlin 0.50.0 by updating sample project

To Test: Edit Main.kt in the kotlin-rulesets-using projects according to inline comment, then
run ./gradlew samples:kotlin-rulesets-using:build

update root kotlin version to 1.8 since ktlint requires this
update android plugin to 4.1.3
wakingrufus added a commit that referenced this issue Aug 7, 2023
fixes #697 and #695

test custom rule loading in ktlin 0.50.0 by updating sample project

To Test: Edit Main.kt in the kotlin-rulesets-using projects according to inline comment, then
run ./gradlew samples:kotlin-rulesets-using:build

update root kotlin version to 1.8 since ktlint requires this
update android plugin to 4.1.3
@wakingrufus
Copy link
Collaborator

This should be fixed in 11.5.1. Please try again

@SumeraMartin
Copy link
Author

It works, thank you very much ❤️

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 a pull request may close this issue.

2 participants