-
Notifications
You must be signed in to change notification settings - Fork 503
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
Custom gradle tasks with custom ruleset results in warning #1269
Comments
This is indeed new functionality. Tnx for your analysis. It sounds like a plausible cause.
As you already noted yourself: the warning does not affect the execution of the rule. |
Check JAR files one by one whether a custom rule set has been provided and print warning when it is missing. Closes pinterest#1269
Oh, we also faced it. But looks like it does not affect anything, just a warning |
Running ktlint in gradle with a custom task (ie no plugin) AND a custom rule set results in the following warning:
[WARNING] Number of custom rule sets loaded does not match the expected number of rule sets to be loaded.
Expected to load 0 custom rule set(s) for rules:
Actually loaded 1 custom rule set(s) with names: XXXX
One or more of the specified jars does not provide the custom rule set correctly. Check following:
- Does the jar contain an implementation of the RuleSetProvider interface?
- Does the jar contain a resource file with name "com.pinterest.ktlint.core.RuleSetProvider"?
- Is the resource file located in directory "src/main/resources/META-INF/services"?
- Does the resource file contain the fully qualified class name of the class implementing the RuleSetProvider interface?
Expected Behavior
Loading custom rule sets should NOT result in a warning unless the custom rules failed to meet the other rules.
Observed Behavior
Custom rules are loaded and executed, just an invalid warning is being displayed.
Steps to Reproduce
Load custom rule set using:
Your Environment
Additional Notes
This did not occur in 0.42.1 or earlier versions. Looking through the new RuleSetLoader, it appears the bug is being caused because the expected number of custom rulesets is being counted from the number of
--ruleset
parameters but the custom gradle tasks provides them via the classpath so the actual vs expected count doesn't get calculated correctly.The text was updated successfully, but these errors were encountered: