---
#
# Clang-Tidy configuration for simSYCL.
#
# There are three usage scenarios:
# 1. Automatic checks through an IDE (CLion, VsCode, ...)
# 2. Running manually on select files (not recommended)
#    `clang-tidy -p path/to/compile_commands.json file1 [file2, ...]`
#    Note: A script for running clang-tidy on all Celerity sources is provided in `ci/run-clang-tidy.sh`
# 3. Running on a diff (for CI)
#    `git diff -U0 --no-color | clang-tidy-diff.py -p1 -path path/to/compile_commands.json`
#
InheritParentConfig: false
# See https://clang.llvm.org/extra/clang-tidy/checks/list.html for a full list of available checks.
# Note: We would like to enable `misc-const-correctness` (introduced with Clang 15), but it currently
#       seems to be somewhat buggy still (producing false positives) => revisit at some point.
Checks: -*,
  readability-*,
  -readability-avoid-const-params-in-decls,
  -readability-function-cognitive-complexity,
  -readability-identifier-length,
  -readability-magic-numbers,
  -readability-uppercase-literal-suffix,
  -readability-convert-member-functions-to-static
  -readability-qualified-auto

CheckOptions:
  # Naming conventions
  - key: readability-identifier-naming.ClassCase
    value: lower_case
  - key: readability-identifier-naming.ClassMethodCase
    value: lower_case
  - key: readability-identifier-naming.EnumCase
    value: lower_case
  - key: readability-identifier-naming.EnumConstantCase
    value: lower_case
  - key: readability-identifier-naming.FunctionCase
    value: lower_case
  - key: readability-identifier-naming.LocalVariableCase
    value: lower_case
  - key: readability-identifier-naming.LocalVariableIgnoredRegexp
    # Allow single-letter uppercase variable names
    value: "[A-Z]"
  - key: readability-identifier-naming.ParameterCase
    value: lower_case
  - key: readability-identifier-naming.ParameterIgnoredRegexp
    # Allow single-letter uppercase function parameters
    value: "[A-Z]"
  - key: readability-identifier-naming.ProtectedMemberCase
    value: lower_case
  - key: readability-identifier-naming.ProtectedMemberPrefix
    value: m_
  - key: readability-identifier-naming.PrivateMemberCase
    value: lower_case
  - key: readability-identifier-naming.PrivateMemberPrefix
    value: m_
  - key: readability-identifier-naming.TemplateParameterCase
    value: CamelCase
  # Other coding conventions
  - key: readability-braces-around-statements.ShortStatementLines
    # Allow control-flow statements w/o braces when on a single line
    value: 1

# Treat naming violations as errors
WarningsAsErrors: "readability-identifier-naming"
# Use .clang-format configuration for fixes
FormatStyle: file
