--- inherit_from: .rubocop_todo.yml require: - rubocop-rspec - rubocop/devtools AllCops: Exclude: - 'test_app/**/*' - 'tmp/**/*' - vendor/**/* DisplayCopNames: true TargetRubyVersion: 2.3 # This ends up being too spammy Style/Documentation: Enabled: false Style/ExtraSpacing: AllowForAlignment: true Metrics/LineLength: Max: 100 Metrics/BlockLength: Exclude: # Ignore RSpec DSL - spec/**/* # Ignore Rake task DSL - Rakefile Style/IfUnlessModifier: MaxLineLength: 100 Style/Next: EnforcedStyle: always Style/PercentLiteralDelimiters: PreferredDelimiters: '%i': '[]' '%I': '[]' '%q': '{}' '%Q': '{}' '%r': '{}' '%s': () '%w': '[]' '%W': '[]' '%x': () Style/TrivialAccessors: ExactNameMatch: false Style/SymbolArray: Enabled: true Style/BarePercentLiterals: EnforcedStyle: percent_q Style/CollectionMethods: Enabled: true Style/Send: Enabled: true Style/AutoResourceCleanup: Enabled: true Style/FirstArrayElementLineBreak: Enabled: true Style/FirstHashElementLineBreak: Enabled: true Style/FirstMethodArgumentLineBreak: Enabled: true Style/FirstMethodParameterLineBreak: Enabled: true Style/MultilineArrayBraceLayout: Enabled: true Style/MultilineAssignmentLayout: EnforcedStyle: new_line Enabled: true Style/MultilineHashBraceLayout: Enabled: true Style/MultilineMethodCallBraceLayout: Enabled: true Style/MultilineMethodDefinitionBraceLayout: Enabled: true Style/OptionHash: Enabled: true Style/StringMethods: Enabled: true Style/IndentArray: EnforcedStyle: consistent Style/IndentHash: EnforcedStyle: consistent MultilineMethodCallIndentation: EnforcedStyle: indented Style/Alias: EnforcedStyle: prefer_alias_method Style/AlignHash: EnforcedColonStyle: table Style/SignalException: EnforcedStyle: semantic Style/SingleLineBlockParams: Enabled: false # We prefer being able to write # # foo(*%w[bar baz qux norf hello goodbye]) # # over # # foo('bar', 'baz', 'qux', 'norf', 'hello', 'goodbye') # # because # # 1. the `%w` signals that all elements are strings without interpolation # 2. the `%w` case is more compact # # The only exception is method invocations with a single argument. These # cases should be `foo('bar')` and never `foo(*%w[bar])` # Lint/UnneededSplatExpansion: Enabled: false # We only use guard clauses when it guards two or more statements: # # # bad # def foo # return if bar # # baz # end # # # good # def foo # baz if bar # end # # This includes conditionals with an `else` branch: # # # bad # def foo # return qux if bar # # baz # end # # # good # def foo # if bar # qux # else # baz # end # end # # It is up to the author of the code in question if the condition concerns # exactly two statements # # # ok # def foo # return if bar # # baz # qux # end # # # also ok # def foo # if bar # baz # qux # end # end # # Use a guard clause if more than two statements are being guarded by the conditional # # # bad # def foo # if bar # baz # qux # norf # end # end # # # good # def foo # return if bar # # baz # qux # norf # end Style/GuardClause: Enabled: false # Prefer writing an empty method on two lines # # # good # def foo # end # # # bar # def foo; end # Style/EmptyMethod: EnforcedStyle: expanded # RuboCop disables end alignment by default. Explanation: # # The end alignment cops are in the Lint category because the bad # indentation could be something more serious than just a style issue. # It could be a mistake in which keyword you think you're matching with the end. # (ruby -w warns for these too, by the way.) So for this reason I don't think # we can add auto-correct for these cops. # # From https://github.com/bbatsov/rubocop/pull/1789#issuecomment-92308357 # # I think we have more than enough tools that sound the alarms if we have # such an obvious mistake like mismatched tokens. # # - Our specs are likely to fail # - RuboCop will flag it regardless, it just doesn't autocorrect it by default # - Ruby will emit a warning which we configure to fail our specs # # So I think it is safe to enable autocorrect for end alignment cops because it # does not seem unsafe and it improves workflow to be able to autocorrect alignment Lint/DefEndAlignment: AutoCorrect: true # See explanation for `Lint/DefEndAlignment` Lint/EndAlignment: AutoCorrect: true