mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-08-08 08:13:56 +08:00
Add support for .shellcheckrc
files
This commit is contained in:
@@ -63,6 +63,10 @@ not warn at all, as `ksh` supports decimals in arithmetic contexts.
|
||||
standard output. Subsequent **-f** options are ignored, see **FORMATS**
|
||||
below for more information.
|
||||
|
||||
**--norc**
|
||||
|
||||
: Don't try to look for .shellcheckrc configuration files.
|
||||
|
||||
**-S**\ *SEVERITY*,\ **--severity=***severity*
|
||||
|
||||
: Specify minimum severity of errors to consider. Valid values are *error*,
|
||||
@@ -192,6 +196,31 @@ Valid keys are:
|
||||
files meant to be included (and thus lacking a shebang), or possibly
|
||||
as a more targeted alternative to 'disable=2039'.
|
||||
|
||||
# RC FILES
|
||||
Unless `--norc` is used, ShellCheck will look for a file `.shellcheckrc` or
|
||||
`shellcheckrc` in the script's directory and each parent directory. If found,
|
||||
it will read `key=value` pairs from it and treat them as file-wide directives.
|
||||
|
||||
Here is an example `.shellcheckrc`:
|
||||
|
||||
# Don't suggest using -n in [ $var ]
|
||||
disable=SC2244
|
||||
|
||||
# Allow using `which` since it gives full paths and is common enough
|
||||
disable=SC2230
|
||||
|
||||
If no `.shellcheckrc` is found in any of the parent directories, ShellCheck
|
||||
will look in `~/.shellcheckrc` followed by the XDG config directory
|
||||
(usually `~/.config/shellcheckrc`) on Unix, or %APPDATA%/shellcheckrc` on
|
||||
Windows. Only the first file found will be used.
|
||||
|
||||
Note for Snap users: the Snap sandbox disallows access to hidden files.
|
||||
Use `shellcheckrc` without the dot instead.
|
||||
|
||||
Note for Docker users: ShellCheck will only be able to look for files that
|
||||
are mounted in the container, so `~/.shellcheckrc` will not be read.
|
||||
|
||||
|
||||
# ENVIRONMENT VARIABLES
|
||||
The environment variable `SHELLCHECK_OPTS` can be set with default flags:
|
||||
|
||||
|
Reference in New Issue
Block a user