Added clang-tidy Makefile target

This commit is contained in:
Bartek Kryza
2023-01-17 00:14:35 +01:00
parent bdf55d45b7
commit 57740c0c6c
3 changed files with 27 additions and 2 deletions

1
.gitignore vendored
View File

@@ -19,6 +19,7 @@ bin/
/puml/
/debug/
/release/
/debug_tidy
/.cache
docs/diagrams

View File

@@ -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!

View File

@@ -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 \
@@ -61,10 +61,24 @@ release/CMakeLists.txt:
-DCMAKE_EXE_LINKER_FLAGS="$(CMAKE_EXE_LINKER_FLAGS)" \
-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