Add a verbose mode: `-S verbose`

This commit is contained in:
Vidar Holen 2019-04-13 13:10:48 -07:00
parent f514f5f735
commit 9652ccfdbd
6 changed files with 11 additions and 6 deletions

View File

@ -3,6 +3,7 @@
- Preliminary support for fix suggestions - Preliminary support for fix suggestions
- Files containing Bats tests can now be checked - Files containing Bats tests can now be checked
- Directory wide directives can now be placed in a `.shellcheckrc` - Directory wide directives can now be placed in a `.shellcheckrc`
- Verbose mode: Use `-S verbose` for especially pedantic suggestions
- SC2247: Warn about $"(cmd)" and $"{var}" - SC2247: Warn about $"(cmd)" and $"{var}"
- SC2246: Warn if a shebang's interpreter ends with / - SC2246: Warn if a shebang's interpreter ends with /
- SC2245: Warn that Ksh ignores all but the first glob result in `[` - SC2245: Warn that Ksh ignores all but the first glob result in `[`

View File

@ -69,8 +69,9 @@ not warn at all, as `ksh` supports decimals in arithmetic contexts.
**-S**\ *SEVERITY*,\ **--severity=***severity* **-S**\ *SEVERITY*,\ **--severity=***severity*
: Specify minimum severity of errors to consider. Valid values are *error*, : Specify minimum severity of errors to consider. Valid values in order of
*warning*, *info* and *style*. The default is *style*. severity are *error*, *warning*, *info*, *style* and *verbose*.
The default is *style*.
**-s**\ *shell*,\ **--shell=***shell* **-s**\ *shell*,\ **--shell=***shell*

View File

@ -103,7 +103,7 @@ options = [
"Specify dialect (sh, bash, dash, ksh)", "Specify dialect (sh, bash, dash, ksh)",
Option "S" ["severity"] Option "S" ["severity"]
(ReqArg (Flag "severity") "SEVERITY") (ReqArg (Flag "severity") "SEVERITY")
"Minimum severity of errors to consider (error, warning, info, style)", "Minimum severity of errors to consider (error, warning, info, style, verbose)",
Option "V" ["version"] Option "V" ["version"]
(NoArg $ Flag "version" "true") "Print version information", (NoArg $ Flag "version" "true") "Print version information",
Option "W" ["wiki-link-count"] Option "W" ["wiki-link-count"]
@ -254,7 +254,8 @@ parseSeverityOption value =
("error", ErrorC), ("error", ErrorC),
("warning", WarningC), ("warning", WarningC),
("info", InfoC), ("info", InfoC),
("style", StyleC) ("style", StyleC),
("verbose", VerboseC)
] ]
parseOption flag options = parseOption flag options =

View File

@ -47,6 +47,7 @@ severityText pc =
WarningC -> "warning" WarningC -> "warning"
InfoC -> "info" InfoC -> "info"
StyleC -> "style" StyleC -> "style"
VerboseC -> "verbose"
-- Realign comments from a tabstop of 8 to 1 -- Realign comments from a tabstop of 8 to 1
makeNonVirtual comments contents = makeNonVirtual comments contents =

View File

@ -57,6 +57,7 @@ colorForLevel level =
"warning" -> 33 -- yellow "warning" -> 33 -- yellow
"info" -> 32 -- green "info" -> 32 -- green
"style" -> 32 -- green "style" -> 32 -- green
"verbose" -> 32 -- green
"message" -> 1 -- bold "message" -> 1 -- bold
"source" -> 0 -- none "source" -> 0 -- none
_ -> 0 -- none _ -> 0 -- none

View File

@ -32,7 +32,7 @@ module ShellCheck.Interface
, ExecutionMode(Executed, Sourced) , ExecutionMode(Executed, Sourced)
, ErrorMessage , ErrorMessage
, Code , Code
, Severity(ErrorC, WarningC, InfoC, StyleC) , Severity(ErrorC, WarningC, InfoC, StyleC, VerboseC)
, Position(posFile, posLine, posColumn) , Position(posFile, posLine, posColumn)
, Comment(cSeverity, cCode, cMessage) , Comment(cSeverity, cCode, cMessage)
, PositionedComment(pcStartPos , pcEndPos , pcComment, pcFix) , PositionedComment(pcStartPos , pcEndPos , pcComment, pcFix)
@ -189,7 +189,7 @@ data ExecutionMode = Executed | Sourced deriving (Show, Eq)
type ErrorMessage = String type ErrorMessage = String
type Code = Integer type Code = Integer
data Severity = ErrorC | WarningC | InfoC | StyleC data Severity = ErrorC | WarningC | InfoC | StyleC | VerboseC
deriving (Show, Eq, Ord, Generic, NFData) deriving (Show, Eq, Ord, Generic, NFData)
data Position = Position { data Position = Position {
posFile :: String, -- Filename posFile :: String, -- Filename