Skip to content

Commit 189193d

Browse files
authored
Use trailing dots
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.
1 parent 5131800 commit 189193d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

default.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ Lint/AmbiguousBlockAssociation:
2424
Exclude:
2525
- 'spec/**/*'
2626

27-
Layout/IndentArray:
28-
EnforcedStyle: consistent
27+
Layout/DotPosition:
28+
EnforcedStyle: trailing
2929

3030
Layout/CaseIndentation:
3131
Enabled: false
@@ -36,6 +36,9 @@ Layout/ElseAlignment:
3636
Layout/EndAlignment:
3737
Enabled: false
3838

39+
Layout/IndentArray:
40+
EnforcedStyle: consistent
41+
3942
Layout/IndentationWidth:
4043
Enabled: false
4144

0 commit comments

Comments
 (0)