mirror of
https://github.com/koalaman/shellcheck
synced 2025-07-07 13:31:36 -07:00
Merge pull request #822 from bittorf/master
SC2164: show two possible variants for circumenting the warning
This commit is contained in:
commit
41176c23a6
1 changed files with 1 additions and 1 deletions
|
@ -2515,7 +2515,7 @@ checkUncheckedCd params root =
|
||||||
when(t `isUnqualifiedCommand` "cd"
|
when(t `isUnqualifiedCommand` "cd"
|
||||||
&& not (isCdDotDot t)
|
&& not (isCdDotDot t)
|
||||||
&& not (isCondition $ getPath (parentMap params) t)) $
|
&& not (isCondition $ getPath (parentMap params) t)) $
|
||||||
warn (getId t) 2164 "Use cd ... || exit in case cd fails."
|
warn (getId t) 2164 "Use 'cd ... || exit' or 'cd ... || return' in case cd fails."
|
||||||
checkElement _ = return ()
|
checkElement _ = return ()
|
||||||
isCdDotDot t = oversimplify t == ["cd", ".."]
|
isCdDotDot t = oversimplify t == ["cd", ".."]
|
||||||
hasSetE = isNothing $ doAnalysis (guard . not . isSetE) root
|
hasSetE = isNothing $ doAnalysis (guard . not . isSetE) root
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue