kibit icon indicating copy to clipboard operation
kibit copied to clipboard

Allow disabling certain rules

Open MatthewDarling opened this issue 9 years ago • 7 comments
trafficstars

One of Kibit's current rules is, "replace (filter seq coll) with (remove empty? coll)". Some of the people on my team prefer (filter seq coll), so I'd like to disable that one rule, while using the rest of Kibit as usual.

From looking at the code, it seems like there isn't a simple way to specify one individual rule for removal. I guess the user could provide literals for what rules to remove... Alternatively, they could be named and then have the removals operate on those names.

MatthewDarling avatar Jan 04 '16 18:01 MatthewDarling

#139 kind of paves the way for this. I've been thinking about how best to allow people to do just what you're asking, #2 is another long standing issue that would be addressed with this.

danielcompton avatar Jan 04 '16 23:01 danielcompton

Actually, I went and looked at rules.clj and it looks like we could get what we want by just copying the existing defrules and removing some. And then just use the new defrules as a custom rule set, and rely on merge to overwrite the old ones.

So it's possible, which is good for me to know! It's just not granular enough right now to swap out a small number of rules.

MatthewDarling avatar Jan 05 '16 16:01 MatthewDarling

Yeah, there really needs to be identifiers for every rule (or collection of rules) which would let people specify rules to include/ignore. A PR on this would be amazing if you're inclined :)

danielcompton avatar Jan 10 '16 20:01 danielcompton

I am also interested in seeing this, for the same reasons that @lvh stated in RackSec/desdemona#16. In fact usage of the threading macro is almost the only thing kibit complains about on our code-base.

ghost avatar Mar 24 '17 10:03 ghost

Any hope for this anytime soon?

didibus avatar Jul 07 '18 00:07 didibus

@danielcompton Any groundwork on this or would you take a PR?

acron0 avatar Feb 18 '20 09:02 acron0

Hi @danielcompton!

There are already 4 incoming PRs for this repo providing this feature (and adding custom rules, see #66):

  • #139 (+ #141 w/ docs update) — custom rules-only
  • #159 — exclusions-only
  • #236 — both

And there is, as well, an unfinished attempt to have a fine-grained ruleset (as a map with IDs and descriptions) in the #176.

While the last one is unfinished (and for a good reason, since it's a huge effort requiring a solid Clojure and kibit background), other three are quite straightforward and (almost) equally ready to be approved and merged.

It would be great if any collaborator of this project will finally approve at least one of these PRs. Then the community will stop providing the same stuff over and over again and can focus on improving what's there.

Cheers, Mark

marksto avatar Sep 13 '21 16:09 marksto