fuadsaud · GitHub

marcotc added a commit to wealthsimple/ws-style that referenced this pull request

@marcotc

There's a long discussion (rubocop/ruby-style-guide#176 (comment)) in the Rubocop community around this and the consensus is to "be consistent", no matter if you choose trailing or leading dots.
At Wealthsimple there's a considerable disadvantage to using leading dots: code with leading dots cannot be pasted into irb/pry. This affects local testing and scripting.
We'd had bugs in the past related to people pasting large snippets from a perfectly functioning Ruby file into pry, but that script fails very subtly, amidst hundreds of successfully pasted lines, one fails but the whole block is still successful.
Example:
```ruby
# a lot of code here
list = bar.map{|x|x+1}
         .select{|x|x>1}
# much more code here
```
this code still "works", but won't give you the correct result.

Read the original on github.com ↗