clojure-style-guide
clojure-style-guide copied to clipboard
A community coding style guide for the Clojure programming language
Please chime on this discussion: https://github.com/borkdude/clj-kondo/issues/241 After processing the feedback, we can extract a style guide "rule" from this.
Looking [here](https://github.com/bbatsov/clojure-style-guide#private) it is suggested that ``` ;; good (defn- private-fun [] ...) (defn ^:private private-fun [] ...) ; overly verbose ``` However reading up on this Google group [discussion](https://groups.google.com/forum/#!msg/clojure/zaWlDbOhKCM/sD_iOM_k9WcJ)...
From the doc ==> ```;; good (clojure.string/upper-case "bruce") ;; bad (.toUpperCase "bruce") ``` But looking at clojure.string/upper-case ``` user=> (source clojure.string/upper-case) (defn ^String upper-case "Converts string to all upper-case." {:added...
This [commit](https://github.com/bbatsov/clojure-style-guide/commit/e813f24a5f3729cc7ed72d2b6ac4c75d02140582) adds a section about sorting namespaces. Clj-kondo want to check this, but currently there is no clarity around how "requirements" (which I find a bit of a weird...
Two styles I have seen: ``` (try (f) (catch E e (g)) ``` ``` (try (f) (catch E e (g)) ```
# Follow Idiomatic `require` aliases The most common way to require string is: `[clojure.string :as str]`. This may appear to mask clojure.core.str, but it doesn't. It's expected that `clojure.core/str` and...
```clojure ;; good (catch NoSuchFieldError ... ;; bad - java.lang not necessary (catch java.lang.NoSuchFieldError ... ```
Can we include this advice in the style guide? https://stuartsierra.com/2015/06/01/clojure-donts-optional-arguments-with-varargs
To start with, I take it for granted that this clojure-style-guide is used by organizations that write clojurescript, if I'm wrong please close or there's another clojurescript style-guide out there...
I would like to propose the following guideline: Prefer keyword arguments on multi arity when a function allows 2 or more optional parameters to avoid passing nil on function call....