# This configuration file was generated by `ameba --gen-config`
# on 2025-06-02 13:57:07 UTC using Ameba version 1.7.0-dev.
# The point is for the user to remove these configuration records
# one by one as the reported problems are removed from the code base.
#
# For more details on any individual rule, run `ameba --only RuleName`.

# Indicators for comment annotations:
#
# * `Disabled`: The rule is disabled because it does not seem useful for this repo (or in general).
# * `BUG`: A bug in ameba prevents using this rule either entirely or for specific files.
# * `FIXME`: The rule seems useful, but requires some effort to resolve. That's deferred for later.
# * `TODO`: The rule might be useful, but we need to investigate whether we want to use it or not.

Version: "1.7.0-dev"

# Documentation
# =========================

# Disabled: What's the point in alerting about existing TODOs in code?
Documentation/DocumentationAdmonition:
  Enabled: false

# Lint
# =========================

Lint/DebugCalls:
  Excluded:
  # Samples may legitimately use DebugCalls
  - samples/**/*
  # Explicit tests
  - spec/std/pp_spec.cr

Lint/DebuggerStatement:
  Excluded:
  # Explicit tests
  - spec/debug/**/*

# Disabled: `else nil` can be useful to explicitly show the consequence of the else branch
Lint/ElseNil:
  Enabled: false

# Disabled: We have an explicit CI job for testing the formatter (both latest
# and head). No reason to run it through ameba.
Lint/Formatting:
  Enabled: false

Lint/LiteralInCondition:
  Excluded:
  # Samples may legitimately use literals in conditions
  - samples/**/*

Lint/LiteralInInterpolation:
  Excluded:
  - spec/std/random_spec.cr # BUG: https://github.com/crystal-ameba/ameba/issues/611

Lint/LiteralsComparison:
  Excluded:
  # Explicit tests for case equality on literals
  - spec/std/{array,char,int,number,regex,string,symbol,tuple,uint}_spec.cr

# TODO: Investigate if some `not_nil!` calls can be avoided.
Lint/NotNil:
  Enabled: false

# BUG: https://github.com/crystal-ameba/ameba/issues/605
Lint/SpecFocus:
  Enabled: false

Lint/RandZero:
  Excluded:
  # Explicit tests
  - spec/std/random_spec.cr

# FIXME: Resolve shadowing.
Lint/ShadowingOuterLocalVar:
  Enabled: false

Lint/SpecFilename:
  Excluded:
  - spec/compiler/data/**/*
  - spec/compiler/lexer/lexer_objects/strings.cr
  - spec/debug/**/*
  - spec/llvm-ir/**/*
  - spec/std/float_printer/ryu_printf_test_cases.cr

# BUG: https://github.com/crystal-ameba/ameba/issues/612
Lint/TopLevelOperatorDefinition:
  Enabled: false

# Disabled: We have an explicit CI job for `typos`. No reason to run it through
# ameba.
Lint/Typos:
  Enabled: false

# TODO: Investigate unused arguments.
Lint/UnusedArgument:
  Enabled: false

# TODO: Investigate unused block arguments.
Lint/UnusedBlockArgument:
  Enabled: false

Lint/UselessAssign:
  # BUG: https://github.com/crystal-ameba/ameba/issues/447
  # This setting is to avoid false positives from the common use of type
  # declarations in macro arguments.
  ExcludeTypeDeclarations: true
  Excluded:
    - spec/debug/**/*
    - samples/mt_gc_test.cr
    # BUG: https://github.com/crystal-ameba/ameba/issues/624
    - spec/std/concurrent/select_spec.cr
    # Generators assign top-level variables to pass to ECR templates
    - scripts/generate_*
    # BUG: https://github.com/crystal-ameba/ameba/issues/623
    - scripts/github-changelog.cr

# Metrics
# =========================

# Disabled: Lot's of violations. Complexity is very individual.
Metrics/CyclomaticComplexity:
  Enabled: false

# Naming
# =========================
# All disabled. There are many violations and some of the rules are questionable.
# TODO: Consider enabling some of these rules.

Naming/AccessorMethodName:
  Enabled: false

Naming/BinaryOperatorParameterName:
  Enabled: false

Naming/BlockParameterName:
  Enabled: false

# Disabled: All violations follow the spelling of identifiers in upstream
# projects, e.g. for lib bindings.
Naming/ConstantNames:
  Enabled: false

Naming/MethodNames:
  Enabled: false

Naming/PredicateName:
  Enabled: false

Naming/QueryBoolMethods:
  Enabled: false

Naming/RescuedExceptionsVariableName:
  Enabled: false

Naming/TypeNames:
  Enabled: false

Naming/VariableNames:
  Enabled: false

# Performance
# =========================

Performance/AnyInsteadOfEmpty:
  Excluded:
  # These specs explicitly test `#any?` implementations
  - spec/std/bit_array_spec.cr
  - spec/std/enumerable_spec.cr
  - spec/std/hash_spec.cr

# Style
# =========================
# All disabled. There are many violations and some of the rules are questionable.
# TODO: Consider enabling some of these rules.

Style/HeredocEscape:
  Enabled: false

Style/HeredocIndent:
  Enabled: false

Style/MultilineCurlyBlock:
  Enabled: false

# Disabled: This rule seems too strict when any negation inside a complex condition is
# considered a violation. https://github.com/crystal-ameba/ameba/issues/621
Style/NegatedConditionsInUnless:
  Enabled: false

# BUG: https://github.com/crystal-ameba/ameba/issues/614
Style/ParenthesesAroundCondition:
  Enabled: false

Style/PercentLiteralDelimiters:
  Enabled: false

Style/RedundantNext:
  Enabled: false

Style/RedundantReturn:
  Enabled: false

Style/RedundantSelf:
  Enabled: false

Style/VerboseBlock:
  Enabled: false

Style/WhileTrue:
  Enabled: false
