Commit Graph

770 Commits

Author SHA1 Message Date
Vidar Holen
6a876f0b48 Merge pull request #3309 from e-kwsm/timeout
feat(SC2033): check timeout (POSIX.1-2024)
2025-09-24 19:18:08 -07:00
Vidar Holen
8c616761fa Merge pull request #3305 from e-kwsm/pipefail
feat(SC3040): support `set -o pipefail` as specified by POSIX.1-2024
2025-09-24 19:16:19 -07:00
Vidar Holen
94ded2db74 Merge pull request #3304 from e-kwsm/ulimit
feat(SC3045): update ulimit options in conformance with POSIX.1-2024
2025-09-24 19:15:38 -07:00
Eisuke Kawashima
32cae7a1c5 feat(SC2033): check timeout (POSIX.1-2024)
fix #3308
2025-09-20 10:21:40 +09:00
Eisuke Kawashima
6d4fa9fb2c feat(SC3040): support set -o pipefail as specified by POSIX.1-2024
fix #2555
2025-09-19 18:39:35 +09:00
Eisuke Kawashima
14aac627f4 feat(SC3045): update ulimit options in conformance with POSIX.1-2024
n.b. dash supports `ulimit -r` since v0.5.12-10-g4bdefd16c6ea

fix #3289

https://pubs.opengroup.org/onlinepubs/9799919799/utilities/ulimit.html
2025-09-19 17:35:45 +09:00
Sébastien Santoro
da12ce67f5 Remove duplicate from SC3028 bash variables list 2025-09-15 22:09:33 +00:00
Vidar Holen
b014ce13da Add unit tests for function names with "#" 2025-07-30 09:55:00 -07:00
Vidar Holen
20fd67da07 Merge branch 'add-bang-to-function-chars' of github.com:Flu/shellcheck into Flu-add-bang-to-function-chars 2025-07-28 15:49:30 -07:00
Vidar Holen
5e6383578d Make SC2335 and friends optional (avoid-negated-conditions) 2025-07-28 15:16:22 -07:00
Vidar Holen
60c0be98b6 Merge branch 'fix-3164' of github.com:e-kwsm/shellcheck into e-kwsm-fix-3164 2025-07-28 14:08:25 -07:00
Vidar Holen
bbd5d211cf Merge pull request #3256 from e-kwsm/SC2143
feat(SC2143): add grep variants for compressed data
2025-07-28 14:06:08 -07:00
Vidar Holen
1e679444d7 Merge pull request #3257 from e-kwsm/SC2232
feat(SC2232): add more shell builtins
2025-07-24 09:54:13 -07:00
Eisuke Kawashima
aba0ffb8d3 feat(SC2016,SC2032,SC2033): check doas and run0 similarly to sudo
partially address #3255
2025-07-20 08:13:16 +09:00
Eisuke Kawashima
c0f1265fa0 feat(SC2232): add more shell builtins 2025-07-20 08:02:13 +09:00
Eisuke Kawashima
6e65eb7136 feat(SC2143): add grep variants for compressed data 2025-07-20 04:53:02 +09:00
Eisuke Kawashima
34cdbaa5e0 feat: avoid double negative of a binary operator in test
suggest `[ a != b ]` over `[ ! a = b ]` and `! [ a = b ]`, and so forth.
c.f. SC2236 and SC2237 (unary operations)

close #3164
2025-07-20 03:18:38 +09:00
Vidar Holen
7dc4214149 Normalize \ to / in diff output on Windows (fixes #3240) 2025-07-17 13:40:33 -07:00
Vidar Holen
0c26fb405d Add support for Bash 5.3 source -p .. file (just ignores the path) 2025-07-17 12:27:43 -07:00
Vidar Holen
23097320a4 Add support for ${| ..} expansion (fixes #3243) 2025-07-17 12:01:54 -07:00
Vidar Holen
6a758d5dc7 Update with new Bash 5.3 printf formats 2025-07-17 10:53:05 -07:00
Vidar Holen
c592abb984 Add unit test for #2689 2025-07-17 08:37:58 -07:00
Christopher Slycord
08329b0698 x-prefix: add support for "!=" and X (capital x)
Changes checkComparisonWithLeadingX to:
1) Work with the "!=" operator in addition to "=" and "==".
2) Support prefixing with "x" and "X". This is helpful since some scripts have comparisons like [ "X$var" = "X" ] and the like
2025-07-17 13:14:04 +09:00
Vidar Holen
47d358c1d4 Tighten SC2333/SC2334 to only trigger against literals. 2025-05-17 00:55:50 +00:00
Vidar Holen
ad58768563 Merge branch 'tautologically-false' of github.com:e-kwsm/shellcheck into e-kwsm-tautologically-false 2025-05-12 17:04:34 +00:00
Vidar Holen
62a8ecf9bf Merge branch 'e-kwsm-SC3013' 2025-04-27 16:16:49 -07:00
Ian Ehrenwald
b381658dbc Add python3 to the list of badShells 2025-04-25 14:11:07 -04:00
Vidar Holen
f78714e0f6 Add ":" alongside "true" for SC2015 2025-04-11 19:14:53 -07:00
Vidar Holen
de07ec1c56 Merge branch 'ignore-sc2015-true' of github.com:Flu/shellcheck into Flu-ignore-sc2015-true 2025-04-11 19:14:15 -07:00
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
553a80f77a Also ignore SC2119 for :? and :+. 2025-04-08 21:21:50 -07:00
Vidar Holen
7fc992d0dc Suppress SC2119/SC2120 for ${1:-default} (fixes #2023) 2025-04-08 20:52:52 -07:00
Vidar Holen
c553288085 Merge pull request #3106 from larryv/updatevars-bash-5.3
Recognize internal variables new in bash 5.3
2025-04-08 20:09:29 -07:00
Vidar Holen
1be41dd652 Merge pull request #3082 from silby/oksh
Recognize "oksh" executable name as ksh
2025-04-08 20:08:53 -07:00
Vidar Holen
c41f3a4b8a Warn about [ ! -o opt ] (and -a) being unconditionally true (fixes #3174) 2025-04-08 10:53:52 -07:00
Vidar Holen
574c6d18fb Suggest using test -e instead of -a (fixes #3174). 2025-04-08 10:23:10 -07:00
Vidar Holen
72af76f443 Supress SC2093 when execfail is set (fixes #3178) 2025-04-06 19:58:13 -07:00
Vidar Holen
8ff0c5be7a Suppress SC2216 when piping to cp/mv/rm -i (fixes #3141). 2025-04-06 19:27:29 -07:00
Eisuke Kawashima
4f628cbe2a feat: check tautologically-false conditionals
- fix #3179 — negation of SC2055, `[ x = y -a x = z]`
- fix #3181 — negation of SC2056, `(( x == y && x == z ))`
- fix #3180 — negation of SC2252, `[ x = y ] && [ x = z ]`
2025-04-04 18:21:35 +09:00
Eisuke Kawashima
3a9ddae06b fix(SC3013)!: remove SC3013 since the operators are specified by POSIX.1-2024
https://pubs.opengroup.org/onlinepubs/9799919799/utilities/test.html
fix #3167
2025-03-24 06:24:12 +09:00
Adrian Fluturel
cbf0b33463 Skip SC2015 when the last command is true 2025-01-07 03:24:29 +01:00
Adrian Fluturel
ad1d5fa64f Fix extendedFunction definition 2024-12-31 05:01:18 +01:00
Adrian Fluturel
34b03040d9 Allow pound symbol only inside the function name 2024-12-31 04:48:19 +01:00
Adrian Fluturel
0d504f44d9 Add bang as a valid char for function names 2024-12-31 03:40:47 +01:00
Lawrence Velázquez
fe315a25c4 Recognize internal variables new in bash 5.3
From the bug-bash@gnu.org announcement "Bash-5.3-beta available":

    q. GLOBSORT: new variable to specify how to sort the results of
       pathname expansion (name, size, blocks, mtime, atime, ctime,
       none) in ascending or descending order.

    w. BASH_MONOSECONDS: new dynamic variable that returns the value of
       the system's monotonic clock, if one is available.

    x. BASH_TRAPSIG: new variable, set to the numeric signal number of
       the trap being executed while it's running.

https://lists.gnu.org/archive/html/bug-bash/2024-12/msg00120.html
2024-12-28 03:20:19 -05:00
Joseph C. Sible
d3001f337a Simplify getParseOutput 2024-12-13 23:57:50 -05:00
Joseph C. Sible
7deb7e853b Use mapM_ instead of sequence_ and <$> 2024-12-13 23:47:55 -05:00
Joseph C. Sible
26b949b9b0 Use mapM_ instead of isJust and fromJust 2024-12-13 23:45:32 -05:00
Joseph C. Sible
5adfea21ee Use the result of the comparison directly instead of an if/else 2024-12-13 23:20:48 -05:00