Skip to content

Updating and slightly enhancing instructions for running clang-tidy. - #3055

Merged
rwgk merged 2 commits into
pybind:masterfrom
rwgk:clang-tidy_contrib_doc_update
Jun 22, 2021
Merged

Updating and slightly enhancing instructions for running clang-tidy.#3055
rwgk merged 2 commits into
pybind:masterfrom
rwgk:clang-tidy_contrib_doc_update

Conversation

@rwgk

@rwgkrwgk commented Jun 22, 2021

Copy link
Copy Markdown
Collaborator

Follow-on to PR #3051 which updated the docker container version in .github/workflows/format.yml but not in the docs.

Minor clarification from where to run the docker command (for docker muggles like myself).

Adding --yes for convenience and --keep-going for engineering productivity.

Tested interactively.

@rwgk

rwgk commented Jun 22, 2021

Copy link
Copy Markdown
CollaboratorAuthor

@Skylion007

@rwgk
rwgk requested a review from henryiiiJune 22, 2021 21:15
apt-get update && apt-get install python3-dev python3-pytest
cmake -S pybind11/ -B build -DCMAKE_CXX_CLANG_TIDY="$(which clang-tidy);-fix"
cmake --build build
docker run --rm -v $PWD:/mounted_pybind11 -it silkeh/clang:12

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works although docker is a little overkill for clang-tidy IMO. 👍

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting a consistent LLVM install on all platforms is not exactly easy. :)

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a centrally managed "workstation" (in the cloud). Stuff I install manually disappears seemingly randomly. The behavior of a docker container is a bit more predictable.

Comment thread.github/CONTRIBUTING.md Outdated
…ment in workflow file pointing to documentation.
@rwgk

rwgk commented Jun 22, 2021

Copy link
Copy Markdown
CollaboratorAuthor

I forgot to mention, the -j 2 is just to tell people "hey you can run this in parallel". That was a question I was uncertain about initially. I think people can take it from there, with the number of the CPUs.

@rwgk

rwgk commented Jun 22, 2021

Copy link
Copy Markdown
CollaboratorAuthor

Thanks Aaron and Henry!
(I spent my afternoon clang-tidy fixing the smart_holder branch. 😅)

@rwgk
rwgk merged commit 484b0f0 into pybind:masterJun 22, 2021
@github-actionsgithub-actionsBot added the needs changelog Possibly needs a changelog entry label Jun 22, 2021
@rwgkrwgk removed the needs changelog Possibly needs a changelog entry label Jun 22, 2021
@rwgk
rwgk deleted the clang-tidy_contrib_doc_update branch June 22, 2021 22:15
@Skylion007

Copy link
Copy Markdown
Collaborator

@rwgk FYI: You can autofix many clang-tidy issues with the following script: https://clang.llvm.org/extra/doxygen/run-clang-tidy_8py_source.html

@rwgkrwgk mentioned this pull request Feb 10, 2023
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@rwgk@Skylion007@henryiii