rules_kotlin icon indicating copy to clipboard operation
rules_kotlin copied to clipboard

`ktlint_test` should support custom rulesets

Open jfmyers9 opened this issue 3 years ago • 3 comments

The ktlint tool supports loading and executing custom rulesets through the use of the -R flag. See documentation.

It would be helpful if the ktlint_test rule could provide an interface for providing these ruleset jars so that we could extend ktlint to run arbitrary linting rules.

An example interface might be:

ktlint_test(
  name = "lint",
  srcs = glob(["*.kt"]),
  additional_rulesets = [
    :custom_rulset,
  ],
)

Thoughts? Would this be something that you all would be open to contributions for?

jfmyers9 avatar Dec 15 '21 15:12 jfmyers9

Thoughts here @cgruber ?

nikunjy avatar Jan 10 '22 20:01 nikunjy

It seems reasonable, assuming you can't virtually get this by updating the editor config. I haven't used ktlint custom stuff much, so I don't rightly know. I'm assumign that even if you could reference rulesets in the config, the classpath would need to be modified, so something like this would be needed.

cgruber avatar Jan 11 '22 23:01 cgruber

Is there any chance you could extend it @cgruber

nikunjy avatar Dec 09 '22 17:12 nikunjy