mirror of
https://github.com/koalaman/shellcheck
synced 2025-07-06 21:11:35 -07:00
Add check as an optional tree check
This commit is contained in:
parent
d7b3a1f71e
commit
37ff09aff5
1 changed files with 7 additions and 1 deletions
|
@ -71,7 +71,6 @@ treeChecks = [
|
||||||
,checkUseBeforeDefinition
|
,checkUseBeforeDefinition
|
||||||
,checkAliasUsedInSameParsingUnit
|
,checkAliasUsedInSameParsingUnit
|
||||||
,checkArrayValueUsedAsIndex
|
,checkArrayValueUsedAsIndex
|
||||||
,checkVariableCanBeReadonly
|
|
||||||
]
|
]
|
||||||
|
|
||||||
checker spec params = mkChecker spec params treeChecks
|
checker spec params = mkChecker spec params treeChecks
|
||||||
|
@ -280,6 +279,13 @@ optionalTreeChecks = [
|
||||||
cdPositive = "cat foo | grep bar",
|
cdPositive = "cat foo | grep bar",
|
||||||
cdNegative = "grep bar foo"
|
cdNegative = "grep bar foo"
|
||||||
}, nodeChecksToTreeCheck [checkUuoc])
|
}, nodeChecksToTreeCheck [checkUuoc])
|
||||||
|
|
||||||
|
,(newCheckDescription {
|
||||||
|
cdName = "check-variable-can-be-readonly",
|
||||||
|
cdDescription = "Check that a variable can be made readonly if it isn't assigned to.",
|
||||||
|
cdPositive = "x=3; echo $x",
|
||||||
|
cdNegative = "readonly x=3; echo $x"
|
||||||
|
}, checkVariableCanBeReadonly)
|
||||||
]
|
]
|
||||||
|
|
||||||
optionalCheckMap :: Map.Map String (Parameters -> Token -> [TokenComment])
|
optionalCheckMap :: Map.Map String (Parameters -> Token -> [TokenComment])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue