diff options
author | Gil <mcg@google.com> | 2018-01-17 10:02:42 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-17 10:02:42 -0800 |
commit | 128e9cb170b28bbff0284610276b0e4e517f576e (patch) | |
tree | b099fb193584bcb14aac892774b75920939f08b0 /scripts/style.sh | |
parent | df71c9ad8c2751672b8ae85915cc7f74f3db08c8 (diff) |
Fix C++ lint errors (#668)
* Misc style.sh fixes
* Allow test-only to use a revision; to check your changes since
master:
./scripts/style.sh test-only master
* Avoid diffing deleted files
* 80 columns
* Fix C++ lint errors
Diffstat (limited to 'scripts/style.sh')
-rwxr-xr-x | scripts/style.sh | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/scripts/style.sh b/scripts/style.sh index 116c872..96255f9 100755 --- a/scripts/style.sh +++ b/scripts/style.sh @@ -30,16 +30,17 @@ fi if [[ $# -gt 0 && "$1" = "test-only" ]]; then test_only=true options="-output-replacements-xml" + shift else test_only=false options="-i" fi ( - if [[ "$test_only" = false && $# -gt 0 ]]; then + if [[ $# -gt 0 ]]; then if git rev-parse "$1" -- >& /dev/null; then # Argument was a branch name show files changed since that branch - git diff --name-only --relative "$1" + git diff --name-only --relative --diff-filter=ACMR "$1" else # Otherwise assume the passed things are files or directories find "$@" -type f @@ -68,9 +69,11 @@ fi # Format C-ish sources only \%\.(h|m|mm|cc)$% p -' | xargs clang-format -style=file $options | grep "<replacement " > /dev/null +' | xargs clang-format -style=file $options \ + | grep "<replacement " > /dev/null if [[ "$test_only" = true && $? -ne 1 ]]; then - echo "Proposed commit is not style compliant. Run scripts/style.sh and git add the result." + echo "Proposed commit is not style compliant." + echo "Run scripts/style.sh and git add the result." exit 1 fi |