mirror of
https://github.com/koalaman/shellcheck
synced 2025-08-24 07:05:43 -07:00
Update error numbers and split into diffirent numbers
This commit is contained in:
parent
b0817ca404
commit
273ee802af
1 changed files with 23 additions and 12 deletions
|
@ -4853,19 +4853,30 @@ prop_checkBatsTestDoesNotUseNegation2 = verify checkBatsTestDoesNotUseNegation "
|
||||||
prop_checkBatsTestDoesNotUseNegation3 = verify checkBatsTestDoesNotUseNegation "#!/usr/bin/env bats\n@test \"name\"{ run ! true }"
|
prop_checkBatsTestDoesNotUseNegation3 = verify checkBatsTestDoesNotUseNegation "#!/usr/bin/env bats\n@test \"name\"{ run ! true }"
|
||||||
checkBatsTestDoesNotUseNegation params t =
|
checkBatsTestDoesNotUseNegation params t =
|
||||||
case t of
|
case t of
|
||||||
T_BatsTest _ _ (T_BraceGroup _ commands) -> mapM_ check (dropLast commands)
|
T_BatsTest _ _ (T_BraceGroup _ commands) -> mapM_ (check commands) commands
|
||||||
T_Banged id (T_Pipeline _ _ [T_Redirecting _ _ (T_Condition idCondition _ _)]) ->
|
_ -> return ()
|
||||||
err id 2293
|
where
|
||||||
"bats: ! <command> will never fail the test. Fold the `!` into the conditional!"
|
check commands t =
|
||||||
T_Banged id cmd -> errWithFix id 2293
|
|
||||||
"bats: ! <command> will never fail the test."
|
|
||||||
(fixWith [replaceStart id params 0 "run "])
|
|
||||||
_ -> return ()
|
|
||||||
dropLast t =
|
|
||||||
case t of
|
case t of
|
||||||
[_] -> []
|
T_Banged id (T_Pipeline _ _ [T_Redirecting _ _ (T_Condition idCondition _ _)]) ->
|
||||||
x:rest -> x : dropLast rest
|
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!"
|
||||||
|
else err id 2315
|
||||||
|
"In bats, ! does not cause a test failure. Fold the `!` into the conditional!"
|
||||||
|
|
||||||
|
T_Banged id cmd -> if t `isLastOf` commands
|
||||||
|
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."
|
||||||
|
(fixWith [replaceStart id params 0 "run "])
|
||||||
|
else errWithFix id 2314
|
||||||
|
"In bats, ! does not cause a test failure. Use 'run ! ' (on bats >= 1.5.0) instead."
|
||||||
|
(fixWith [replaceStart id params 0 "run "])
|
||||||
|
_ -> return ()
|
||||||
|
isLastOf t commands =
|
||||||
|
case commands of
|
||||||
|
[x] -> x == t
|
||||||
|
x:rest -> isLastOf t rest
|
||||||
|
[] -> False
|
||||||
|
|
||||||
return []
|
return []
|
||||||
runTests = $( [| $(forAllProperties) (quickCheckWithResult (stdArgs { maxSuccess = 1 }) ) |])
|
runTests = $( [| $(forAllProperties) (quickCheckWithResult (stdArgs { maxSuccess = 1 }) ) |])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue