This commit is contained in:
Olliver Schinagl 2022-07-26 11:16:44 +02:00 committed by GitHub
commit f0f3ab4ba0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 1 deletions

View file

@ -21,6 +21,7 @@
## v0.8.0 - 2021-11-06 ## v0.8.0 - 2021-11-06
### Added ### Added
- `color=` directive can be added to .shellceckrc
- `disable=all` now conveniently disables all warnings - `disable=all` now conveniently disables all warnings
- `external-sources=true` directive can be added to .shellcheckrc to make - `external-sources=true` directive can be added to .shellcheckrc to make
shellcheck behave as if `-x` was specified. shellcheck behave as if `-x` was specified.

View file

@ -41,7 +41,10 @@ not warn at all, as `ksh` supports decimals in arithmetic contexts.
: For TTY output, enable colors *always*, *never* or *auto*. The default : For TTY output, enable colors *always*, *never* or *auto*. The default
is *auto*. **--color** without an argument is equivalent to is *auto*. **--color** without an argument is equivalent to
**--color=always**. **--color=auto**.
This option may also be enabled using `color=` in
`.shellcheckrc`. This flag takes precedence.
**-i**\ *CODE1*[,*CODE2*...],\ **--include=***CODE1*[,*CODE2*...] **-i**\ *CODE1*[,*CODE2*...],\ **--include=***CODE1*[,*CODE2*...]
@ -232,6 +235,10 @@ Here a shell brace group is used to suppress a warning on multiple lines:
Valid keys are: Valid keys are:
**color**
: Set to `auto`, `never` or `always` in `.shellcheckrc` to automatically
detect, never or always use color output with the `tty` output format.
**disable** **disable**
: Disables a comma separated list of error codes for the following command. : Disables a comma separated list of error codes for the following command.
The command can be a simple command like `echo foo`, or a compound command The command can be a simple command like `echo foo`, or a compound command
@ -277,6 +284,9 @@ it will read `key=value` pairs from it and treat them as file-wide directives.
Here is an example `.shellcheckrc`: Here is an example `.shellcheckrc`:
# Always force color output on the tty output
color=always
# Look for 'source'd files relative to the checked script, # Look for 'source'd files relative to the checked script,
# and also look for absolute paths in /mnt/chroot # and also look for absolute paths in /mnt/chroot
source-path=SCRIPTDIR source-path=SCRIPTDIR

View file

@ -1012,6 +1012,14 @@ readAnnotationWithoutPrefix sandboxed = do
key <- many1 (letter <|> char '-') key <- many1 (letter <|> char '-')
char '=' <|> fail "Expected '=' after directive key" char '=' <|> fail "Expected '=' after directive key"
annotations <- case key of annotations <- case key of
"color" -> do
color <- many1 $ noneOf " \n"
option <- parseColorOption color
return options {
formatterOptions = (formatterOptions options) {
foColorOption = option
}
}
"disable" -> readElement `sepBy` char ',' "disable" -> readElement `sepBy` char ','
where where
readElement = readRange <|> readAll readElement = readRange <|> readAll