ruby-style-guide
ruby-style-guide copied to clipboard
A community-driven Ruby coding style guide
```ruby # bad def foo x = 1 y = 1 if bar zoo quux end false end # good def foo x = 1 y = 1 if bar...
Adds a section for keeping empty lines after module inclusion methods (`extend`, `include` and `prepend`). The term "module inclusion" has been borrowed from [Layout/ClassStructure docs](https://github.com/rubocop/rubocop/blob/48363660a8b48679470e3d174461b234ddcbb02e/lib/rubocop/cop/layout/class_structure.rb#L12). I couldn't find a similar...
Follows https://github.com/rubocop/rubocop/pull/14032#issuecomment-2751535006
ref: https://github.com/rubocop/rubocop/issues/13588 This is a little-known (I believe) and rarely used feature of the rescue operator, which allows assigning an exception using an object's writer method: ```ruby Foo = Struct.new(:exception)...
In the style guide under [Slicing with Ranges](https://rubystyle.guide/#slicing-with-ranges) it's said that > `[0..-1]` in `ary[0..-1]` is redundant and simply synonymous with `ary`. However, one makes a shallow copy while the...