bazelbuild / rules_kotlin

Bazel rules for Kotlin
Apache License 2.0
331 stars 206 forks source link

`ktlint_test` should support custom rulesets #647

Open jfmyers9 opened 2 years ago

jfmyers9 commented 2 years ago

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?

nikunjy commented 2 years ago

Thoughts here @cgruber ?

cgruber commented 2 years ago

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.

nikunjy commented 1 year ago

Is there any chance you could extend it @cgruber