Pull request 616: lint-cpp: switch to clangd-tidy and drop *-magic-numbers

Squashed commit of the following:

commit 542ff3c79526154aedd899f870e3d2b3c415844c
Author: Zhavoronkov Aleksei <a.zhavoronkov@adguard.com>
Date:   Thu Feb 5 17:51:04 2026 +0300

    lint-cpp: switch to clangd-tidy and drop *-magic-numbers
    
    Disable *-magic-numbers check because it takes a significant amount of time and no one actually uses it.
    Use clangd-tidy (https://github.com/lljbash/clangd-tidy) instead of clang-tidy in lint-cpp to speed up checks.
    
    Signed-off-by: Zhavoronkov Aleksei <a.zhavoronkov@adguard.com>
This commit is contained in:
Aleksei Zhavoronkov
2026-02-06 08:25:40 +00:00
parent 286ba7fe82
commit d156caca6a
6 changed files with 26 additions and 3 deletions
+3 -1
View File
@@ -101,7 +101,9 @@ Checks: >-
-cppcoreguidelines-use-enum-class,
-portability-template-virtual-member-function,
-modernize-use-integer-sign-comparison,
-misc-const-correctness
-misc-const-correctness,
-cppcoreguidelines-avoid-magic-numbers,
-readability-magic-numbers
WarningsAsErrors: '*'
+8
View File
@@ -0,0 +1,8 @@
CompileFlags:
# TODO: Remove when https://github.com/clangd/clangd/issues/1167 will be fixed
Add: [-Wno-unknown-pragmas]
Diagnostics:
# Available in clangd-14
UnusedIncludes: None
# Requires clangd-17
MissingIncludes: None
+2
View File
@@ -35,6 +35,7 @@ jobs:
- name: Install packages
run: |
sudo apt install -y ninja-build
pip install -r requirements.txt
pip install conan~=$CONAN_VER
pip install clang-format~=$CLANG_FORMAT_VER
## Install LLVM
@@ -130,6 +131,7 @@ jobs:
- name: Install packages
run: |
brew install ninja llvm@21
pip install -r requirements.txt
pip install conan~=$CONAN_VER
pip install clang-format~=$CLANG_FORMAT_VER
echo "/opt/homebrew/opt/llvm@21/bin" >> $GITHUB_PATH
+11 -2
View File
@@ -13,6 +13,7 @@ ifeq ($(origin MSVC_YEAR), undefined)
endif
endif
BUILD_DIR = build
COMPILE_COMMANDS = $(BUILD_DIR)/compile_commands.json
EXPORT_DIR ?= bin
SETUP_WIZARD_DIR = trusttunnel/setup_wizard
@@ -101,7 +102,7 @@ lint: lint-md lint-rust lint-cpp
## Lint c++ files.
.PHONY: lint-cpp
lint-cpp: clang-format clang-tidy
lint-cpp: clang-format clangd-tidy
## Check c++ code formatting with clang-format.
.PHONY: clang-format
@@ -113,7 +114,15 @@ clang-format:
## Check c++ code formatting with clang-tidy.
.PHONY: clang-tidy
clang-tidy: compile_commands
run-clang-tidy -p $(BUILD_DIR) '^(?!.*(/third-party/)).*\.cpp$$'
run-clang-tidy -p $(BUILD_DIR) -config-file='.clang-tidy' '^(?!.*(/third-party/)).*\.cpp$$'
## Check c++ code formatting with clangd-tidy.
.PHONY: clangd-tidy
clangd-tidy: compile_commands
jq -r '.[] | select(.file | endswith(".cpp")) | .file' $(COMPILE_COMMANDS) \
| grep -vE '(^|/)(third-party)(/|$$)' \
| sort -u \
| xargs clangd-tidy -p $(BUILD_DIR)
## Lint markdown files.
## `markdownlint-cli` should be installed:
+1
View File
@@ -40,6 +40,7 @@ Run tests on Linux:
- |-
set -x -e
python3 -m pip install -r requirements.txt
python3 -m pip install conan --upgrade
conan remote add --index 0 art ${bamboo.conanRepoUrl} || true
+1
View File
@@ -1 +1,2 @@
pyyaml==6.0.3
clangd-tidy