-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
Description
I'm just going to pile these in for now. Please get to them when it makes sense to.
I noticed some problems while going through the code of this project that should be addressed and learned from:
- We don't use seattle.rb style method calls/definitions. Instead of
def foo bar, baz, we dodef foo(bar,baz). Instead of calling it asfoo bar, baz, we prefer in almost every casefoo(bar, baz). The only time when we are ok with going without parens is in DSLs, such asvalidates_presence of :emailinstead ofvalidates_presence_of(:email). - Huge huge lines. I don't really worry about long strings spanning more than 80 chars because ruby's syntax for multi-line strings that don't have newlines is even uglier. However, there are lots of specs that have hashes that are huge and all on one line. Create a new line for each key/value pair.
- Too many classes with only class methods. As a general rule of thumb, if you have a class that is all class methods, and doesn't make sense to instantiate, you could use a module instead, but there's a better solution: make them instance methods. A lot of the stateless class methods I saw are actually pretty big, unwieldy methods (10+ lines). Create a new class instead and spread out that code over many private methods and the code will be much easier. Also, just because you don't need any state now doesn't mean that you won't later. Please read this for more detail: http://blog.codeclimate.com/blog/2012/11/14/why-ruby-class-methods-resist-refactoring/
Reactions are currently unavailable