Skip to content
代码片段 群组 项目
.haml-lint.yml 4.9 KB
更新 更旧
inherits_from:
  - .haml-lint_todo.yml
Rémy Coutable's avatar
Rémy Coutable 已提交
# 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'
Rémy Coutable's avatar
Rémy Coutable 已提交

linters:
  AltText:
    enabled: true
Rémy Coutable's avatar
Rémy Coutable 已提交

  ClassAttributeWithStaticValue:
Rémy Coutable's avatar
Rémy Coutable 已提交

  ClassesBeforeIds:
    enabled: false

  ConsecutiveComments:
    enabled: false

  ConsecutiveSilentScripts:
    enabled: false
    max_consecutive: 2

  DocumentationLinks:
    enabled: true
    include:
      - 'app/views/**/*.haml'
      - 'ee/app/views/**/*.haml'

Rémy Coutable's avatar
Rémy Coutable 已提交
  EmptyObjectReference:
    enabled: true

  EmptyScript:
    enabled: true

  FinalNewline:
    enabled: true
Rémy Coutable's avatar
Rémy Coutable 已提交
    present: true

  HtmlAttributes:
    enabled: true
Rémy Coutable's avatar
Rémy Coutable 已提交

  IdNames:
    enabled: false

Rémy Coutable's avatar
Rémy Coutable 已提交
  ImplicitDiv:
    enabled: true
Rémy Coutable's avatar
Rémy Coutable 已提交

  InlineStyles:
    enabled: false

  InstanceVariables:
    enabled: false

Rémy Coutable's avatar
Rémy Coutable 已提交
  LeadingCommentSpace:
    enabled: false

  LineLength:
    enabled: false
    max: 80

  MultilinePipe:
    enabled: true
Rémy Coutable's avatar
Rémy Coutable 已提交

  MultilineScript:
    enabled: true

  ObjectReferenceAttributes:
    enabled: true

  RepeatedId:
    enabled: false

Rémy Coutable's avatar
Rémy Coutable 已提交
  RuboCop:
Rémy Coutable's avatar
Rémy Coutable 已提交
    ignored_cops:
      # These cops are incredibly noisy when it comes to HAML templates, so we
      # ignore them.
      - Layout/BlockAlignment
Stan Hu's avatar
Stan Hu 已提交
      - Layout/HashAlignment
      - Layout/IndentationConsistency
      - Layout/IndentationWidth
Doug Stull's avatar
Doug Stull 已提交
      - Layout/LineLength
Stan Hu's avatar
Stan Hu 已提交
      - Layout/TrailingWhitespace
Rémy Coutable's avatar
Rémy Coutable 已提交
      - Lint/Void
Stan Hu's avatar
Stan Hu 已提交
      - Layout/ElseAlignment
Rémy Coutable's avatar
Rémy Coutable 已提交
      - Style/FrozenStringLiteralComment
      - Style/IfUnlessModifier
      - Style/Next
Stan Hu's avatar
Stan Hu 已提交
      - Style/StringLiteralsInInterpolation
Rémy Coutable's avatar
Rémy Coutable 已提交
      - Style/WhileUntilModifier
      - Cop/StaticTranslationDefinition
      # These cops should eventually get enabled
Stan Hu's avatar
Stan Hu 已提交

      # haml-lint force enables these: https://github.com/sds/haml-lint/blob/v0.51.0/config/forced_rubocop_config.yml
      - Layout/ArgumentAlignment
      - Layout/ArrayAlignment
      - Layout/ClosingParenthesisIndentation # See https://github.com/sds/haml-lint/issues/491
Stan Hu's avatar
Stan Hu 已提交
      - Layout/EndAlignment
      - Layout/SpaceInsideParens # See https://github.com/sds/haml-lint/issues/491
Stan Hu's avatar
Stan Hu 已提交
      - Cop/LineBreakAfterGuardClauses
Stan Hu's avatar
Stan Hu 已提交
      - Cop/LineBreakAroundConditionalBlock
      - Cop/ProjectPathHelper
Stan Hu's avatar
Stan Hu 已提交
      - Gitlab/FeatureAvailableUsage
      - Gitlab/Json
      - Gitlab/Rails/SafeFormat
      - GitlabSecurity/PublicSend
Stan Hu's avatar
Stan Hu 已提交
      - Layout/FirstHashElementIndentation
Stan Hu's avatar
Stan Hu 已提交
      - Layout/EmptyLineAfterGuardClause
Stan Hu's avatar
Stan Hu 已提交
      - Layout/EmptyLines
      - Layout/EmptyLinesAroundBlockBody
      - Layout/ExtraSpacing
      - Layout/InitialIndentation
      - Layout/LeadingCommentSpace
Stan Hu's avatar
Stan Hu 已提交
      - Layout/MultilineHashBraceLayout
      - Layout/SpaceAroundOperators
      - Layout/SpaceBeforeComma
      - Layout/SpaceBeforeFirstArg
      - Layout/SpaceInsideHashLiteralBraces
      - Layout/SpaceInsideStringInterpolation
Doug Stull's avatar
Doug Stull 已提交
      - Layout/TrailingEmptyLines
      - Lint/AmbiguousOperatorPrecedence
      - Lint/AssignmentInCondition
      - Lint/LiteralInInterpolation
      - Lint/ParenthesesAsGroupedExpression
Stan Hu's avatar
Stan Hu 已提交
      - Lint/RedundantStringCoercion
Stan Hu's avatar
Stan Hu 已提交
      - Lint/SafeNavigationConsistency
      - Lint/SymbolConversion
      - Lint/UnusedBlockArgument
      - Metrics/BlockNesting
      - Naming/VariableName
      - Performance/RedundantMatch
      - Performance/StringReplacement
Stan Hu's avatar
Stan Hu 已提交
      - Rails/LinkToBlank
      - Rails/OutputSafety
      - Rails/RequestReferer
      - Style/ColonMethodCall
      - Style/ConditionalAssignment
      - Style/HashSyntax
      - Style/IdenticalConditionalBranches
      - Style/IfInsideElse
      - Style/InlineDisableAnnotation
Stan Hu's avatar
Stan Hu 已提交
      - Style/MultilineTernaryOperator
      - Style/NegatedIf
      - Style/NestedTernaryOperator
      - Style/RedundantInterpolation
      - Style/SelfAssignment
      - Style/TernaryParentheses
      - Style/TrailingCommaInHashLiteral
      - Style/UnlessElse
      - Style/WordArray
      - Style/ZeroLengthPredicate

      # WIP See https://gitlab.com/gitlab-org/gitlab/-/issues/207950
      - Cop/UserAdmin
      # See https://gitlab.com/groups/gitlab-org/-/epics/7374.
      # This should eventually be enabled
      - Gitlab/AvoidGitlabInstanceChecks
Rémy Coutable's avatar
Rémy Coutable 已提交
  RubyComments:
    enabled: true
Rémy Coutable's avatar
Rémy Coutable 已提交

  SpaceBeforeScript:
Rémy Coutable's avatar
Rémy Coutable 已提交

  SpaceInsideHashAttributes:
Rémy Coutable's avatar
Rémy Coutable 已提交
    style: space

  Syntax:
    enabled: true

Rémy Coutable's avatar
Rémy Coutable 已提交
  Indentation:
    enabled: true
    character: space  # or tab
Rémy Coutable's avatar
Rémy Coutable 已提交

  TagName:
    enabled: true

Stan Hu's avatar
Stan Hu 已提交
  TrailingEmptyLines:
    enabled: false

Rémy Coutable's avatar
Rémy Coutable 已提交
  TrailingWhitespace:
Rémy Coutable's avatar
Rémy Coutable 已提交

  UnnecessaryInterpolation:
Rémy Coutable's avatar
Rémy Coutable 已提交

  UnnecessaryStringOutput:

  ViewLength:
    enabled: false