Skip to content

Commit 484b0f0

Browse files
authored
Updating and slightly enhancing instructions for running clang-tidy. (#3055)
* Updating and slightly enhancing instructions for running clang-tidy. * Making documented commands identical to workflow commands. Adding comment in workflow file pointing to documentation.
1 parent dac74eb commit 484b0f0

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

.github/CONTRIBUTING.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -203,14 +203,15 @@ of the pybind11 repo.
203203
[`clang-tidy`][clang-tidy] performs deeper static code analyses and is
204204
more complex to run, compared to `clang-format`, but support for `clang-tidy`
205205
is built into the pybind11 CMake configuration. To run `clang-tidy`, the
206-
following recipe should work. Files will be modified in place, so you can
207-
use git to monitor the changes.
206+
following recipe should work. Run the `docker` command from the top-level
207+
directory inside your pybind11 git clone. Files will be modified in place,
208+
so you can use git to monitor the changes.
208209

209210
```bash
210-
docker run --rm -v $PWD:/pybind11 -it silkeh/clang:10
211-
apt-get update && apt-get install python3-dev python3-pytest
212-
cmake -S pybind11/ -B build -DCMAKE_CXX_CLANG_TIDY="$(which clang-tidy);-fix"
213-
cmake --build build
211+
docker run --rm -v $PWD:/mounted_pybind11 -it silkeh/clang:12
212+
apt-get update && apt-get install -y python3-dev python3-pytest
213+
cmake -S /mounted_pybind11/ -B build -DCMAKE_CXX_CLANG_TIDY="$(which clang-tidy);-fix" -DDOWNLOAD_EIGEN=ON -DDOWNLOAD_CATCH=ON -DCMAKE_CXX_STANDARD=17
214+
cmake --build build -j 2 -- --keep-going
214215
```
215216

216217
### Include what you use

.github/workflows/format.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ jobs:
2525
extra_args: --hook-stage manual --all-files
2626

2727
clang-tidy:
28+
# When making changes here, please also review the "Clang-Tidy" section
29+
# in .github/CONTRIBUTING.md and update as needed.
2830
name: Clang-Tidy
2931
runs-on: ubuntu-latest
3032
container: silkeh/clang:12

0 commit comments

Comments
 (0)