mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-08-21 14:10:10 +08:00
Add check as an optional tree check
This commit is contained in:
@@ -71,7 +71,6 @@ treeChecks = [
|
||||
,checkUseBeforeDefinition
|
||||
,checkAliasUsedInSameParsingUnit
|
||||
,checkArrayValueUsedAsIndex
|
||||
,checkVariableCanBeReadonly
|
||||
]
|
||||
|
||||
checker spec params = mkChecker spec params treeChecks
|
||||
@@ -280,6 +279,13 @@ optionalTreeChecks = [
|
||||
cdPositive = "cat foo | grep bar",
|
||||
cdNegative = "grep bar foo"
|
||||
}, 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])
|
||||
|
Reference in New Issue
Block a user