mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-08-21 18:44:00 +08:00
Add check as an optional tree check
This commit is contained in:
@@ -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])
|
||||||
|
Reference in New Issue
Block a user