ruby-style-guide
ruby-style-guide copied to clipboard
A community-driven Ruby coding style guide
A good argument here by @JoelQ: https://github.com/thoughtbot/til/blob/master/ruby/all-but-the-first-element-from-array.md https://ruby-doc.org/core-2.7.0/Array.html#method-i-drop
TLDNR: The styleguide and `RuboCop` should always prefer the use of `alias_method`. ## Obscure difference Ask 100 Rubyists to provide an example where `alias` and `alias_method` act differently. I would...
I feel the guide should have a say on how to order method parameters. In particular, default parameter should occur after non-default regular parameters, and before the splat parameter. Doing...
There is no rule for the separation between the stab and its parameters. The parser accepts both with space and without space but it seems that in any other language...
The style guide currently takes a hard-line position on `self` that it shouldn't be used unless you're doing an attribute assignment. I would argue that this is actually an over-simplification....
The problem: As a developer, if I am changing how a class is used or named, I would need to grep against the codebase with the name of the class....
So I'd like to know communities' position on this issue. Say, we have a class that has several accessors: ```ruby class A ATTRS=%i(a b c d) attr_accessor :a, :b, :c,...
At my company we have begun using the idiom ``` private def quux(foo, bar) foo
`# bad` `expect(bowling.score).to eq 0` `# good` `expect(bowling.score).to eq(0)` But: `Omit parentheses around parameters for methods that are part of an internal DSL (e.g. Rake, Rails,`**RSpec**`)` IMO `eq 0` looks...
Which syntax is preferred for multi line conditions on if, like when the conditions are too long that they over 80 chars limit ``` Ruby if some.long.method && other_condition &&...