Skip to content

Enable more rubocop-cops for haml files

In gitlab-foss!21247 (merged) we enable rubocop in haml lint. In order to avoid to much noise, we disabled the following cops. We should decide which ones we want to enable.

Cop Count (as of 2018)
Cop/LineBreakAfterGuardClauses 22
Cop/LineBreakAroundConditionalBlock !59147 (merged) 0
Cop/ProjectPathHelper 23
GitlabSecurity/PublicSend 6
Layout/LeadingCommentSpace 14
Layout/SpaceAfterColon !58564 (merged) 4
Layout/SpaceAfterComma !58731 (merged) 2
Layout/SpaceAroundOperators 14
Layout/SpaceBeforeBlockBraces 1
Layout/SpaceBeforeComma 6
Layout/SpaceBeforeFirstArg 4
Layout/SpaceInsideArrayLiteralBrackets !59143 (merged) 3
Layout/SpaceInsideHashLiteralBraces 159
Layout/SpaceInsideStringInterpolation 43
Layout/TrailingBlankLines 1073
Lint/BooleanSymbol !59075 (merged) 1
Lint/LiteralInInterpolation 1
Lint/ParenthesesAsGroupedExpression 6
Lint/RedundantWithIndex 1
Lint/Syntax 1
Lint/UselessAssignment 27
Metrics/BlockNesting 3
Naming/VariableName 2
Performance/RedundantMatch 2
Performance/StringReplacement 1
Rails/Presence !17631 (merged) !59600 (merged). 1
Rails/RequestReferer 1
Style/AndOr !59071 (merged) 3
Style/ColonMethodCall 1
Style/ConditionalAssignment 7
Style/HashSyntax 69
Style/IdenticalConditionalBranches 6
Style/NegatedIf 8
Style/NestedTernaryOperator 1
Style/Not !59071 (merged) 1
Style/ParenthesesAroundCondition !59553 (merged) 1
Style/RedundantParentheses !58846 (merged) 19
Style/SelfAssignment 3
Style/Semicolon !59070 (merged) 2
Style/TernaryParentheses 1
Style/TrailingCommaInHashLiteral 2
Style/UnlessElse 3
Style/WordArray 1
Style/ZeroLengthPredicate 6

cc @smcgivern


The following discussion from gitlab-foss!21247 (merged) should be addressed:

  • @reprazent started a discussion: (+2 comments)

    If this is indeed the way to go from review, I'll create an issue for this.

status as of 2021-04
    174  Cop/LineBreakAfterGuardClauses
     21  Cop/ProjectPathHelper
     60  Gitlab/FeatureAvailableUsage
      7  GitlabSecurity/PublicSend
    174  Layout/EmptyLineAfterGuardClause
     10  Layout/LeadingCommentSpace
     20  Layout/SpaceAroundOperators
     17  Layout/SpaceBeforeComma
      1  Layout/SpaceBeforeFirstArg
    243  Layout/SpaceInsideHashLiteralBraces
     35  Layout/SpaceInsideStringInterpolation
   1964  Layout/TrailingEmptyLines
      1  Lint/BooleanSymbol
     16  Lint/LiteralInInterpolation
      2  Lint/ParenthesesAsGroupedExpression
      1  Lint/RedundantWithIndex
      1  Lint/SafeNavigationConsistency
      5  Metrics/BlockNesting
     13  Naming/VariableName
      1  Performance/RedundantMatch
      3  Performance/StringReplacement
    109  Rails/LinkToBlank
      2  Rails/Presence
      2  Rails/RequestReferer
      1  Style/ColonMethodCall
      6  Style/ConditionalAssignment
     74  Style/HashSyntax
      8  Style/IdenticalConditionalBranches
     13  Style/NegatedIf
      2  Style/NestedTernaryOperator
      1  Style/ParenthesesAroundCondition
      6  Style/SelfAssignment
      3  Style/TernaryParentheses
      8  Style/TrailingCommaInHashLiteral
      5  Style/UnlessElse
      8  Style/WordArray
      8  Style/ZeroLengthPredicate
Edited by Takuya Noguchi