File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed
Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change 33- SC2327/SC2328: Warn about capturing the output of redirected commands.
44- SC2329: Warn when (non-escaping) functions are never invoked.
55- SC2330: Warn about unsupported glob matches with [[ .. ]] in BusyBox.
6+ - SC2331: Suggest using standard -e instead of unary -a in tests.
67- Precompiled binaries for Linux riscv64 (linux.riscv64)
78### Changed
89- 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 = [
204204 ,checkUnnecessaryParens
205205 ,checkPlusEqualsNumber
206206 ,checkExpansionWithRedirection
207+ ,checkUnaryTestA
207208 ]
208209
209210optionalChecks = map fst optionalTreeChecks
@@ -5098,6 +5099,15 @@ checkExpansionWithRedirection params t =
50985099 err redirectId 2328 $ " This redirection takes output away from the command substitution" ++ if suggestTee then " (use tee to duplicate)." else " ."
50995100
51005101
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 ()
51015111
51025112return []
51035113runTests = $ ( [| $ (forAllProperties) (quickCheckWithResult (stdArgs { maxSuccess = 1 }) ) | ])
You can’t perform that action at this time.
0 commit comments