From 21a0502972eb08620b810a9806aaa0c976715293 Mon Sep 17 00:00:00 2001 From: Fazle Arefin Date: Wed, 13 Mar 2024 03:52:57 +1100 Subject: [PATCH] shellcheck: edit page (#12491) * shellcheck: edit page * shellcheck: simplify description * Update pages/common/shellcheck.md Co-authored-by: Lena <126529524+acuteenvy@users.noreply.github.com> * Update pages/common/shellcheck.md Co-authored-by: Vitor Henrique <87824454+vitorhcl@users.noreply.github.com> * Update pages/common/shellcheck.md Co-authored-by: Vitor Henrique <87824454+vitorhcl@users.noreply.github.com> --------- Co-authored-by: Vitor Henrique <87824454+vitorhcl@users.noreply.github.com> Co-authored-by: Lena <126529524+acuteenvy@users.noreply.github.com> --- pages/common/shellcheck.md | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/pages/common/shellcheck.md b/pages/common/shellcheck.md index 538a2dd69..e0dadf2f0 100644 --- a/pages/common/shellcheck.md +++ b/pages/common/shellcheck.md @@ -1,33 +1,36 @@ # shellcheck -> Shell script static analysis tool. -> Check shell scripts for errors, usage of deprecated/insecure features, and bad practices. -> More information: . +> Statically check shell scripts for errors, usage of deprecated/insecure features, and bad practices. +> More information: . - Check a shell script: `shellcheck {{path/to/script.sh}}` -- Check a shell script interpreting it as the specified shell dialect (overrides the shebang at the top of the script): +- Check a shell script interpreting it as the specified [s]hell dialect (overrides the shebang at the top of the script): `shellcheck --shell {{sh|bash|dash|ksh}} {{path/to/script.sh}}` -- Ignore one or more error types: +- Ignor[e] one or more error types: -`shellcheck --exclude {{SC1009,SC1073}} {{path/to/script.sh}}` +`shellcheck --exclude {{SC1009,SC1073,...}} {{path/to/script.sh}}` - Also check any sourced shell scripts: `shellcheck --check-sourced {{path/to/script.sh}}` -- Display output in the specified format (defaults to `tty`): +- Display output in the specified [f]ormat (defaults to `tty`): `shellcheck --format {{tty|checkstyle|diff|gcc|json|json1|quiet}} {{path/to/script.sh}}` -- Enable one or more optional checks: +- Enable one or more [o]ptional checks: -`shellcheck --enable={{add-default-case|avoid-nullary-conditions}}` +`shellcheck --enable {{add-default-case,avoid-nullary-conditions,...}} {{path/to/script.sh}}` - List all available optional checks that are disabled by default: `shellcheck --list-optional` + +- Adjust the level of [S]everity to consider (defaults to `style`): + +`shellcheck --severity {{error|warning|info|style}} {{path/to/script.sh}}`