Skip to content

Commit

Permalink
Improve sanity check
Browse files Browse the repository at this point in the history
* Use 'git diff --name-only HEAD~1' to list changed files as
  "git show --name-only --format=''" doesn't work for pull requests.
* Add instructions on the installation of a specific version shellcheck.
* Add descriptions for the skipped pycodestyle and shellcheck codes.
* Skip the following shellcheck as 'which' is widely used and supported
  and busybox doesn't support 'command'.

  SC2230: which is non-standard. Use builtin 'command -v' instead.

Signed-off-by: Chase Qi <[email protected]>
  • Loading branch information
chase-qi authored and mwasilew committed Jan 11, 2019
1 parent ef8f6a1 commit 6b5b465
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ python:
- "3.6"

# Pre-installed packages.
# shellcheck 0.5.0
# shellcheck v0.5.0
# Refer to the following link to install specific version shellcheck binary.
# https://github.com/koalaman/shellcheck#installing-the-shellcheck-binary
# php 7.2
install:
- pip install pyyaml pycodestyle
Expand Down
12 changes: 11 additions & 1 deletion sanity-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,14 @@ python3 validate.py \
-g \
-r build-error.txt \
-p E501 \
-s SC1091
-s SC1091 SC2230

# pycodestyle checks skipped:
# E510: line too long

# Shellchecks skipped:
# SC1091: not following

# Reason: 'which' is widely used and supported. And 'command' applets isn't
# available in busybox, refer to https://busybox.net/downloads/BusyBox.html
# SC2230: which is non-standard. Use builtin 'command -v' instead.
2 changes: 1 addition & 1 deletion validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def main(args):
if args.git_latest:
# check if git exists
git_status, git_result = subprocess.getstatusoutput(
"git show --name-only --format=''")
"git diff --name-only HEAD~1")
if git_status == 0:
filelist = git_result.split()
exitcode = run_unit_tests(args, filelist)
Expand Down

0 comments on commit 6b5b465

Please sign in to comment.