Commit Graph

308 Commits

Author SHA1 Message Date
Joseph C. Sible 7b0589988f Implement isCondition in terms of foldr 2023-12-31 17:21:50 -05:00
Joseph C. Sible 71889c139a Use a case expression instead of any and take 1 2023-12-31 16:44:21 -05:00
Joseph C. Sible a6984cddb0 Switch then and else to remove a not 2023-12-31 16:40:18 -05:00
Joseph C. Sible 6c81505870 Use a pattern guard instead of fromJust in checkLoopKeywordScope 2023-12-31 16:26:03 -05:00
Joseph C. Sible 10afe83ce3 Use getLiteralStringDef instead of rebuilding it with fromJust 2023-12-31 16:23:45 -05:00
Joseph C. Sible a786f996a1 Replace !!! with pattern-matching where it's easy 2023-12-31 15:55:06 -05:00
Joseph C. Sible 6e5b5401c6 Manually fuse elem and map in checkArrayValueUsedAsIndex 2023-12-31 02:31:07 -05:00
Joseph C. Sible add49cda17 Make getPath return a NonEmpty 2023-12-31 02:12:58 -05:00
Joseph C. Sible dedf932fe8 Use traverse instead of sequence and map 2023-12-30 13:59:15 -05:00
Joseph C. Sible f983d9ae93 Simplify functionMap and remove unnecessary partiality 2023-12-21 13:35:22 -05:00
Joseph C. Sible f242922a2e Use onlyLiteralString in more places 2023-12-19 00:00:32 -05:00
Grische 1e1045e73e make busybox sh Dash-like 2023-11-27 13:01:22 +01:00
Grische be8e4b2b8a add basic busybox sh support 2023-11-27 13:00:10 +01:00
Joseph C. Sible 1aeab287e6 Add nil case that went missing in 4fd0615 2023-11-03 01:33:49 -04:00
Joseph C. Sible 4fd0615501 Stop using head in isLeadingNumberVar 2023-10-16 00:55:04 -04:00
Joseph C. Sible 8b3c37aa36 Use find instead of listToMaybe and filter 2023-10-16 00:06:53 -04:00
Vidar Holen d18b2553cf
Merge pull request #2808 from bruce-ricard/pr/dfbr
improve short description for SC2038
2023-08-13 14:53:15 -07:00
Vidar Holen 372c0b667e SC2324: Warn when x+=1 appends. 2023-07-30 15:00:43 -07:00
Danny Faught 01aee1a859 improve short description
* The short description used to say that until commit
  aac7d76047 from 2014. It appears that
  it was changed by mistake in that commit to something less readable.

* With the message "use -print0/-0" we were confused and introduced a
  bug in our code because we didn't understand what to do with the
  "-0".

* SC2011 (source
  c9e27c2470/src/ShellCheck/Analytics.hs (L591))
  uses that exact warning message, we copied it from there.

Signed-off-by: Bruce Ricard <bricard@vmware.com>
2023-07-28 14:19:54 -04:00
Joseph C. Sible f03c437e2f Get rid of a dangerous partial function from checkSpacefulnessCfg' 2023-05-24 16:38:53 -04:00
Vidar Holen 8c5fdc3522 Update copyright years 2022-12-12 21:49:19 -08:00
Vidar Holen 0786b2bf3c
Merge pull request #2601 from mavit/colon-after-exec
Permit colon after exec
2022-11-02 21:18:56 -07:00
Vidar Holen 14056a7f3a Don't suggest pgrep for `ps -p .. | grep` (fixes #2597) 2022-10-12 20:22:02 -07:00
Vidar Holen a524929b69 Remove outdated test 2022-10-12 20:22:02 -07:00
Christian Nassif-Haynes 43aca62ca7 Fix false positive for SC2312 when using `time` 2022-10-10 03:33:38 +11:00
Peter Oliver 128351f5ef Permit colon after exec
ShellCheck throws warning SC2093 when a script contains commands that could never be executed because they are after an `exec`.  Command `:` does nothing, so add it to the list of commands that don’t trigger this warning.
2022-10-07 17:02:31 +01:00
Vidar Holen bd65b67578
Merge pull request #2586 from DoxasticFox/issue-2537
Suppress SC2311 with `set -o posix`
2022-09-25 11:04:30 -07:00
Christian Nassif-Haynes ef5f9a7af5 Add `mapfile` to harmless commands for SC2094 2022-09-25 03:04:20 +10:00
Christian Nassif-Haynes 581981ba76 Suppress SC2311 with `set -o posix` 2022-09-24 07:20:48 +10:00
Vidar Holen fcc473e27f Include inherited env for DFA of leftover functions (fixes #2560) 2022-09-21 18:11:18 -07:00
Vidar Holen 0df9345142 Trace numerical status, use for SC2071 (ref #2541) 2022-08-02 11:29:56 -07:00
Vidar Holen f440912279 Refactor to not generate Parameters twice 2022-07-28 08:26:56 -07:00
Vidar Holen e9784fa9a7 Refine #2544 to not warn when $? postdominates [ ] (fixes #2544) 2022-07-25 12:00:59 -07:00
Vidar Holen 982681fc05 Add unit test to ensure SC2321 does not trigger on associative arrays 2022-07-24 14:30:31 -07:00
Vidar Holen 52dac51cd4 SC2323: Warn about redundant parens in a[(x+1)] and $(( ((x)) )) (ref: #1666) 2022-07-24 14:18:38 -07:00
Vidar Holen 30bb0e0093 SC2321: Warn about redundant $(()) in arr[$((i))]=x (ref: #1666) 2022-07-24 14:18:38 -07:00
Vidar Holen 5cf6e01ce9 Warn when $? refers to echo or condition (ref #2541) 2022-07-23 09:39:26 -07:00
Vidar Holen 2f28847b08 Normalize spaces around = in unit tests 2022-07-22 16:35:14 -07:00
Vidar Holen e47480e93a Also emit SC2004 for array indices (fixes #1666) 2022-07-22 16:29:52 -07:00
Vidar Holen 3ee4419ef4 Suppress SC2086 for variables declared -i (ref #2541) 2022-07-22 08:53:27 -07:00
Vidar Holen da4885a71d Use DFA for SC2086 2022-07-20 08:08:44 -07:00
Vidar Holen 642ad86125 Add SC2317 warning about unreachable commands 2022-07-20 08:08:41 -07:00
Vidar Holen f77a545282 Control Flow Graph / Data Flow Analysis support 2022-07-20 08:08:24 -07:00
Vidar Holen a4042f7523 Parse &&/|| as left-associative 2022-07-20 08:08:24 -07:00
Vidar Holen 363c0633e0 When reparsing array indices, do it recursively 2022-07-20 08:08:24 -07:00
Rune Juhl Jacobsen 3a118246ef
Fix bug in 2126 when using after/before flags with grep
Using `--after-context`/`-A` or `--before-context`/`-B` would give a warning
recommending the user to use `grep -c`, even though that would give a different
result than using `grep | wc -l`:

```fundamental
$ echo -e "1\n2\n3" | grep -cA 3 1
1
$ echo -e "1\n2\n3" | grep -A 3 1 | wc -l
3
```
2021-12-14 16:03:29 +01:00
Vidar Holen d7971dafd1 Minor formatting fixes 2021-12-04 17:37:12 -08:00
Martin Schulze 9092080a84 bats: Add check for useless negation (SC2314/15) 2021-11-15 12:01:12 +01:00
Vidar Holen 499c99372e Rewrite SC2032 warning and mention line number (fixes #2353) 2021-11-14 21:34:21 -08:00
Vidar Holen d9a9d5db86 Mark prefix/postfix inc/dec as integers (fixes #2376) 2021-11-14 16:39:32 -08:00