ci: fix up .clang-tidy and related files (#3236)

* chore: remove clang-tidy deprecated option

* fix: lint and update workflow related items

* clang-format and clang-tidy fixes for 2aa6797d

* ci: add issues write to approved-label

* chore: remove file formatter

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
realstealthninja
2026-09-30 15:06:11 +05:30
committed by GitHub
parent b3ba9f48b5
commit b64d5ecd02
4 changed files with 24 additions and 10 deletions

View File

@@ -1,6 +1,5 @@
---
Checks: '-*,google-*,clang-analyzer-*,-clang-analyzer-security.insecureAPI.*,cppcoreguidelines-*,-cppcoreguidelines-avoid-magic-numbers,-cppcoreguidelines-pro-bounds-*,openmp-*,performance-*,portability-*,modernize-*,-modernize-use-trailing-*'
WarningsAsErrors: '*,-google-readability-*,-google-explicit-constructor,-modernize-*,modernize-avoid-c-arrays,-performance-move-const-arg,-performance-noexcept-move-constructor,-performance-unnecessary-value-param,-cppcoreguidelines-init-variables,-cppcoreguidelines-pro-*,-cppcoreguidelines-owning-memory,-clang-analyzer-cplusplus.Move'
HeaderFilterRegex: ''
AnalyzeTemporaryDtors: false
FormatStyle: '{ BasedOnStyle: Google, UseTab: Never, IndentWidth: 4, TabWidth: 4, AllowShortIfStatementsOnASingleLine: false, IndentCaseLabels: true, ColumnLimit: 80, AccessModifierOffset: -3, AlignConsecutiveMacros: true }'
Checks: "-*,google-*,clang-analyzer-*,-clang-analyzer-security.insecureAPI.*,cppcoreguidelines-*,-cppcoreguidelines-avoid-magic-numbers,-cppcoreguidelines-pro-bounds-*,openmp-*,performance-*,portability-*,modernize-*,-modernize-use-trailing-*"
WarningsAsErrors: "*,-google-readability-*,-google-explicit-constructor,-modernize-*,modernize-avoid-c-arrays,-performance-move-const-arg,-performance-noexcept-move-constructor,-performance-unnecessary-value-param,-cppcoreguidelines-init-variables,-cppcoreguidelines-pro-*,-cppcoreguidelines-owning-memory,-clang-analyzer-cplusplus.Move"
HeaderFilterRegex: ""
FormatStyle: "{ BasedOnStyle: Google, UseTab: Never, IndentWidth: 4, TabWidth: 4, AllowShortIfStatementsOnASingleLine: false, IndentCaseLabels: true, ColumnLimit: 80, AccessModifierOffset: -3, AlignConsecutiveMacros: true }"

View File

@@ -2,6 +2,8 @@ on: pull_request_review
name: Add "approved" label when approved
permissions:
pull-requests: write
issues: write
jobs:
add_label:
name: Add "approved" label when approved

View File

@@ -9,7 +9,7 @@ jobs:
name: Code Formatter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: actions/setup-python@v4

View File

@@ -5,15 +5,28 @@ import sys
print("Python {}.{}.{}".format(*sys.version_info)) # Python 3.8
with open("git_diff.txt") as in_file:
modified_files = sorted(in_file.read().splitlines())
print("{} files were modified.".format(len(modified_files)))
print(f"{len(modified_files)} files were modified.")
cpp_exts = tuple(".c .c++ .cc .cpp .cu .cuh .cxx .h .h++ .hh .hpp .hxx".split())
cpp_exts = (
".c",
".c++",
".cc",
".cpp",
".cu",
".cuh",
".cxx",
".h",
".h++",
".hh",
".hpp",
".hxx",
)
cpp_files = [file for file in modified_files if file.lower().endswith(cpp_exts)]
print(f"{len(cpp_files)} C++ files were modified.")
if not cpp_files:
sys.exit(0)
subprocess.run(
_ = subprocess.run(
[
"clang-tidy",
"--fix",
@@ -26,7 +39,7 @@ with open("git_diff.txt") as in_file:
text=True,
stderr=subprocess.STDOUT,
)
subprocess.run(
_ = subprocess.run(
["clang-format", "-i", "-style=file", *cpp_files],
check=True,
text=True,