Files
MySensors/.mystools/hooks/pre-commit.sh
T
Bruce Lacey 6a68510d57 Tool bundle updates (#693)
* Pre-commit --cached vs. less-efficient iteration

 * During pre-commit, leverage the git cppcheck --cached
   form instead of iterating over the cached files and
   invoking git cppcheck on each to eliminate
   redundant static analysis

* Add support for Debian Linux on ARM

* Check prerequisite tool minimum versions

 * Bootstrapping will now confirm that each
   prerequisite tool satisfies the minimum version
   required
2016-12-18 11:57:59 +01:00

26 lines
601 B
Bash
Executable File

#!/bin/bash
# instantiate mysensors tool runtime shim
. "$(git mystoolspath).bundle_runtime.sh"
###
# astyle
#
errorsDetected=0
for file in $(stagedSourceFiles); do
git astyle $file >/dev/null
if ! git diff-files --quiet $file >&2; then
warn "$file has been updated to match the MySensors core coding style."
errorsDetected=1
fi
done
[ $errorsDetected == 1 ] && err "Styling updates applied. Review the changes and use 'git add' to update your staged files."
###
# cppcheck
#
git cppcheck --cached || err "Correct the errors until cppcheck passes using 'git cppcheck --cached'."
exit 0