Skip to content

Commit 3a9ddae

Browse files
committed
fix(SC3013)!: remove SC3013 since the operators are specified by POSIX.1-2024
https://pubs.opengroup.org/onlinepubs/9799919799/utilities/test.html fix koalaman#3167
1 parent d3001f3 commit 3a9ddae

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
- SC2317 about unreachable commands is now less spammy for nested ones.
1414
- SC2292, optional suggestion for [[ ]], now triggers for Busybox.
1515

16+
### Removed
17+
- SC3013: removed since the operators `-op/-nt/-ef` are specified in POSIX.1-2024
1618

1719
## v0.10.0 - 2024-03-07
1820
### Added

src/ShellCheck/Checks/ShellSupport.hs

+1-7
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ checkForDecimals = ForShell [Sh, Dash, BusyboxSh, Bash] f
8686

8787

8888
prop_checkBashisms = verify checkBashisms "while read a; do :; done < <(a)"
89-
prop_checkBashisms2 = verify checkBashisms "[ foo -nt bar ]"
89+
prop_checkBashisms2 = verifyNot checkBashisms "[ foo -nt bar ]"
9090
prop_checkBashisms3 = verify checkBashisms "echo $((i++))"
9191
prop_checkBashisms4 = verify checkBashisms "rm !(*.hs)"
9292
prop_checkBashisms5 = verify checkBashisms "source file"
@@ -252,12 +252,6 @@ checkBashisms = ForShell [Sh, Dash, BusyboxSh] $ \t -> do
252252
bashism (T_SimpleCommand id _ [asStr -> Just "test", lhs, asStr -> Just op, rhs])
253253
| op `elem` [ "<", ">", "\\<", "\\>", "<=", ">=", "\\<=", "\\>="] =
254254
unless isDash $ warnMsg id 3012 $ "lexicographical " ++ op ++ " is"
255-
bashism (TC_Binary id SingleBracket op _ _)
256-
| op `elem` [ "-ot", "-nt", "-ef" ] =
257-
unless isDash $ warnMsg id 3013 $ op ++ " is"
258-
bashism (T_SimpleCommand id _ [asStr -> Just "test", lhs, asStr -> Just op, rhs])
259-
| op `elem` [ "-ot", "-nt", "-ef" ] =
260-
unless isDash $ warnMsg id 3013 $ op ++ " is"
261255
bashism (TC_Binary id SingleBracket "==" _ _) =
262256
unless isBusyboxSh $ warnMsg id 3014 "== in place of = is"
263257
bashism (T_SimpleCommand id _ [asStr -> Just "test", lhs, asStr -> Just "==", rhs]) =

0 commit comments

Comments
 (0)