diff --git a/.clang-tidy b/.clang-tidy index 13c03ff6a3..13d05d532d 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -2,25 +2,17 @@ Checks: > -*, bugprone-*, performance-*, - readability-*, - modernize-*, - cppcoreguidelines-*, + modernize-use-nullptr, + modernize-use-override, + modernize-use-auto, + modernize-use-nodiscard, + readability-braces-around-statements, + readability-qualified-auto, + readability-redundant-member-init, + cppcoreguidelines-pro-type-cstyle-cast, -bugprone-easily-swappable-parameters, - -cppcoreguidelines-avoid-magic-numbers, - -cppcoreguidelines-macro-usage, - -cppcoreguidelines-owning-memory, - -cppcoreguidelines-pro-bounds-array-to-pointer-decay, - -cppcoreguidelines-pro-bounds-constant-array-index, - -cppcoreguidelines-pro-bounds-pointer-arithmetic, - -cppcoreguidelines-pro-type-const-cast, - -cppcoreguidelines-pro-type-reinterpret-cast, - -cppcoreguidelines-pro-type-union-access, - -cppcoreguidelines-pro-type-vararg, - -modernize-use-trailing-return-type, - -readability-convert-member-functions-to-static, - -readability-function-cognitive-complexity, - -readability-identifier-length, - -readability-magic-numbers + -bugprone-branch-clone, + -bugprone-signed-char-misuse WarningsAsErrors: '' HeaderFilterRegex: 'src/(main|test)/cpp/net/eagle0/(shardok|common)/.*' FormatStyle: file diff --git a/.github/workflows/bazel_test.yml b/.github/workflows/bazel_test.yml index a025292f39..1e2dad0e36 100644 --- a/.github/workflows/bazel_test.yml +++ b/.github/workflows/bazel_test.yml @@ -12,6 +12,9 @@ on: - '.bazelrc' - 'ci/github_actions/ensure_bazel_installed.sh' - 'ci/github_actions/summarize_bazel_bep.py' + - '.clang-tidy' + - 'scripts/run-clang-tidy.sh' + - 'scripts/check_shardok_clang_tidy.sh' - '.github/actions/setup-bazel/**' - '.github/workflows/bazel_test.yml' - '!src/main/csharp/**' @@ -26,6 +29,9 @@ on: - '.bazelrc' - 'ci/github_actions/ensure_bazel_installed.sh' - 'ci/github_actions/summarize_bazel_bep.py' + - '.clang-tidy' + - 'scripts/run-clang-tidy.sh' + - 'scripts/check_shardok_clang_tidy.sh' - '.github/actions/setup-bazel/**' - '.github/workflows/bazel_test.yml' - '!src/main/csharp/**' @@ -78,6 +84,8 @@ jobs: node-version: 'lts/*' - name: Check JavaScript syntax run: node --check src/main/go/net/eagle0/admin_server/static/map_editor.js + - name: Check Shardok clang-tidy gate + run: ./scripts/check_shardok_clang_tidy.sh test: runs-on: [self-hosted, bazel] diff --git a/scripts/check_shardok_clang_tidy.sh b/scripts/check_shardok_clang_tidy.sh new file mode 100755 index 0000000000..4a4f81edd6 --- /dev/null +++ b/scripts/check_shardok_clang_tidy.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Runs the curated Shardok clang-tidy gate used by CI. +# +# This intentionally checks representative files instead of the whole C++ tree. +# Keep this list low-noise; expand it as cleanup PRs make more areas tidy-clean. + +set -euo pipefail + +repo_root="$(git rev-parse --show-toplevel)" + +files=( + "src/main/cpp/net/eagle0/shardok/library/ActionCost.hpp" + "src/main/cpp/net/eagle0/shardok/library/CombatDamage.hpp" +) + +"$repo_root/scripts/run-clang-tidy.sh" --verify-config + +"$repo_root/scripts/run-clang-tidy.sh" --quiet --warnings-as-errors="*" "${files[@]}" -- -I"$repo_root" -std=c++23