From 4a02b26fb0b27a899d8ecc9c3ed00ecf2899c689 Mon Sep 17 00:00:00 2001 From: Andrew Hamilton Date: Wed, 13 Dec 2017 19:15:26 +1000 Subject: [PATCH] tools: Added shellcheck for bash, sh, dash or ksh files. --- README.md | 1 + TODO | 2 +- vigil/tools.py | 8 +++++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7ae3596..ae88229 100644 --- a/README.md +++ b/README.md @@ -41,3 +41,4 @@ Extensions | Tools .tar.bz2 | [tar_bz2](http://www.gnu.org/software/tar/manual/tar.html) .a .so | [nm](https://linux.die.net/man/1/nm) .png .jpg .gif .bmp .ppm .tiff .tga | [pil](http://python-pillow.github.io/) • [pil_half](http://python-pillow.github.io/) +.bash .sh .dash .ksh | [shellcheck](http://hackage.haskell.org/package/ShellCheck) diff --git a/TODO b/TODO index c75bf98..043e691 100644 --- a/TODO +++ b/TODO @@ -6,7 +6,6 @@ Todo (tool related) - Report on python doctests. (also coverage of) - Cache tools._python_version. - Colourise git_diff. -- Add shellcheck tool for shell scripts. Done @@ -166,6 +165,7 @@ Done - Add bandit tool for python. - Created a setup.py file. - Add cppcheck tool for C and C++. +- Add shellcheck tool for shell scripts. A-syntax, B-tests, C-auto docs, D-lint, E-coverage, F-profile, G-tidy, H-import deps A B C D E F G H diff --git a/vigil/tools.py b/vigil/tools.py index d724514..f5011d3 100644 --- a/vigil/tools.py +++ b/vigil/tools.py @@ -675,6 +675,11 @@ def pil_half(path): return Status.normal, result +@deps(deps={"shellcheck"}, url="shellcheck", executables={"shellcheck"}) +def shellcheck(path): + return _run_command(["shellcheck", path]) + + @deps(deps={"git"}, url="git", executables={"git"}) def git_blame(path): # FIX: Add to tools_test.py stdout, stderr, returncode = _do_command( @@ -830,7 +835,8 @@ TOOLS_FOR_EXTENSIONS = \ (["tar.gz", "tgz"], [tar_gz]), (["tar.bz2"], [tar_bz2]), (["a", "so"], [nm]), - (IMAGE_EXTENSIONS, [pil, pil_half]) + (IMAGE_EXTENSIONS, [pil, pil_half]), + (["bash", "sh", "dash", "ksh"], [shellcheck]) ]