diff --git a/.gitignore b/.gitignore index d4b8e02b..fdd98960 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,7 @@ bin/ /puml/ /debug/ /release/ +/debug_tidy /.cache docs/diagrams diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index dbba552f..427a280d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -64,6 +64,11 @@ Thanks for taking interest in `clang-uml`! make format git add . && git commit -m "Fixed formatting" ``` +* Make sure the code doesn't introduce any `clang-tidy` warnings: + ```bash + make tidy + ``` + * Create a pull request from your branch to `master` branch ## If you would like to add a feature @@ -79,6 +84,7 @@ Thanks for taking interest in `clang-uml`! * 80-character line width * snakes over camels * use `make format` before submitting PR to ensure consistent formatting + * use `make tidy` to check if your code doesn't introduce any `clang-tidy` warnings * Add test case (or multiple test cases), which cover the new feature * Finally, create a pull request! diff --git a/Makefile b/Makefile index d9088428..c83f3e4d 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ GIT_BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD) .PHONY: clean clean: - rm -rf debug release + rm -rf debug release debug_tidy debug/CMakeLists.txt: cmake -S . -B debug \ @@ -59,12 +59,26 @@ release/CMakeLists.txt: -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_CXX_FLAGS="$(CMAKE_CXX_FLAGS)" \ -DCMAKE_EXE_LINKER_FLAGS="$(CMAKE_EXE_LINKER_FLAGS)" \ - -DLLVM_VERSION=${LLVM_VERSION} + -DLLVM_VERSION=${LLVM_VERSION} + +debug_tidy/CMakeLists.txt: + cmake -S . -B debug_tidy \ + -DGIT_VERSION=$(GIT_VERSION) \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -DCMAKE_BUILD_TYPE=Debug \ + -DBUILD_TESTS=OFF \ + -DCMAKE_CXX_FLAGS="$(CMAKE_CXX_FLAGS)" \ + -DCMAKE_EXE_LINKER_FLAGS="$(CMAKE_EXE_LINKER_FLAGS)" \ + -DLLVM_VERSION=${LLVM_VERSION} debug: debug/CMakeLists.txt echo "Using ${NUMPROC} cores" make -C debug -j$(NUMPROC) +debug_tidy: debug_tidy/CMakeLists.txt + echo "Using ${NUMPROC} cores" + make -C debug_tidy -j$(NUMPROC) + release: release/CMakeLists.txt make -C release -j$(NUMPROC) @@ -106,6 +120,10 @@ clang-format: format: docker run --rm -v $(CURDIR):/root/sources bkryza/clang-format-check:1.3 +.PHONY: debug_tidy +tidy: debug_tidy + run-clang-tidy-12 -p debug_tidy ./src + .PHONY: check-formatting check-formatting: ./util/check_formatting.sh