icare icon indicating copy to clipboard operation
icare copied to clipboard

[WIP] Change RuboCop defaults

Open tagliala opened this issue 4 years ago • 1 comments

Cop Proposed Change Reasons (max 3)
Layout/ExtraSpacing AllowForAlignment: false Preserve blame; minimize history changes
Layout/HashAlignment EnforcedColonStyle: key (default) Preserve blame; minimize history changes
Style/StringLiterals EnforcedStyle: double_quotes Improve search; uniformity
Style/SymbolArray EnforcedStyle: brackets Improve search; uniformity
Style/TrailingCommaInArrayLiteral EnforcedStyleForMultiline: consistent_comma Preserve blame; minimize history changes
Style/TrailingCommaInHashLiteral EnforcedStyleForMultiline: consistent_comma Preserve blame; minimize history changes
Style/WordArray EnforcedStyle: brackets Improve search; uniformity

Checklist

  • [ ] Layout/ExtraSpacing
  • [ ] Layout/HashAlignment
  • [ ] Style/StringLiterals
  • [ ] Style/SymbolArray
  • [ ] Style/TrailingCommaInArrayLiteral
  • [ ] Style/TrailingCommaInHashLiteral
  • [ ] Style/WordArray

Before

# Layout/ExtraSpacing, Style/StringLiterals
foo    = 'foo'
foobar = 'foobar'

# Layout/HashAlignment, Style/Style/TrailingCommaInHash
hashie = {
  foo:    :foo,
  foobar: :foobar
}

# Style/SymbolArray
sym_arr = %i[one two three]

# Style/TrailingCommaInArray
sym_arr_ml = [
  :one,
  :two,
  :three
]

# Style/WordArray
sym_arr = %w[one two three]

After

# Layout/ExtraSpacing, Style/StringLiterals
foo = "foo"
foobar = "foobar"

# Layout/HashAlignment, Style/Style/TrailingCommaInHash
hashie = {
  foo: :foo,
  foobar: :foobar,
}

# Style/SymbolArray
sym_arr = [:one, :two, :three]

# Style/TrailingCommaInArray
sym_arr = [
  :one,
  :two,
  :three,
]

# Style/WordArray
sym_arr = ["one", "two", "three"]
Layout/ExtraSpacing:
  AllowForAlignment: false

Layout/HashAlignment:
  EnforcedColonStyle: key

Style/StringLiterals:
  EnforcedStyle: double_quotes

Style/SymbolArray:
  EnforcedStyle: brackets

Style/TrailingCommaInArrayLiteral:
  EnforcedStyleForMultiline: consistent_comma

Style/TrailingCommaInHashLiteral:
  EnforcedStyleForMultiline: consistent_comma

Style/WordArray:
  EnforcedStyle: brackets

tagliala avatar May 12 '20 19:05 tagliala

@cesidio about Style/StringLiterals, I think that it took ~10 years to convince us, but we have lost the battle since standard and stylelint are preferring single quotes

tagliala avatar Jun 06 '20 13:06 tagliala