weavejester / cljfmt

A tool for formatting Clojure code
Eclipse Public License 1.0
1.11k stars 120 forks source link

Do you want the `project.clj` file to be included by default for lein projects? #279

Open jacobemcken opened 1 year ago

jacobemcken commented 1 year ago

I am seeing this: https://github.com/weavejester/cljfmt/blob/1003c677200e90bc19f7c8d83ea58bd17b900a5e/cljfmt/src/cljfmt/main.clj#L169

But the project.clj file is ignored when running lein cljfmt check (empty configuration), unless I specifically specify it (lein cljfmt check project.clj).

I've narrowed it down to (seq paths) never being empty when the paths come from the Leiningen plugin: https://github.com/weavejester/cljfmt/blob/1003c677200e90bc19f7c8d83ea58bd17b900a5e/cljfmt/src/cljfmt/main.clj#L216

Do you want a PR changing lein-cljfmt to always include the project.clj file?

I was thinking that it could look something like (changing lein-cljfmt/src/leiningen/cljfmt.clj):

-           (filter #(and (.exists %) (.isDirectory %)))))))
+           (filter #(and (.exists %) (.isDirectory %)))
+           (concat '("project.clj"))))))

It seems to be a good fit since the project file is lein specific anyway.

weavejester commented 1 year ago

This seems a reasonable change.