diff options
author | Kurtis Rader <krader@skepticism.us> | 2016-04-12 18:32:20 -0700 |
---|---|---|
committer | Kurtis Rader <krader@skepticism.us> | 2016-04-12 18:32:20 -0700 |
commit | 6431c0de16937622a2664c417f517d002220e017 (patch) | |
tree | f686ce8e98ffa1fdf82afb8da6bffd68ff1f6da6 /build_tools | |
parent | 85799ee86ee18915e79d2ae8cf3f23f504249d89 (diff) |
fix bug in lint.fish helper script
I just noticed that depending on the state of your working tree there can be
one or more spaces after the modification token and the file name. If there is
more than one space that causes the `string split` to produce unexpected
output.
Diffstat (limited to 'build_tools')
-rwxr-xr-x | build_tools/lint.fish | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/build_tools/lint.fish b/build_tools/lint.fish index 7182322f..9585d4e6 100755 --- a/build_tools/lint.fish +++ b/build_tools/lint.fish @@ -34,13 +34,8 @@ if test $all = yes else # We haven't been asked to lint all the source. If there are uncommitted # changes lint those, else lint the files in the most recent commit. - set pending (git status --porcelain --short --untracked-files=all | sed -e 's/^ *//') - if set -q pending[1] - # There are pending changes so lint those files. - for arg in $pending - set files $files (string split -m 1 ' ' $arg)[2] - end - else + set files (git status --porcelain --short --untracked-files=all | sed -e 's/^ *[^ ]* *//') + if not set -q files[1] # No pending changes so lint the files in the most recent commit. set files (git show --word-diff=porcelain --name-only --pretty=oneline head)[2..-1] end @@ -56,10 +51,9 @@ if set -q c_files[1] echo ======================================== echo Running cppcheck echo ======================================== - # The stderr to stdout redirection is because cppcheck, incorrectly - # IMHO, writes its diagnostic messages to stderr. Anyone running - # this who wants to capture its output will expect those messages to be - # written to stdout. + # The stderr to stdout redirection is because cppcheck, incorrectly IMHO, writes its + # diagnostic messages to stderr. Anyone running this who wants to capture its output will + # expect those messages to be written to stdout. cppcheck -q --verbose --std=posix --std=c11 --language=c++ --template "[{file}:{line}]: {severity} ({id}): {message}" --suppress=missingIncludeSystem --inline-suppr --enable=$cppchecks $cppcheck_args $c_files 2>& 1 end @@ -68,10 +62,9 @@ if set -q c_files[1] echo ======================================== echo Running oclint echo ======================================== - # The stderr to stdout redirection is because oclint, incorrectly - # writes its final summary counts of the errors detected to stderr. - # Anyone running this who wants to capture its output will expect those - # messages to be written to stdout. + # The stderr to stdout redirection is because oclint, incorrectly writes its final summary + # counts of the errors detected to stderr. Anyone running this who wants to capture its + # output will expect those messages to be written to stdout. if test (uname -s) = "Darwin" if not test -f compile_commands.json xcodebuild > xcodebuild.log |