Allow `disable=all` to disable all warnings (fixes #2323)
This commit is contained in:
parent
9a54e91195
commit
09aa15c9b7
|
@ -1,5 +1,6 @@
|
||||||
## Git (0.8.0)
|
## Git (0.8.0)
|
||||||
### Added
|
### Added
|
||||||
|
- `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.
|
||||||
- SC2286-SC2288: Warn when command name ends in a symbol like `/.)'"`
|
- SC2286-SC2288: Warn when command name ends in a symbol like `/.)'"`
|
||||||
|
|
|
@ -237,6 +237,7 @@ Valid keys are:
|
||||||
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
|
||||||
like a function definition, subshell block or loop. A range can be
|
like a function definition, subshell block or loop. A range can be
|
||||||
be specified with a dash, e.g. `disable=SC3000-SC4000` to exclude 3xxx.
|
be specified with a dash, e.g. `disable=SC3000-SC4000` to exclude 3xxx.
|
||||||
|
All warnings can be disabled with `disable=all`.
|
||||||
|
|
||||||
**enable**
|
**enable**
|
||||||
: Enable an optional check by name, as listed with **--list-optional**.
|
: Enable an optional check by name, as listed with **--list-optional**.
|
||||||
|
|
|
@ -306,6 +306,13 @@ prop_canDisableShebangWarning = null $ result
|
||||||
csScript = "#shellcheck disable=SC2148\nfoo"
|
csScript = "#shellcheck disable=SC2148\nfoo"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prop_canDisableAllWarnings = result == [2086]
|
||||||
|
where
|
||||||
|
result = checkWithSpec [] emptyCheckSpec {
|
||||||
|
csFilename = "file.sh",
|
||||||
|
csScript = "#!/bin/sh\necho $1\n#shellcheck disable=all\necho `echo $1`"
|
||||||
|
}
|
||||||
|
|
||||||
prop_canDisableParseErrors = null $ result
|
prop_canDisableParseErrors = null $ result
|
||||||
where
|
where
|
||||||
result = checkWithSpec [] emptyCheckSpec {
|
result = checkWithSpec [] emptyCheckSpec {
|
||||||
|
|
|
@ -984,6 +984,7 @@ prop_readAnnotation4 = isWarning readAnnotation "# shellcheck cats=dogs disable=
|
||||||
prop_readAnnotation5 = isOk readAnnotation "# shellcheck disable=SC2002 # All cats are precious\n"
|
prop_readAnnotation5 = isOk readAnnotation "# shellcheck disable=SC2002 # All cats are precious\n"
|
||||||
prop_readAnnotation6 = isOk readAnnotation "# shellcheck disable=SC1234 # shellcheck foo=bar\n"
|
prop_readAnnotation6 = isOk readAnnotation "# shellcheck disable=SC1234 # shellcheck foo=bar\n"
|
||||||
prop_readAnnotation7 = isOk readAnnotation "# shellcheck disable=SC1000,SC2000-SC3000,SC1001\n"
|
prop_readAnnotation7 = isOk readAnnotation "# shellcheck disable=SC1000,SC2000-SC3000,SC1001\n"
|
||||||
|
prop_readAnnotation8 = isOk readAnnotation "# shellcheck disable=all\n"
|
||||||
readAnnotation = called "shellcheck directive" $ do
|
readAnnotation = called "shellcheck directive" $ do
|
||||||
try readAnnotationPrefix
|
try readAnnotationPrefix
|
||||||
many1 linewhitespace
|
many1 linewhitespace
|
||||||
|
@ -1004,8 +1005,12 @@ 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
|
||||||
"disable" -> readRange `sepBy` char ','
|
"disable" -> readElement `sepBy` char ','
|
||||||
where
|
where
|
||||||
|
readElement = readRange <|> readAll
|
||||||
|
readAll = do
|
||||||
|
string "all"
|
||||||
|
return $ DisableComment 0 1000000
|
||||||
readRange = do
|
readRange = do
|
||||||
from <- readCode
|
from <- readCode
|
||||||
to <- choice [ char '-' *> readCode, return $ from+1 ]
|
to <- choice [ char '-' *> readCode, return $ from+1 ]
|
||||||
|
|
Loading…
Reference in New Issue