Unify Ruby and ERB Rubocop rules

So now we remove duplication between .rubocop.yml and the rubocop rules
defined for erblint. Having the rules in two places led to some
mistakes, like renaming Layout/Tab to Layout/IndentationStyle in
`.rubocop.yml` but forgetting to do so in `.erb-lint.yml`.

This also means we can use the EnforcedStyle options for
Layout/SpaceInsideHashLiteralBraces in views as well.

We couldn't implement this feature earlier because it required Ruby 2.4
and due to incompatibilities between versions of erb_lint and versions
of rubocop.

There are some rules which do not apply to ERB files and so we're
disabling them.

* Layout/LineLength, Layout/TrailingEmptyLines and Lint/UselssAssignment
  generate false positives
* Rails/OutputSafety is redundant since its functionality is already
  covered by ERB Lint ErbSafety linter
This commit is contained in:
Javi Martín
2019-07-05 04:14:15 +02:00
parent f864156b21
commit 32ef8ff301

View File

@@ -20,29 +20,14 @@ linters:
enabled: true enabled: true
Rubocop: Rubocop:
enabled: true enabled: true
only: rubocop_config:
- Layout/EndOfLine inherit_from:
- Layout/SpaceAfterColon - .rubocop.yml
- Layout/SpaceAfterComma Layout/LineLength:
- Layout/SpaceAfterMethodName Enabled: false
- Layout/SpaceAfterNot Layout/TrailingEmptyLines:
- Layout/SpaceAfterSemicolon Enabled: false
- Layout/SpaceAroundBlockParameters Lint/UselessAssignment:
- Layout/SpaceAroundOperators Enabled: false
- Layout/SpaceBeforeBlockBraces Rails/OutputSafety:
- Layout/SpaceBeforeComma Enabled: false
- Layout/SpaceBeforeComment
- Layout/SpaceBeforeFirstArg
- Layout/SpaceBeforeSemicolon
- Layout/SpaceInsideArrayLiteralBrackets
- Layout/SpaceInsideArrayPercentLiteral
- Layout/SpaceInsideBlockBraces
- Layout/SpaceInsideHashLiteralBraces
- Layout/SpaceInsideParens
- Layout/SpaceInsidePercentLiteralDelimiters
- Layout/SpaceInsideRangeLiteral
- Layout/SpaceInsideReferenceBrackets
- Layout/SpaceInsideStringInterpolation
- Layout/Tab
- Lint/LiteralAsCondition
- Style/PercentLiteralDelimiters