Integration scripts for Clang's Modernize and Tidy tool.

New directory: `scripts/`, in which small scripts for developers reside.

- `modernize`: runs all cpp files through `clang-modernize`, respecting
  out targeted compiler versions, applying C++11 transformations, doing
  syntax checks and formatting --- in parallel.

- `tidy`: runs all cpp files through `clang-tidy`, with selected
  warnings only, since we do not want to warn on every small detail.

Please check the talk slides for `clang-tidy` linked in the references!

References:

- http://clang.llvm.org/extra/clang-tidy/
- http://llvm.org/devmtg/2014-04/PDFs/Talks/clang-tidy%20LLVM%20Euro%202014.pdf
- http://clang.llvm.org/extra/clang-tidy/checks/list.html
- https://github.com/Project-OSRM/osrm-backend/pull/1603
This commit is contained in:
Daniel J. Hofmann
2015-09-11 17:14:36 +02:00
parent aab5092da3
commit 998abf05ba
4 changed files with 17 additions and 1 deletions
+6
View File
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
# Runs the Clang Modernizer in parallel on the code base.
# Requires a compilation database in the build directory.
git ls-files '*.cpp' | xargs -I{} -P $(nproc) clang-modernize -p build -final-syntax-check -format -style=file -summary -for-compilers=clang-3.4,gcc-4.8 -include . -exclude third_party {}
+6
View File
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
# Runs the Clang Tidy Tool in parallel on the code base.
# Requires a compilation database in the build directory.
git ls-files '*.cpp' | grep -v third_party | xargs -I{} -P $(nproc) clang-tidy -p build -header-filter='.*' {}
+21
View File
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
OSMIUM_REPO=https://github.com/osmcode/libosmium.git
OSMIUM_TAG=v2.3.0
VARIANT_REPO=https://github.com/mapbox/variant.git
VARIANT_TAG=v1.0
VARIANT_LATEST=$(curl https://api.github.com/repos/mapbox/variant/releases/latest | jq ".tag_name")
OSMIUM_LATEST=$(curl https://api.github.com/repos/osmcode/libosmium/releases/latest | jq ".tag_name")
echo "Latest osmium release is $OSMIUM_LATEST, pulling in \"$OSMIUM_TAG\""
echo "Latest variant release is $VARIANT_LATEST, pulling in \"$VARIANT_TAG\""
read -p "Looks good? (Y/n) " ok
if [[ $ok =~ [yY] ]]
then
git subtree pull -P third_party/libosmium/ $OSMIUM_REPO $OSMIUM_TAG --squash
git subtree pull -P third_party/variant/ $VARIANT_REPO $VARIANT_TAG --squash
fi