Commit 484b0f04 by Ralf W. Grosse-Kunstleve Committed by GitHub

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.
parent dac74ebd
...@@ -203,14 +203,15 @@ of the pybind11 repo. ...@@ -203,14 +203,15 @@ of the pybind11 repo.
[`clang-tidy`][clang-tidy] performs deeper static code analyses and is [`clang-tidy`][clang-tidy] performs deeper static code analyses and is
more complex to run, compared to `clang-format`, but support for `clang-tidy` more complex to run, compared to `clang-format`, but support for `clang-tidy`
is built into the pybind11 CMake configuration. To run `clang-tidy`, the is built into the pybind11 CMake configuration. To run `clang-tidy`, the
following recipe should work. Files will be modified in place, so you can following recipe should work. Run the `docker` command from the top-level
use git to monitor the changes. directory inside your pybind11 git clone. Files will be modified in place,
so you can use git to monitor the changes.
```bash ```bash
docker run --rm -v $PWD:/pybind11 -it silkeh/clang:10 docker run --rm -v $PWD:/mounted_pybind11 -it silkeh/clang:12
apt-get update && apt-get install python3-dev python3-pytest apt-get update && apt-get install -y python3-dev python3-pytest
cmake -S pybind11/ -B build -DCMAKE_CXX_CLANG_TIDY="$(which clang-tidy);-fix" cmake -S /mounted_pybind11/ -B build -DCMAKE_CXX_CLANG_TIDY="$(which clang-tidy);-fix" -DDOWNLOAD_EIGEN=ON -DDOWNLOAD_CATCH=ON -DCMAKE_CXX_STANDARD=17
cmake --build build cmake --build build -j 2 -- --keep-going
``` ```
### Include what you use ### Include what you use
......
...@@ -25,6 +25,8 @@ jobs: ...@@ -25,6 +25,8 @@ jobs:
extra_args: --hook-stage manual --all-files extra_args: --hook-stage manual --all-files
clang-tidy: clang-tidy:
# When making changes here, please also review the "Clang-Tidy" section
# in .github/CONTRIBUTING.md and update as needed.
name: Clang-Tidy name: Clang-Tidy
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: silkeh/clang:12 container: silkeh/clang:12
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment