Commit graph

72 commits

Author SHA1 Message Date
Vidar Holen
dc41f0cc5b Refactor checks for POSIX test flags 2025-04-11 14:14:09 -07:00
Eisuke Kawashima
efb5a5a274
fix(SC3013): check POSIX-compliant unary operators for test and [
fix #2125
2025-04-09 19:21:53 +09:00
Vidar Holen
c41f3a4b8a Warn about [ ! -o opt ] (and -a) being unconditionally true (fixes #3174) 2025-04-08 10:53:52 -07:00
Joseph C. Sible
195b70db8c Use unless instead of when and not 2024-12-13 23:06:49 -05:00
Sertonix
6d2f3d8628 Allow 'echo -e' in busybox shell 2024-07-09 16:58:50 +02:00
Sertonix
4c85274921 Fix SC3045 for busybox shell 2024-07-09 16:57:44 +02:00
Sertonix
6593096ba0 Allow SC3003 on busybox shell 2024-07-09 16:56:59 +02:00
Joseph C. Sible
a786f996a1 Replace !!! with pattern-matching where it's easy 2023-12-31 15:55:06 -05:00
Vidar Holen
74282b0a93 Recognize 'busybox' in --shell and directives. Add to doc texts. 2023-12-10 17:05:29 -08:00
Grische
fdcce458c1 silence some shell expansions for busybox sh 2023-11-27 13:03:29 +01:00
Grische
ca255fe326 silence SC3046 and SC3051 for busybox sh 2023-11-27 13:03:17 +01:00
Grische
a3b8be82fe silence SC3048 for busybox sh 2023-11-27 13:03:07 +01:00
Grische
ac63dc33c9 silence SC3020 for busybox sh 2023-11-27 13:02:56 +01:00
Grische
903421fb5d silence SC3014 for busybox sh 2023-11-27 13:02:45 +01:00
Grische
00ffd2db33 silence SC3010 for busybox sh 2023-11-27 13:02:28 +01:00
Grische
1e1045e73e make busybox sh Dash-like 2023-11-27 13:01:22 +01:00
Max Ulidtko
c89ec2fd49
Fix: do []-related bashism checks on test(1) calls too 2023-10-01 19:57:19 +02:00
Vidar Holen
dd747b2a98 SC2325/SC2326: Warn about ! ! foo and foo | ! bar (fixes #2810) 2023-07-30 19:18:27 -07:00
Vidar Holen
46b678fca8 Minor fixes to POSIX read without variable check 2023-04-30 14:49:10 -07:00
ArenM
3342902d9a Warn about 'read' without a variable in POSIX sh
Dash throws an error if the read command isn't supplied a variable name.
2022-11-17 18:46:15 -05:00
Vidar Holen
819470fa1d Omit SC3021 about >& file unless definitely non-numeric (fixes #2520) 2022-07-22 17:06:24 -07:00
Vidar Holen
2f28847b08 Normalize spaces around = in unit tests 2022-07-22 16:35:14 -07:00
Vidar Holen
f77a545282 Control Flow Graph / Data Flow Analysis support 2022-07-20 08:08:24 -07:00
Vidar Holen
3b6972fbf1 Update copyright years 2021-11-06 19:07:34 -07:00
Vidar Holen
0dd5c67bdf Warn about [^..] in Dash (fixes #2361) 2021-10-21 21:00:39 -07:00
Vidar Holen
b625562d60 Add POSIX checks for more Bash-specific variables (fixes #2093) 2020-12-05 20:11:12 -08:00
Vidar Holen
c4cc2debb7 Improve compatibility checks 2020-09-07 21:05:49 -07:00
Vidar Holen
cfd68ee0c2 Give each sh/dash compatibility warning its own SC3xxx error code 2020-09-01 16:48:14 -07:00
Vidar Holen
9e59bcca91 Upgrade SC2169 (unsupported in dash) from warning to error (fixes #2013) 2020-08-23 15:49:20 -07:00
Vidar Holen
5d753212fb Improve handling of command prefixes like exec/command (fixes #2008) 2020-07-25 13:45:05 -07:00
Vidar Holen
5b86777f9d Warn about non-POSIX case modification expansions (fixes #1977) 2020-07-22 17:32:00 -07:00
Vidar Holen
30523555af
Merge pull request #1906 from josephcsible/shellsupport
Simplify ShellSupport
2020-04-12 15:22:52 -07:00
Joseph C. Sible
999b7e2596 Get rid of bracedString everywhere it's easy to 2020-04-11 19:24:11 -04:00
Joseph C. Sible
8a6679fd8a Remove unnecessary fromMaybe and when from bashism 2020-04-05 22:03:50 -04:00
Joseph C. Sible
facf0d1e27 Write getLiteralArgs with foldr and without fromMaybe or monads 2020-04-05 21:59:27 -04:00
Vidar Holen
d0beac6d0b
Merge pull request #1826 from josephcsible/nofromjust
Use the Identity monad to avoid unnecessary uses of fromJust
2020-02-10 18:05:36 -08:00
Joseph C. Sible
d5c5128115 Use isJust instead of reimplementing it 2020-02-09 23:18:09 -05:00
Joseph C. Sible
6d06103cab Remove unnecessary uses of head 2020-02-09 23:18:09 -05:00
Joseph C. Sible
7e6a556ef1 Get rid of potentially
This already exists as sequence_.
2020-02-09 23:17:52 -05:00
Joseph C. Sible
aaffe38198 Use the Identity monad to avoid unnecessary uses of fromJust 2020-02-08 23:20:54 -05:00
Joseph C. Sible
392b57b8e8 Use maybe instead of isJust and fromJust 2020-02-02 00:27:05 -05:00
Joseph C. Sible
f5c6771016 Use find instead of listToMaybe and filter 2020-02-01 22:50:16 -05:00
Joseph C. Sible
0f48bb78a5 Remove incorrect otherwise
You're supposed to use otherwise where you need a Boolean, not a pattern
match. This is misleadingly shadowing the real otherwise. Use _ instead.
2020-02-01 22:50:14 -05:00
Vidar Holen
e701cf6fad Warn about [ x -ot y ] in POSIX mode 2019-11-03 13:25:35 -08:00
Vidar Holen
38bb156a1c Warn about $_ in POSIX sh (fixes #1647) 2019-07-21 21:22:16 -07:00
Vidar Holen
f4be53eb19 Warn about [ -v var ] for POSIX sh 2019-06-02 10:28:20 -07:00
Benjamin Gordon
aa3b709b5d Track whether braces were present in T_DollarBraced
References of the form $var and ${var} both map to the same structure in
the AST, which prevents any later analysis functions from distinguishing
them.  In preparation for adding checks that need this info, add a Bool
to T_DollarBraced that tracks whether the braces were seen at parsing
time and update all references so that this change is a no-op.
2019-05-14 11:01:38 -06:00
Vidar Holen
e2e65e1350 Warn about arithmetic base conversation in sh (fixes #1547) 2019-04-29 18:02:44 -07:00
Cristian Adrián Ontivero
d3f6e045e2 Check wait flags in dash & POSIX sh
Flags for the wait builtin are undefined under both POSIX sh and dash.
Bash though, accepts [-fn].
2019-02-10 12:44:22 +01:00
Vidar Holen
d984f8cbe7 Don't look at 'set' options after a non-literal. 2019-02-08 22:36:22 -08:00