File tree 2 files changed +11
-0
lines changed
2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change 3
3
- SC2327/SC2328: Warn about capturing the output of redirected commands.
4
4
- SC2329: Warn when (non-escaping) functions are never invoked.
5
5
- SC2330: Warn about unsupported glob matches with [[ .. ]] in BusyBox.
6
+ - SC2331: Suggest using standard -e instead of unary -a in tests.
6
7
- Precompiled binaries for Linux riscv64 (linux.riscv64)
7
8
### Changed
8
9
- SC2002 about Useless Use Of Cat is now disabled by default. It can be
Original file line number Diff line number Diff line change @@ -204,6 +204,7 @@ nodeChecks = [
204
204
,checkUnnecessaryParens
205
205
,checkPlusEqualsNumber
206
206
,checkExpansionWithRedirection
207
+ ,checkUnaryTestA
207
208
]
208
209
209
210
optionalChecks = map fst optionalTreeChecks
@@ -5098,6 +5099,15 @@ checkExpansionWithRedirection params t =
5098
5099
err redirectId 2328 $ " This redirection takes output away from the command substitution" ++ if suggestTee then " (use tee to duplicate)." else " ."
5099
5100
5100
5101
5102
+ prop_checkUnaryTestA1 = verify checkUnaryTestA " [ -a foo ]"
5103
+ prop_checkUnaryTestA2 = verify checkUnaryTestA " [ ! -a foo ]"
5104
+ prop_checkUnaryTestA3 = verifyNot checkUnaryTestA " [ foo -a bar ]"
5105
+ checkUnaryTestA params t =
5106
+ case t of
5107
+ TC_Unary id _ " -a" _ ->
5108
+ styleWithFix id 2331 " For file existence, prefer standard -e over legacy -a." $
5109
+ fixWith [replaceStart id params 2 " -e" ]
5110
+ _ -> return ()
5101
5111
5102
5112
return []
5103
5113
runTests = $ ( [| $ (forAllProperties) (quickCheckWithResult (stdArgs { maxSuccess = 1 }) ) | ])
You can’t perform that action at this time.
0 commit comments