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
Vidar Holen
3b6972fbf1
Update copyright years
2021-11-06 19:07:34 -07:00
Vidar Holen
8db220ae43
Include local -r
in check-extra-masked-returns ( fixes #2362 )
2021-11-06 15:37:59 -07:00
Vidar Holen
efd49e486f
Consider all forms of TA_Assignment to remove spaces ( fixes #2364 )
2021-10-30 17:47:30 -07:00
Vidar Holen
788aee1b7c
Treat typeset similar to declare ( fixes #2354 )
2021-10-15 14:41:48 -07:00
Vidar Holen
c3aaa27540
Skip SC2214 if variable is modified in loop ( fixes #2351 )
2021-10-09 12:13:41 -07:00
Vidar Holen
205ba429b3
Warn about read foo[i]
expanding as glob ( fixes #2345 )
2021-10-07 18:50:44 -07:00
Vidar Holen
23cddb037e
Merge pull request #2320 from DoxasticFox/set-e-proc-sub
...
Add extra checks for masked return codes
2021-10-02 12:52:59 -07:00
Christian Nassif-Haynes
093df8cb24
Add extra checks for masked return codes
2021-10-02 01:36:40 +10:00
Vidar Holen
fac97a5301
Don't emit SC2140 when trapped string is /, = or : ( fixes #2334 )
2021-09-25 20:23:58 -07:00
Vidar Holen
ad92cb4112
Disable UUOC for cat with unquoted variable ( fixes #2333 )
2021-09-25 19:46:27 -07:00
Vidar Holen
e7df718724
Strip lines containing "STRIP" from ./striptests
2021-09-18 20:43:42 -07:00
Vidar Holen
b044f5b23a
Don't trigger SC2140 on ${x+"a" "b"} ( fixes #2265 )
2021-09-18 18:59:42 -07:00
Vidar Holen
8012f6761d
Suppress SC2094 when both are input redirections ( fixes #2325 )
2021-09-18 18:00:15 -07:00
Vidar Holen
9a54e91195
Merge pull request #2318 from FabianWolff/grep-lL-wc-l
...
Do not suggest `grep -c` as a replacement for `grep -l/-L | wc -l`
2021-09-16 19:40:40 -07:00
Vidar Holen
64733cc110
Merge pull request #2303 from DoxasticFox/set-e-functions
...
Show info about `set -e` suppression during function calls
2021-09-04 17:06:24 -04:00
Christian Nassif-Haynes
dc9032fca5
Show info about set -e
suppression during function calls
2021-09-05 04:23:25 +10:00
Fabian Wolff
40216487d6
Do not suggest grep -c
as a replacement for grep -l/-L | wc -l
2021-09-02 17:47:06 +02:00
Vidar Holen
747bd8fd6a
Warn about strings for numerical operators in [[ ]] ( fixes #2312 )
2021-08-30 19:50:00 -07:00
Vidar Holen
f5fd9c2fed
Improve warnings about unnecessary subshells ( fixes #2169 )
2021-08-30 10:56:55 -07:00
Vidar Holen
081f7eba24
Fix parsing of [$var] ( fixes #2309 )
2021-08-26 23:05:14 -07:00
Vidar Holen
81b7ee5598
Don't warn about unused variables starting with _ ( fixes #1498 )
2021-08-26 19:40:21 -07:00
Vidar Holen
c85ce2cb06
Add rg
to list of commands ignored for SC2016 ( fixes #2209 )
2021-08-26 18:50:40 -07:00
Vidar Holen
da7b28213e
Recognize wait -p as assigning a variable ( fixes #2179 )
2021-08-17 21:53:27 -07:00
Vidar Holen
c61fc7546e
Don't warn about variables guarded with :+ ( fixes #2296 )
2021-08-17 16:20:32 -07:00
Vidar Holen
8c0bf8d41f
Warn about looping over array values and using them as keys
2021-08-17 12:51:27 -07:00
Vidar Holen
bb0a571a1e
Improve warnings for bad parameter expansion ( fixes #2297 )
2021-08-16 21:02:20 -07:00
Vidar Holen
fed4a048bc
Suppress SC2167 when name is "_" ( fixes #2298 )
2021-08-13 23:11:20 -07:00
Vidar Holen
cf8066c07c
SC2295 Warn about unquoted variables in PE patterns ( fixes #2290 )
2021-08-03 13:02:53 -07:00
Vidar Holen
e33146d530
Avoid trigger SC2181 on composite $? checks ( fixes #1167 )
2021-07-29 20:51:19 -07:00
Vidar Holen
fe81dc1c27
Optionally suggest [[ over [ in Bash scripts (-o require-double-brackets) ( fixes #887 )
2021-07-27 18:53:30 -07:00
Vidar Holen
fbc8d2cb2f
Don't consider [ -n/-z/-v $var ] assignments for subshell modification ( fixes #2217 )
2021-07-27 09:33:22 -07:00
Vidar Holen
c471e45822
Allow printf/return/assignments after exec ( fixes #2249 )
2021-07-26 19:32:33 -07:00
Vidar Holen
4956b006ac
Fix broken test from previous commit
2021-07-25 19:56:51 -07:00
Vidar Holen
02e07625d1
Warn about quoting in assignments to sh declaration utilities ( fixes #1556 )
2021-07-25 19:36:42 -07:00
Vidar Holen
44471b73cc
Have SC2155 trigger on 'typeset' as well ( fixes #2262 )
2021-07-25 17:34:14 -07:00
Vidar Holen
0d58337cdd
Don't warn about repeated range in [[ -v arr[xxx] ]] ( fixes #2285 )
2021-07-25 13:01:57 -07:00
Vidar Holen
99f6554c9b
SC2181: Add '!' in suggestion as appropriate ( fixes #2189 )
2021-07-18 16:59:45 -07:00
Vidar Holen
022bc8277c
Merge pull request #2238 from bcran/legacy-backticks-msg
...
Fix typo in SC2006 message: "backticked" vs "backticks"
2021-07-02 09:55:18 -07:00
Vidar Holen
163b2f12e2
Sanity check command names ( fixes #2227 )
2021-06-05 18:16:22 -07:00
Rebecca Cran
b61a7658d6
Fix typo in SC2006 message: "backticked" vs "backticks"
2021-05-24 13:33:50 -06:00
Vidar Holen
331e89be99
Fix bad warning for ${#arr[*]}. Fixes #2218 .
2021-04-26 10:44:33 -07:00
Vidar Holen
fe25a2b00e
Treat ${arr[*]} like $* for SC2048
2021-04-24 17:08:10 -07:00
Vidar Holen
9e60b3ea84
Fix haddock failures ( fixes #2216 )
2021-04-22 22:17:51 -07:00
Vidar Holen
5669eb2203
Make x-comparison warning default
2021-04-11 15:52:13 -07:00
Vidar Holen
f02c297fdd
Merge parser and analyzer shebang parsing
2021-03-11 23:04:17 -08:00