Skip to content

Report *.sh shellcheck errors in current folder and all subfolders

License

Notifications You must be signed in to change notification settings

izenkov/shellcheck-report

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

shellcheck-report

Reports *.sh shellcheck issues in folder and all subfolders

shellcheck-report scans all *.sh script files in specified folder and all it's subfolders recursively. It then calls shellcheck utility on script content and outputs a number of issues found.

Dependencies

Install / Uninstall

Linux, macOS

./install
./uninstall

On macOS, if you are still running Bash 3.2 written in 2007 shellcheck-report will not run. You have two options. The recomended way would be upgrading to the latest Bash version using Homebrew or Macports package managers. Second option would be backporting shellcheck-report to Bash 3.2 or porting to a different shell (zsh for example). Here is the link to Homebrew based utility for upgrading macOS Bash to the latest version and setting upgraded Bash as default login shell.

Windows Git Bash Terminal

rem Execute from Command Prompt running as Administrator
copy shellcheck-report "%ProgramFiles%\Git\usr\bin"

After that shellcheck-report will be visible in /usr/bin folder inside Git Bash Terminal. And because /usr/bin is in $PATH shellcheck-report can be executed without specifing full path name.

If you get an error

shellcheck (www.shellcheck.net) not found

Download shellcheck.exe and drop it into the same location.

rem Execute from Command Prompt running as Administrator
copy shellcheck.exe "%ProgramFiles%\Git\usr\bin"

Usage

shellcheck-report <dir>[:<depth>]
shellcheck-report -0 <dir>[:<depth>]
shellcheck-report -c <dir>[:<depth>]
shellcheck-report -q <dir>[:<depth>]
shellcheck-report -v
shellcheck-report -h

Where:

  • dir Folder to scan
  • depth Scan depth (current folder: 1, default: 64)
  • -0 Exclude 0 errors scripts
  • -c Print error count
  • -q Quiet, return exit code
  • -v Version
  • -h Help

Show help screen

shellcheck-report -h

Show version information

shellcheck-report -v

Scan folder

shellcheck-report .
shellcheck-report ./scripts
shellcheck-report ~/dev

Scan folder (non recursive)

shellcheck-report .:1
shellcheck-report ./scripts:1
shellcheck-report ~/dev:1

Scan folder, option -0 (exclude files with 0 errors)

shellcheck-report -0 .
shellcheck-report -0 ./scripts
shellcheck-report -0 ~/dev

Scan folder, option -c (print total errors found)

shellcheck-report -c .
shellcheck-report -c ./scripts
shellcheck-report -c ~/dev

Scan folder, option -q (quiet, return exit code)

shellcheck-report -q .
shellcheck-report -q ./scripts
shellcheck-report -q ~/dev

Example report

shellcheck-report 1.0.5 Jan 22, 2022

re2c-2.2

  3 ./build/__build_asan.sh
  5 ./build/__cmakebuild_check_headers.sh
  3 ./build/__cmakebuild_redundant_exports.sh
  3 ./build/__build_ubsan.sh
  3 ./build/__cmakebuild.sh
  3 ./build/__cmakebuild_glibcxx_debug.sh
  3 ./build/__cmakebuild_iwyu.sh
  3 ./build/__cmakebuild_clang_msan.sh
  3 ./build/__build_redundant_exports.sh
  3 ./build/__cmakebuild_mingw.sh
  3 ./build/__cmakebuild_clang.sh
  3 ./build/__cmakebuild_ubsan.sh
  3 ./build/__build_m32.sh
  5 ./build/__build_check_headers.sh
  2 ./build/re2c-as-subproject/build.sh
  3 ./build/__build_mingw.sh
  3 ./build/__build_clang.sh
  1 ./build/split_man.sh
  3 ./build/__build_mingw_slibtool.sh
  3 ./build/__cmakebuild_nodebug.sh
  4 ./build/__alltest.sh
  2 ./build/__build_iwyu.sh
  3 ./build/__cmakebuild_m32.sh
  3 ./build/__cmakebuild_asan.sh
  3 ./build/__build.sh
  3 ./build/__build_glibcxx_debug.sh
  0 ./build/gen_help.sh
  3 ./build/__build_clang_msan.sh
  9 ./build/__distcheck.sh
  3 ./build/__build_nodebug.sh
 16 ./examples/c/__run_all.sh
 10 ./examples/go/__run_all.sh
  0 ./built-and-install.sh
711 ./ltmain.sh
  0 ./autogen.sh
  9 ./test/__run_unicode_tests.sh
 14 ./test/golang/__run_all.sh
 10 ./test/posix_captures/.gen/__gen.sh
 24 ./test/posix_captures/.run/__run.sh
711 ./build-aux/ltmain.sh

1599 issues in 40 *.sh files

Exit codes (-q option)

  • 0: All files successfully scanned with no issues.
  • 1: All files successfully scanned with some issues.
  • 3: Bad syntax or options

References

License

MIT

About

Report *.sh shellcheck errors in current folder and all subfolders

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages