clj-commons / kibit

There's a function for that!
1.76k stars 135 forks source link

Integration with common style guidelines #82

Open djui opened 11 years ago

djui commented 11 years ago

@bbatsov has a nice written Clojure style guidelines repo and there is the default Clojure guidelines that cover many aspects that could be seen as generalized/community accepted, and being particularly seen as a company's flavour or "this is the only way to do it".

If that is reasonable and feasible, I think it is worth going through the guidelines, make them list items, and partition/rank them in relevance and implement new rules that do not exist yet in kibit.

The icing on the cake would be to somehow (maybe just links to the clj filename + lines) reference the guideline to the rule in the code.

I can help out if you see a point in doing this. Maybe 90% of the rules mentioned there are already covered (I have to look through the kibit source code again, you might have a better mental overview what's covered and what not, maybe for a good reason).

Edited to show list in first post

bbatsov commented 11 years ago

For what is worth - I'm planning to write a tool at some point, that automatically enforces the guidelines at some point(like I did for the Ruby style guide with RuboCop). When (if) this would happen, however, I cannot promise given my pretty busy schedule and the multitude of projects I'm involved with.

danielcompton commented 10 years ago

The Clojure guidelines have moved to http://dev.clojure.org/display/community/Library+Coding+Standards

danielcompton commented 10 years ago

I've looked at this and have a few thoughts. Because kibit reads source with a clojure reader, it isn't able to 'see' some of the infractions of the style guide as they aren't present in the read form. For example comments, whitespace and commas aren't available when the file has been read. Secondly, some of these style suggestions would be better addressed in eastwood which is a linter, whereas kibit's goal is suggesting more idiomatic ways of expressing a form. Thirdly, some of these suggestions aren't possible to check with Kibit because it reads without macroexpansion or evaluation. Lastly some people disagree with some of the style guide suggestions. Opening kibit up for extension by third party rules in #66 could let people check some of these rules without requiring them to be part of kibit.

All that being said, I think there's some good things in the style guide that might be able to go into Kibit. I'll check through Kibit to see which of these are already there or annotate this list with why I don't think they are appropriate.