summaryrefslogtreecommitdiff
path: root/mesonbuild/scripts/clangformat.py
AgeCommit message (Collapse)Author
2023-02-23clangformat: don't noisily print status messages for every checked fileEli Schwartz
The version lookup should be silent. While we're at it, the version lookup should not be happening more than once, which printing multiple messages indicated we were doing. Pass the version into the per-file function rather than looking it up fresh each time. Fixes https://github.com/mesonbuild/meson/pull/11054#issuecomment-1430169280
2023-02-01treewide: add future annotations importEli Schwartz
2022-12-05on newer versions of clang-format, use builtin --check handlingEli Schwartz
Due to a deficiency in upstream clang-format, our automatic target for `ninja clang-format-check` runs clang-format, then compares the bytes of the file before and after to see if anything changed. If it did change, we rewrite the file back to its original form and error out. Since clang-format 10, there is an option to report warnings instead of writing the reformatted file, and also, to make those warnings fatal. This is a much better user experience, to see *what* is wrong, not just that something is wrong, and also gets rid of a pretty gross "modify your files when you didn't ask for it" behavior that is vulnerable to getting interrupted. Let's switch over to the new approach, if we can.
2021-11-14Share common code between clang tidy and formatXavier Claessens
2021-10-10clangformat: Only format files tracked by git by defaultXavier Claessens
2021-10-04various python neatness cleanupsEli Schwartz
All changes were created by running "pyupgrade --py3-only" and committing the results. Although this has been performed in the past, newer versions of pyupgrade can automatically catch more opportunities, notably list comprehensions can use generators instead, in the following cases: - unpacking into function arguments as function(*generator) - unpacking into assignments of the form x, y = generator - as the argument to some builtin functions such as min/max/sorted Also catch a few creeping cases of new code added using older styles.
2021-07-05use modern set syntaxEli Schwartz
In one place, we reintroduced old set syntax after having initially cleaned it up everywhere via commit 4340bf34faca7eed8076ba4c388fbe15355f2183
2021-05-01Do not accidentally format files when only checking if they are formatted.Jussi Pakkanen
2021-03-16clangformat: Add clang-format-check targetXavier Claessens
2021-03-16clangformat: Add include and ignore filesXavier Claessens
2020-11-17Collect and return clang-format's return codeFlorian Schmaus
There is no reason why meson should swallow any non-zero exit(/return) code of clang-format.
2020-10-05Never run clang-format / clang-tidy against directoriesBernd Busse
`pathlib.Path.glob()` also returns directories that match source filenames (i.e. a directory named `test.h/`), but `clang-format` and `clang-tidy` fail when handed a directory. We manually skip calling `clang-format` and `clang-tidy` on those directories.
2020-09-08typing: fully annotate scriptsDaniel Mensinger
2019-09-29Find clang-format with alternative namesTing-Wei Lan
This is similar to what we currently do for scan-build except there is no environment variable to choose a specific clang-format to run. If an environment variable is needed for better control, we can add it later.
2019-04-01Also format headers with Clang-Format. Closes #5184.Jussi Pakkanen
2018-12-30Add a clang-format target.Jussi Pakkanen