mirror of
https://github.com/koalaman/shellcheck
synced 2025-07-05 20:41:35 -07:00
Issue 837 flag to include only certain warnings
Issue https://github.com/koalaman/shellcheck/issues/837 Add an --include option, which creates a whitelist of warnings to report on, the opposite of --exclude.
This commit is contained in:
parent
a621eba6d3
commit
59c47f2266
4 changed files with 52 additions and 5 deletions
|
@ -87,6 +87,8 @@ options = [
|
|||
Option "C" ["color"]
|
||||
(OptArg (maybe (Flag "color" "always") (Flag "color")) "WHEN")
|
||||
"Use color (auto, always, never)",
|
||||
Option "i" ["include"]
|
||||
(ReqArg (Flag "include") "CODE1,CODE2..") "Consider only given types of warnings",
|
||||
Option "e" ["exclude"]
|
||||
(ReqArg (Flag "exclude") "CODE1,CODE2..") "Exclude types of warnings",
|
||||
Option "f" ["format"]
|
||||
|
@ -270,6 +272,18 @@ parseOption flag options =
|
|||
}
|
||||
}
|
||||
|
||||
Flag "include" str -> do
|
||||
new <- mapM parseNum $ filter (not . null) $ split ',' str
|
||||
let old = csIncludedWarnings . checkSpec $ options
|
||||
return options {
|
||||
checkSpec = (checkSpec options) {
|
||||
csIncludedWarnings =
|
||||
if null new
|
||||
then old
|
||||
else Just new `mappend` old
|
||||
}
|
||||
}
|
||||
|
||||
Flag "version" _ -> do
|
||||
liftIO printVersion
|
||||
throwError NoProblems
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue