From c35ba68ac055c85ee762f5f516eb1569e4199f9e Mon Sep 17 00:00:00 2001 From: thk123 Date: Wed, 11 Jan 2017 11:48:53 +0000 Subject: [PATCH 1/2] Don't error if no errors are found Previously, as we had set -e enabled, the final grep (filtering relevant errors) would fail if there were no errors to find. This failure was causing the script to exit with an error code (causing the CI to think the lint had failed). Now we ignore whether the grep fails or not. --- scripts/run_lint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/run_lint.sh b/scripts/run_lint.sh index 3234e9bfe98..10eafa9a763 100755 --- a/scripts/run_lint.sh +++ b/scripts/run_lint.sh @@ -74,7 +74,7 @@ for file in $diff_files; do # Run the linting script and filter by the filter we've build # of all the modified lines # The errors from the linter go to STDERR so must be redirected to STDOUT - result=`python scripts/cpplint.py $file 2>&1 | grep -E "$lint_grep_filter"` + result=`python scripts/cpplint.py $file 2>&1 | { grep -E "$lint_grep_filter" || true; }` # Providing some errors were relevant we print them out if [ "$result" ] From 4120cddbd1e2f0ba926803e897b4ab1f00917ffa Mon Sep 17 00:00:00 2001 From: thk123 Date: Wed, 11 Jan 2017 11:49:24 +0000 Subject: [PATCH 2/2] Detect missing cpplint.py file If the linting python script is missing, this script fails with a useful message. --- scripts/run_lint.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/run_lint.sh b/scripts/run_lint.sh index 10eafa9a763..f2f1a41d811 100755 --- a/scripts/run_lint.sh +++ b/scripts/run_lint.sh @@ -12,6 +12,13 @@ then exit 1 fi +if ! [[ -e scripts/cpplint.py ]] +then + echo "Lint script could not be found in the scripts directory" + echo "Ensure cpplint.py is inside the scripts directory then run again" + exit 1 +fi + git_start=$1 git_end=$2