mirror of
https://github.com/koalaman/shellcheck
synced 2025-08-22 14:23:53 -07:00
Fixed comments that were parsed as haddock errors
When compiling ShellCheck with `-haddock`, the were some comments containing invalid haddock syntax, whchi prevented the docs from being generated in hackage. I fixed the issue by adding another dash, which signals the parser that it should not be interpreted as documentation, but just comments.
This commit is contained in:
parent
d47f3ff986
commit
7176727f4d
1 changed files with 13 additions and 13 deletions
|
@ -4143,11 +4143,11 @@ checkEqualsInCommand params originalToken =
|
||||||
msg cmd leading (T_Literal litId s) = do
|
msg cmd leading (T_Literal litId s) = do
|
||||||
-- There are many different cases, and the order of the branches matter.
|
-- There are many different cases, and the order of the branches matter.
|
||||||
case leading of
|
case leading of
|
||||||
-- --foo=42
|
--- --foo=42
|
||||||
[] | "-" `isPrefixOf` s -> -- There's SC2215 for these
|
[] | "-" `isPrefixOf` s -> -- There's SC2215 for these
|
||||||
return ()
|
return ()
|
||||||
|
|
||||||
-- ======Hello======
|
--- ======Hello======
|
||||||
[] | "=" `isPrefixOf` s ->
|
[] | "=" `isPrefixOf` s ->
|
||||||
case originalToken of
|
case originalToken of
|
||||||
T_SimpleCommand _ [] [word] | isConflictMarker word ->
|
T_SimpleCommand _ [] [word] | isConflictMarker word ->
|
||||||
|
@ -4155,11 +4155,11 @@ checkEqualsInCommand params originalToken =
|
||||||
_ | "===" `isPrefixOf` s -> borderMsg (getId originalToken)
|
_ | "===" `isPrefixOf` s -> borderMsg (getId originalToken)
|
||||||
_ -> prefixMsg (getId cmd)
|
_ -> prefixMsg (getId cmd)
|
||||||
|
|
||||||
-- $var==42
|
--- $var==42
|
||||||
_ | "==" `isInfixOf` s ->
|
_ | "==" `isInfixOf` s ->
|
||||||
badComparisonMsg (getId cmd)
|
badComparisonMsg (getId cmd)
|
||||||
|
|
||||||
-- ${foo[x]}=42 and $foo=42
|
--- ${foo[x]}=42 and $foo=42
|
||||||
[T_DollarBraced id braced l] | "=" `isPrefixOf` s -> do
|
[T_DollarBraced id braced l] | "=" `isPrefixOf` s -> do
|
||||||
let variableStr = concat $ oversimplify l
|
let variableStr = concat $ oversimplify l
|
||||||
let variableReference = getBracedReference variableStr
|
let variableReference = getBracedReference variableStr
|
||||||
|
@ -4172,22 +4172,22 @@ checkEqualsInCommand params originalToken =
|
||||||
&& "]" `isSuffixOf` variableModifier
|
&& "]" `isSuffixOf` variableModifier
|
||||||
|
|
||||||
case () of
|
case () of
|
||||||
-- $foo=bar should already have caused a parse-time SC1066
|
--- $foo=bar should already have caused a parse-time SC1066
|
||||||
-- _ | not braced && isPlain ->
|
--- _ | not braced && isPlain ->
|
||||||
-- return ()
|
--- return ()
|
||||||
|
|
||||||
_ | variableStr == "" -> -- Don't try to fix ${}=foo
|
_ | variableStr == "" -> -- Don't try to fix ${}=foo
|
||||||
genericMsg (getId cmd)
|
genericMsg (getId cmd)
|
||||||
|
|
||||||
-- $#=42 or ${#var}=42
|
--- $#=42 or ${#var}=42
|
||||||
_ | "#" `isPrefixOf` variableStr ->
|
_ | "#" `isPrefixOf` variableStr ->
|
||||||
genericMsg (getId cmd)
|
genericMsg (getId cmd)
|
||||||
|
|
||||||
-- ${0}=42
|
--- ${0}=42
|
||||||
_ | variableStr == "0" ->
|
_ | variableStr == "0" ->
|
||||||
assign0Msg id $ fixWith [replaceToken id params "BASH_ARGV0"]
|
assign0Msg id $ fixWith [replaceToken id params "BASH_ARGV0"]
|
||||||
|
|
||||||
-- $2=2
|
--- $2=2
|
||||||
_ | isPositional ->
|
_ | isPositional ->
|
||||||
positionalMsg id
|
positionalMsg id
|
||||||
|
|
||||||
|
@ -4201,7 +4201,7 @@ checkEqualsInCommand params originalToken =
|
||||||
|
|
||||||
_ -> indirectionMsg id
|
_ -> indirectionMsg id
|
||||||
|
|
||||||
-- 2=42
|
--- 2=42
|
||||||
[] | s `matches` positionalAssignmentRe ->
|
[] | s `matches` positionalAssignmentRe ->
|
||||||
if "0=" `isPrefixOf` s
|
if "0=" `isPrefixOf` s
|
||||||
then
|
then
|
||||||
|
@ -4209,11 +4209,11 @@ checkEqualsInCommand params originalToken =
|
||||||
else
|
else
|
||||||
positionalMsg litId
|
positionalMsg litId
|
||||||
|
|
||||||
-- 9foo=42
|
--- 9foo=42
|
||||||
[] | isLeadingNumberVar s ->
|
[] | isLeadingNumberVar s ->
|
||||||
leadingNumberMsg (getId cmd)
|
leadingNumberMsg (getId cmd)
|
||||||
|
|
||||||
-- var${foo}x=42
|
--- var${foo}x=42
|
||||||
(_:_) | mayBeVariableName leading && (all isVariableChar $ takeWhile (/= '=') s) ->
|
(_:_) | mayBeVariableName leading && (all isVariableChar $ takeWhile (/= '=') s) ->
|
||||||
indirectionMsg (getId cmd)
|
indirectionMsg (getId cmd)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue