Closed aengelberg closed 5 years ago
My initial reaction is a preference against allowing this. The point of style rules is to limit the number of valid ways to format a given form, so opening that up seems counter to that goal. Even in the blank-line-separated case, I think the extra indent on the clause expressions helps distinguish them from the conditions.
I'll think about this one some more.
I'll admit that I'm somewhat biased here due to my developer workflow. Emacs' clojure-mode
has its own indenting engine implemented in Emacs Lisp. It is configurable with cljfmt-esque rules, but it isn't easily extensible, thus it doesn't support the new :cond
rule and likely never will. So this is my way of leaving open at least one way for Emacs users to write cond
s in a way that their editor and linter will both approve of.
I'll also point out that my proposed implementation of the cond rule would still only allow one way to write any given form. It just makes a different assertion about what's "correct" depending on the spacing in between the pairs.
Closing this as it is obviated by amperity/cljfmt#1.
The
cond
"stair-step" behavior was originally added to add clarity to the predicates and the results, but if a cond is written with blank lines in between pairs, that added clarity is unnecessary. My proposed change to thecond
rule would suppress that behavior for a pair if there is nothing interesting directly above or below it.With the new rule, the following bodies are now both considered valid: