Add script to do code style checks
This script uses uncrustify to detect code style breaks in/around the given SHA diff. There's two ways to use it:
-
check-style.py --sha $SHA
prints in stdout the diffs with the changes suggested to the modifications done between HEAD and $SHA. The default with no --sha specified is HEAD^This is meant for integration in CI, in order to show code style differences, and suggest a set of changes.
-
check-style.py -r
in addition amends the changes in the last commit. This is ideal to rewrite all commits in a branch one by one with the suggested changes, e.g.:$ git rebase origin/master --exec "./check-style -r"
One caveat is that there is per-function granularity in the suggested code changes, so the script might suggest to fix style in unmodified portions of the changed functions.