This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-03-31
Channels
- # admin-announcements (1)
- # beginners (16)
- # boot (25)
- # braid-chat (7)
- # cider (4)
- # cljsfiddle (6)
- # cljsrn (1)
- # clojure (256)
- # clojure-austin (4)
- # clojure-ireland (1)
- # clojure-poland (15)
- # clojure-russia (80)
- # clojure-uk (2)
- # clojurescript (30)
- # core-async (14)
- # core-typed (3)
- # cursive (35)
- # datomic (1)
- # editors (28)
- # hoplon (32)
- # immutant (1)
- # jobs (8)
- # jobs-discuss (1)
- # juxt (6)
- # leiningen (8)
- # liberator (7)
- # off-topic (16)
- # om (69)
- # onyx (38)
- # re-frame (10)
- # spacemacs (1)
- # untangled (117)
What do you guys use within a project to have consistent formatting? cljfmt looks like the standard way to go & integrates nicely with vim & CIDER. We’re creating our first (yay!) collaborative Clojure projects now and noticed that our setups aren’t quite compatible. If I saved my co-workers file using my setup it would automatically fix (as in cljfmt fix) the file. We’re looking to reach a consensus, open to everything, so I’m hoping you guys can share your experiences.
@mull: This is not clojure specific, but the usual way to go is to format the code as part of the pre commit job, if your build chain allows that. Another solution is to autoformat on save if the editor supports this option.
@sveri: auto format on save is what I would go for as well. Pre-commit is an interesting idea. From my vim-cljfmt it sometimes screws things up though so I can imagine it could get a bit messy
@mull: I never tested it for cljfmt, but, if I was serious on it in a team environment I would take my time and try to make it work reliably. That's what our team does for java code formatting, we solved it by having an installchain containing eclipse and the same format settings enabled for everyone on file save. So there are different solutions, just make sure they work reliable for everyone to reduce developer pain.
@mull we eventually gave up on getting emacs/vim/cursive to all play together nicely. We eventually settled on just using 2-indents for everything.
Emacs has it's own list of "special" 1-indents, and clojure-static has it's list, no idea how cursive determines it.
In most cases you don't notice the 1v2 difference. Or is there something I've missed?
@mull I created this so you can do fast pre-commit hooks. https://github.com/snoe/node-cljfmt
@snoe you've really solved the general tooling problem by using js. It's really cool.
@snoe: I know its open source and all, but why not make a leiningen task / plugin or some kind of a jar? Having to install nodejs for formatting clojure code is strange 😄 Well, I dont want to criticize you. Always nice to see stuff given back to the community. Just wondering about so many people going nodejs today.
simply for speed, there's https://github.com/weavejester/cljfmt if you want a plugin