Skip to content
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

Make kibit configurable via .kibit/config.edn #236

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ertugrulcetin
Copy link

@ertugrulcetin ertugrulcetin commented Apr 20, 2020

@danielcompton I created this fork myself, hope that helps others too.

@marksto
Copy link
Contributor

marksto commented Sep 13, 2021

It also bothers me, that an initial intention (per the project README) was to have these features configurable via project.clj.

TODO
- Leiningen project.clj setting for rule exclusion
- Leiningen project.clj setting for a directory of rules to include

This is necessary for running kibit with exclusions/custom rules in a CI server environment.

@@ -41,17 +42,60 @@
(sort-by #(.getAbsolutePath ^File %)
(filter clojure-file? (file-seq dir))))

(declare read-edn-file)

(defn- opts [^java.io.File cfg-file]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to know what this fn is necessary for. Could you, please, add a docstring?

(recur parent)))))))

(defn- get-config-map []
(let [cfg-dir (config-dir (io/file (System/getProperty "user.dir")))]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicates line 65. Just call (config-dir) here?

(eval rule#) ;; raw rule, no need to compile
(compile-rule rule#)))]
{:form rule#
:compiled (if (raw-rule? rule#)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It makes perfect sense to extract this (if (raw-rule? ...) ...) into a dedicated fn + reuse it in check.clj.

@marksto
Copy link
Contributor

marksto commented Sep 13, 2021

@danielcompton any thoughts on improving this any further?

@port19x
Copy link
Contributor

port19x commented Apr 18, 2023

Reading a separate file for configuration instead of extending command line args seems like a bad idea

@NoahTheDuke
Copy link
Collaborator

The way most cli tools work is having a set of locations they look for the configuration and an order of applying them so that the "latest" wins out. clj-kondo, for example, does it this way: it merges left to right $HOME, the current project, command-line args, and then the config metadata in the current namespace.

I think doing something similar would be fine. Should probably wait until we've named the rules, however.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants