-
Notifications
You must be signed in to change notification settings - Fork 512
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 creating rulesets #300
Comments
Hi. src/main/resource/META-INF.services should be src/main/resource/META-INF/services. Take a look at https://stackoverflow.com/questions/51368558/ktlint-custom-reporter/51391651#51391651. Let me know if that doesn't help. |
My folder structure looks like that, src/main/resource/META-INF/services. Sorry for the confusion, the folder structure is exactly like ktlint/ktlint-ruleset-template. Could you give an example jar file that actually works? Maybe I could figure the problem out then. Thanks again |
@chaneylc try the following
|
Thanks! I should have looked into gradle before trying to make my own jar. From the main readme I would suggest you change "Once packaged in a JAR you can load it with" with the above snippet you shared. |
No worries! I'll keep this ticket open until README is updated if you don't mind. 🥂 |
Awesome! Thanks again for your hard work on this project, it's great! |
Could you expand on how to create your own rulesets? I looked into ServiceLoader javadocs and have the following understanding:
You should have a directory structure similar to:
(taken from the ktlint-ruleset-template)
From the project directory you should be able to run:
jar cf ruleset.jar Project/
And then this can be used by ktlint as:
ktlint -R ruleset.jar ....
Although my rule is never reached! Could you please give more details on how exactly this jar should be created?
Here is what my resources look like:
//resources/META-INF.services
//com.github.shyiko.ktlint.core.RuleSetProvider
mypackage.CustomRuleSetProvider
Here is my CustomRuleSetProvider
//CustomRuleSetProvider
Here is my Rule, which naively prints a test message on each visit.
//TestVisit
The text was updated successfully, but these errors were encountered: