This commit is contained in:
Josh Chorlton 2024-12-14 03:16:15 -08:00 committed by GitHub
commit d353846ef7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 0 deletions
src/ShellCheck

View File

@ -187,6 +187,7 @@ nodeChecks = [
,checkDollarQuoteParen ,checkDollarQuoteParen
,checkUselessBang ,checkUselessBang
,checkTranslatedStringVariable ,checkTranslatedStringVariable
,checkPipelineE
,checkModifiedArithmeticInRedirection ,checkModifiedArithmeticInRedirection
,checkBlatantRecursion ,checkBlatantRecursion
,checkBadTestAndOr ,checkBadTestAndOr
@ -4038,6 +4039,12 @@ checkUselessBang params t = when (hasSetE params) $ mapM_ check (getNonReturning
x:rest -> x : dropLast rest x:rest -> x : dropLast rest
_ -> [] _ -> []
prop_checkPipelineE1 = verify checkPipelineE "set -e; echo hi && echo hello"
prop_checkPipelineE2 = verifyNot checkPipelineE "echo hi && echo hello"
checkPipelineE params x@(T_AndIf id _ _) = when (hasSetE params) $
info id 3061 "&& operators running with -e set will not exit on error"
checkPipelineE _ _ = return ()
prop_checkModifiedArithmeticInRedirection1 = verify checkModifiedArithmeticInRedirection "ls > $((i++))" prop_checkModifiedArithmeticInRedirection1 = verify checkModifiedArithmeticInRedirection "ls > $((i++))"
prop_checkModifiedArithmeticInRedirection2 = verify checkModifiedArithmeticInRedirection "cat < \"foo$((i++)).txt\"" prop_checkModifiedArithmeticInRedirection2 = verify checkModifiedArithmeticInRedirection "cat < \"foo$((i++)).txt\""
prop_checkModifiedArithmeticInRedirection3 = verifyNot checkModifiedArithmeticInRedirection "while true; do true; done > $((i++))" prop_checkModifiedArithmeticInRedirection3 = verifyNot checkModifiedArithmeticInRedirection "while true; do true; done > $((i++))"