mirror of
https://github.com/koalaman/shellcheck
synced 2025-07-07 05:21:34 -07:00
Minor formatting fixes
This commit is contained in:
parent
9092080a84
commit
d7971dafd1
1 changed files with 7 additions and 10 deletions
|
@ -4868,7 +4868,7 @@ checkExtraMaskedReturns params t = runNodeAnalysis findMaskingNodes params t
|
||||||
prop_checkBatsTestDoesNotUseNegation1 = verify checkBatsTestDoesNotUseNegation "#!/usr/bin/env/bats\n@test \"name\" { ! true; false; }"
|
prop_checkBatsTestDoesNotUseNegation1 = verify checkBatsTestDoesNotUseNegation "#!/usr/bin/env/bats\n@test \"name\" { ! true; false; }"
|
||||||
prop_checkBatsTestDoesNotUseNegation2 = verify checkBatsTestDoesNotUseNegation "#!/usr/bin/env/bats\n@test \"name\" { ! [[ -e test ]]; false; }"
|
prop_checkBatsTestDoesNotUseNegation2 = verify checkBatsTestDoesNotUseNegation "#!/usr/bin/env/bats\n@test \"name\" { ! [[ -e test ]]; false; }"
|
||||||
prop_checkBatsTestDoesNotUseNegation3 = verify checkBatsTestDoesNotUseNegation "#!/usr/bin/env/bats\n@test \"name\" { ! [ -e test ]; false; }"
|
prop_checkBatsTestDoesNotUseNegation3 = verify checkBatsTestDoesNotUseNegation "#!/usr/bin/env/bats\n@test \"name\" { ! [ -e test ]; false; }"
|
||||||
-- acceptable formats:
|
-- acceptable formats:
|
||||||
-- using run
|
-- using run
|
||||||
prop_checkBatsTestDoesNotUseNegation4 = verifyNot checkBatsTestDoesNotUseNegation "#!/usr/bin/env/bats\n@test \"name\" { run ! true; }"
|
prop_checkBatsTestDoesNotUseNegation4 = verifyNot checkBatsTestDoesNotUseNegation "#!/usr/bin/env/bats\n@test \"name\" { run ! true; }"
|
||||||
-- using || false
|
-- using || false
|
||||||
|
@ -4886,21 +4886,18 @@ checkBatsTestDoesNotUseNegation params t =
|
||||||
where
|
where
|
||||||
check commands t =
|
check commands t =
|
||||||
case t of
|
case t of
|
||||||
T_Banged id (T_Pipeline _ _ [T_Redirecting _ _ (T_Condition idCondition _ _)]) ->
|
T_Banged id (T_Pipeline _ _ [T_Redirecting _ _ (T_Condition idCondition _ _)]) ->
|
||||||
if t `isLastOf` commands
|
if t `isLastOf` commands
|
||||||
then style id 2315 "In Bats, ! will not fail the test if it is not the last command anymore. Fold the `!` into the conditional!"
|
then style id 2315 "In Bats, ! will not fail the test if it is not the last command anymore. Fold the `!` into the conditional!"
|
||||||
else err id 2315
|
else err id 2315 "In Bats, ! does not cause a test failure. Fold the `!` into the conditional!"
|
||||||
"In Bats, ! does not cause a test failure. Fold the `!` into the conditional!"
|
|
||||||
|
|
||||||
T_Banged id cmd -> if t `isLastOf` commands
|
T_Banged id cmd -> if t `isLastOf` commands
|
||||||
then styleWithFix id 2314
|
then styleWithFix id 2314 "In Bats, ! will not fail the test if it is not the last command anymore. Use `run ! ` (on Bats >= 1.5.0) instead."
|
||||||
"In Bats, ! will not fail the test if it is not the last command anymore. Use `run ! ` (on Bats >= 1.5.0) instead."
|
|
||||||
(fixWith [replaceStart id params 0 "run "])
|
(fixWith [replaceStart id params 0 "run "])
|
||||||
else errWithFix id 2314
|
else errWithFix id 2314 "In Bats, ! does not cause a test failure. Use 'run ! ' (on Bats >= 1.5.0) instead."
|
||||||
"In Bats, ! does not cause a test failure. Use 'run ! ' (on Bats >= 1.5.0) instead."
|
|
||||||
(fixWith [replaceStart id params 0 "run "])
|
(fixWith [replaceStart id params 0 "run "])
|
||||||
_ -> return ()
|
_ -> return ()
|
||||||
isLastOf t commands =
|
isLastOf t commands =
|
||||||
case commands of
|
case commands of
|
||||||
[x] -> x == t
|
[x] -> x == t
|
||||||
x:rest -> isLastOf t rest
|
x:rest -> isLastOf t rest
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue