-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prep-work for clang-format. #3078
Conversation
* Inserting clang-format using the same docker container as used for clang-tidy (silkeh/clang:12). * Removing stray semicolons (discovered by running clang-format v12 followed by tools/check-style.sh). * Manually moving `// NOLINT` and `// NOLINTNEXTLINE` comments so that clang-format does not move them to the wrong places. * Manually reformatting comments related to `static_assert`s so that clang-format does not need two passes. * git diff -U0 --no-color HEAD^ | python3 $HOME/clone/llvm-project/clang/tools/clang-format/clang-format-diff.py -p1 -style=file -i
…\endrst` blocks.
… the order and thereby confusing MSVC 2015.
…r the just-merged PR pybind#3080. Also rerunning clang-format-diff.py to pick up a few fixes missed before.
98e451b
to
eb0a55b
Compare
@@ -105,6 +116,7 @@ class object_api : public pyobject_tag { | |||
function will throw a `cast_error` exception. When the Python function | |||
call fails, a `error_already_set` exception is thrown. | |||
\endrst */ | |||
// clang-format on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't disabling reflow_comments be better? Or there may be some of there might be some way to get it to recognize \rst \endrst as off and on clang-format comments.
This one I will basically have to do from scratch after #3087 is done. At that point the only remaining clang-format related question should be how to deal with the |
This PR is obsolete. The only step left to do on top of the merged #3087 is somehow dealing with the |
Prep-work for global clang-format (see experimental/demo PRs #3074, #3082).
NO bulk changes in this PR, just minimal changes such that a global clang-format is stable after a single pass.
This was several hours of tedious work running clang-format & clang-tidy until both are stable. Breaking out as a separate PR so that these manual changes do not have to be maintained separately while we decide how to integrate clang-format or clang-format-diff into the pre-commit hooks.
Notable steps:
Systematically adding
// clang-format off
,on
around all\rst
\endrst
blocks. — Possibly some could be omitted, but for blocks that are deliberately formatted as\rst
it is safer to systematically exclude them from clang-format. Note that the sphinx error messages are often completely useless if something goes wrong, therefore letting clang-format loose on\rst
blocks is likely to turn into time-consuming surprises.Removing stray semicolons (discovered by running clang-format v12 followed by tools/check-style.sh).
Manually moving clang-tidy
// NOLINT
and// NOLINTNEXTLINE
comments so that clang-format does not move them to the wrong places. (This was the most tedious part.)Manually reformatting comments related to
static_assert
s so that clang-format does not need two passes.git diff -U0 --no-color HEAD^ | python3 $HOME/clone/llvm-project/clang/tools/clang-format/clang-format-diff.py -p1 -style=file -i
Suggested changelog entry: