mirror of
https://github.com/koalaman/shellcheck
synced 2025-07-12 16:13:19 -07:00
Allow disable=all
to disable all warnings (fixes #2323)
This commit is contained in:
parent
9a54e91195
commit
09aa15c9b7
4 changed files with 15 additions and 1 deletions
|
@ -306,6 +306,13 @@ prop_canDisableShebangWarning = null $ result
|
|||
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
|
||||
where
|
||||
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_readAnnotation6 = isOk readAnnotation "# shellcheck disable=SC1234 # shellcheck foo=bar\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
|
||||
try readAnnotationPrefix
|
||||
many1 linewhitespace
|
||||
|
@ -1004,8 +1005,12 @@ readAnnotationWithoutPrefix sandboxed = do
|
|||
key <- many1 (letter <|> char '-')
|
||||
char '=' <|> fail "Expected '=' after directive key"
|
||||
annotations <- case key of
|
||||
"disable" -> readRange `sepBy` char ','
|
||||
"disable" -> readElement `sepBy` char ','
|
||||
where
|
||||
readElement = readRange <|> readAll
|
||||
readAll = do
|
||||
string "all"
|
||||
return $ DisableComment 0 1000000
|
||||
readRange = do
|
||||
from <- readCode
|
||||
to <- choice [ char '-' *> readCode, return $ from+1 ]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue