September 16th, 2015
(written by lawrence krubner, however indented passages are often quotes). You can contact lawrence at: email@example.com
I am a bit late but I’ve only recently become consistent about using a linter to check my Clojure style. And I’ve only today discovered the Leiningen plugin lein-checkall, which combines lein check && lein kibit && lein eastwood && lein bikeshed.
Eastwood is a Clojure linter, invoked with lein eastwood. As a general request, please use a linter. Some of my favorite moments in the last year have come from people trying to merge code with lint errors and insisting that the linter was wrong. It’s like an open admittance that they’ve made a mistake but are unwilling to do the work to understand what it is.
I make no claims to perfection, myself – Eastwood regularly catches minor mistakes like misaligned parenthesis in tests or out-of-place docstrings – but Eastwood at least prevents me from quietly sneaking such errors into my code.
Kibit and lein-bikeshed
Both kibit and lein-bikeshed are tools that hunt for, essentially, “bad code smell”. Kibit (lein kibit) is a static code analyzer that specializes in finding code blocks that replicate existing functions (for instance, when you’ve typed (when (not …)) instead of (when-not …)), and lein-bikeshed (unsurprisingly, lein bikeshed) looks for things like long lines, missing docstrings, and extra whitespace.
I’m not particularly strict in my enforcement of their recommendations, but they’re great tools to have available.