Skip to content

Commit fbb8386

Browse files
authored
Merge pull request #3170 from e-kwsm/SC3012
fix(SC3012)!: do not warn about `\<` and `\>` in test/[] as specified in POSIX.1-2024
2 parents 553a80f + bc60607 commit fbb8386

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Diff for: CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- SC2002 about Useless Use Of Cat is now disabled by default. It can be
1212
re-enabled with `--enable=useless-use-of-cat` or equivalent directive.
1313
- SC2015 about `A && B || C` no longer triggers when B is a test command.
14+
- SC3012: Do not warn about `\<` and `\>` in test/[] as specified in POSIX.1-2024
1415
### Fixed
1516
- SC2218 about function use-before-define is now more accurate.
1617
- SC2317 about unreachable commands is now less spammy for nested ones.

Diff for: src/ShellCheck/Checks/ShellSupport.hs

+2-2
Original file line numberDiff line numberDiff line change
@@ -249,10 +249,10 @@ checkBashisms = ForShell [Sh, Dash, BusyboxSh] $ \t -> do
249249
unless isBusyboxSh $ warnMsg id 3010 "[[ ]] is"
250250
bashism (T_HereString id _) = warnMsg id 3011 "here-strings are"
251251
bashism (TC_Binary id SingleBracket op _ _)
252-
| op `elem` [ "<", ">", "\\<", "\\>", "<=", ">=", "\\<=", "\\>="] =
252+
| op `elem` [ "<", ">", "<=", ">=", "\\<=", "\\>="] =
253253
unless isDash $ warnMsg id 3012 $ "lexicographical " ++ op ++ " is"
254254
bashism (T_SimpleCommand id _ [asStr -> Just "test", lhs, asStr -> Just op, rhs])
255-
| op `elem` [ "<", ">", "\\<", "\\>", "<=", ">=", "\\<=", "\\>="] =
255+
| op `elem` [ "<", ">", "<=", ">=", "\\<=", "\\>="] =
256256
unless isDash $ warnMsg id 3012 $ "lexicographical " ++ op ++ " is"
257257
bashism (TC_Binary id SingleBracket op _ _)
258258
| op `elem` [ "-ot", "-nt", "-ef" ] =

0 commit comments

Comments
 (0)