Skip to content
代码片段 群组 项目
.haml-lint.yml 3.7 KB
Newer Older
inherits_from:
  - .haml-lint_todo.yml
# Whether to ignore frontmatter at the beginning of HAML documents for
# frameworks such as Jekyll/Middleman
skip_frontmatter: false
exclude:
  - 'vendor/**/*'
  - './haml_lint/linter/documentation_links.rb'
  - './haml_lint/linter/inline_javascript.rb'
  - './haml_lint/linter/no_plain_nodes.rb'

linters:
  AltText:
    enabled: true

  ClassAttributeWithStaticValue:

  ClassesBeforeIds:
    enabled: false

  ConsecutiveComments:
    enabled: false

  ConsecutiveSilentScripts:
    enabled: false
    max_consecutive: 2

    include:
      - 'app/views/**/*.haml'
      - 'ee/app/views/**/*.haml'

  EmptyObjectReference:
    enabled: true

  EmptyScript:
    enabled: true

  FinalNewline:
    present: true

  HtmlAttributes:
  IdNames:
    enabled: false

  ImplicitDiv:
  InlineStyles:
    enabled: false

  InstanceVariables:
    enabled: false

  LeadingCommentSpace:
    enabled: false

  LineLength:
    enabled: false
    max: 80

  MultilinePipe:

  MultilineScript:
    enabled: true

  ObjectReferenceAttributes:
    enabled: true

  RepeatedId:
    enabled: false

  RuboCop:
    ignored_cops:
      # These cops are incredibly noisy when it comes to HAML templates, so we
      # ignore them.
      - Layout/BlockAlignment
      - Layout/EndAlignment
      - Layout/LineLength
      - Lint/Void
      - Style/AlignParameters
      - Style/BlockNesting
      - Style/ElseAlignment
      - Style/FileName
      - Style/FinalNewline
      - Style/FrozenStringLiteralComment
      - Style/IfUnlessModifier
      - Style/IndentationWidth
      - Style/Next
      - Style/TrailingWhitespace
      - Style/WhileUntilModifier
      - Cop/StaticTranslationDefinition
      # These cops should eventually get enabled
Stan Hu's avatar
Stan Hu 已提交
      - Cop/LineBreakAfterGuardClauses
      - Gitlab/FeatureAvailableUsage
      - GitlabSecurity/PublicSend
      - Layout/EmptyLineAfterGuardClause
      - Layout/LeadingCommentSpace
      - Layout/SpaceAroundOperators
      - Layout/SpaceBeforeComma
      - Layout/SpaceBeforeFirstArg
      - Layout/SpaceInsideHashLiteralBraces
      - Layout/SpaceInsideStringInterpolation
      - Layout/TrailingEmptyLines
      - Lint/LiteralInInterpolation
      - Lint/ParenthesesAsGroupedExpression
Stan Hu's avatar
Stan Hu 已提交
      - Lint/SafeNavigationConsistency
      - Metrics/BlockNesting
      - Naming/VariableName
      - Performance/RedundantMatch
      - Performance/StringReplacement
      - Rails/LinkToBlank
      - Rails/RequestReferer
      - Style/ColonMethodCall
      - Style/ConditionalAssignment
      - Style/HashSyntax
      - Style/IdenticalConditionalBranches
      - Style/NegatedIf
      - Style/NestedTernaryOperator
      - Style/SelfAssignment
      - Style/TernaryParentheses
      - Style/TrailingCommaInHashLiteral
      - Style/UnlessElse
      - Style/UnneededCondition
      - Style/WordArray
      - Style/ZeroLengthPredicate

      # WIP See https://gitlab.com/gitlab-org/gitlab/-/issues/207950
      - Cop/UserAdmin

  RubyComments:

  SpaceBeforeScript:

  SpaceInsideHashAttributes:
    style: space

  Indentation:
    enabled: true
    character: space  # or tab

  TagName:
    enabled: true

  TrailingWhitespace:

  UnnecessaryInterpolation:

  UnnecessaryStringOutput:

  ViewLength:
    enabled: false