mirror of
https://github.com/koalaman/shellcheck
synced 2025-07-14 00:53:15 -07:00
Add command-line option -S/--severity
Specifies the maximum severity of errors to handle. For example, specifying "-S warning" means that errors of severity "info" and "style" are ignored. Signed-off-by: Martin Schwenke <martin@meltin.net>
This commit is contained in:
parent
15aaacf715
commit
b16da4b242
4 changed files with 33 additions and 5 deletions
|
@ -67,7 +67,8 @@ checkScript sys spec = do
|
|||
return . nub . sortMessages . filter shouldInclude $
|
||||
(parseMessages ++ map translator analysisMessages)
|
||||
|
||||
shouldInclude (PositionedComment _ _ (Comment _ code _)) =
|
||||
shouldInclude (PositionedComment _ _ (Comment severity code _)) =
|
||||
severity <= csMaxSeverity spec &&
|
||||
code `notElem` csExcludedWarnings spec
|
||||
|
||||
sortMessages = sortBy (comparing order)
|
||||
|
|
|
@ -35,7 +35,8 @@ data CheckSpec = CheckSpec {
|
|||
csScript :: String,
|
||||
csCheckSourced :: Bool,
|
||||
csExcludedWarnings :: [Integer],
|
||||
csShellTypeOverride :: Maybe Shell
|
||||
csShellTypeOverride :: Maybe Shell,
|
||||
csMaxSeverity :: Severity
|
||||
} deriving (Show, Eq)
|
||||
|
||||
data CheckResult = CheckResult {
|
||||
|
@ -49,7 +50,8 @@ emptyCheckSpec = CheckSpec {
|
|||
csScript = "",
|
||||
csCheckSourced = False,
|
||||
csExcludedWarnings = [],
|
||||
csShellTypeOverride = Nothing
|
||||
csShellTypeOverride = Nothing,
|
||||
csMaxSeverity = StyleC
|
||||
}
|
||||
|
||||
newParseSpec :: ParseSpec
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue