clojure-style-guide
clojure-style-guide copied to clipboard
A community coding style guide for the Clojure programming language
We recently had discussion about this rule at work. We have two Emacs user, single Vim user and many Cursive users and all but Emacs users found this rule strange....
I know this isn't a widely accepted Clojure indentation rule yet, but consider the following code: ``` (defn foo [] (html [:div {:class "bar"} [:span "first child"] [:span "second child"]]))...
Should Clojurists favour narrow formatting with top-level forms on new lines, like this: ```clojure (def asym-hobbit-body-parts [{:name "head" :size 3} {:name "left-eye" :size 1} {:name "left-ear" :size 1} {:name "mouth"...
As Clojure is currently implemented, a failing pre- or post-condition throws an AssertionError, as opposed to an Exception. Errors are subclasses of Throwable but not of Exception: http://docs.oracle.com/javase/7/docs/api/java/lang/Error.html. Per the...
What is the suggested level of indentation of multi-line namespaced maps? ``` ;; no indentation #:my-ns {:k :v} ;; one space #:my-ns {:k :v} ;; two spaces #:my-ns {:k :v}...
Originally from #131. #132 closed that and added test naming conventions, but there are other test conventions that we should talk about: - [ ] using `testing` to provide context...
Reading https://github.com/bbatsov/clojure-style-guide#changing-state-fns-with-exclamation-mark, it's not clear to me whether things like database calls should have `!`s on them. They are changing state, and not necessarily retryable in STM transactions, but it's...
I would like to clarify (and maybe enhance) formatting of simple functions. According to current standard, following example is bad ``` clojure (defn foobar [x] (-> x foo bar baz))...
Hello all, we are discussing a formatting problem [here](https://github.com/laurentpetit/ccw/issues/602) and I thought I could give `clojure-style-guide` a spin. Basically we are indenting metadata. A proposal in the issue above is...
E.g. ``` clojure (into {} (for [n [:a :b :c]] [n (name n)])) ;; vs. (into {} (for [n [:a :b :c]] {n (name n)})) ``` :smile: