Commit Graph

668 Commits

Author SHA1 Message Date
Vidar Holen b7a8b090d2 SC2229: Warn about 'read $var' 2018-02-25 13:47:58 -08:00
Vidar Holen 6511dc0246 Add missing import 2018-02-25 13:29:06 -08:00
Vidar Holen 6d257bfa17 Warn about 'while!' and 'while:' 2018-02-17 21:58:29 -08:00
Vidar Holen d8717c7046 s/parser error/syntax error/g 2018-02-17 17:18:05 -08:00
Vidar Holen 7aa3a7ffc3 Improve message for SC2163 (export $var). Helps #1117 2018-02-17 17:12:11 -08:00
Jordan Atwood f73d6f2332
Add test for `local` keyword in SC2154
Follow-up to koalaman/shellcheck#988
2018-02-07 17:50:55 -08:00
Martin Kühl ccaacb108a SC2029: Skip when there are options to ssh
Fixes #327

SC2029 generates false positives when given an ssh command that includes
options with arguments because it assumes the first non-option must be
the host:port argument and the last argument is a command to run.
As suggested the comments on #327, this change fixes those by skipping
the check when there are any options present.
2018-01-24 13:05:22 +01:00
Martin Kühl 56751413b4 SC2029: Add false positive test
This change adds a test case for a valid command that gets falsely
flagged with SC2029.
2018-01-24 13:04:26 +01:00
Vidar Holen ba5f20deda Fix parsing of escaped chars in regex groups. Fixes #1077 2018-01-21 16:13:16 -08:00
Vidar Holen c86885427c Warn about comments/blanks before shebang. Fixes #844 2018-01-21 13:57:44 -08:00
Vidar Holen 7b3c4025fb Warn about redirs in the middle of 'find' commands. Fixes #405 2018-01-21 11:12:22 -08:00
Vidar Holen 3b004275cf Add unit test for issue #1091 2018-01-20 11:42:31 -08:00
Stefan Knudsen dbdab5705f Use readVariableName combinator 2018-01-19 16:19:06 -05:00
Vidar Holen 46a3019ed7 Fix annotations for here documents (fixes #1071) 2018-01-17 19:20:10 -08:00
Vidar Holen 81978d15bd Remove unused here doc boundary concept. 2018-01-17 18:48:17 -08:00
Vidar Holen a6fb9d1ef8 Warn about C-style comments 2018-01-17 18:14:36 -08:00
Vidar Holen 5b14dba489 Parse 'else if' correctly, and not like elif. Fixes #1088. 2018-01-13 22:42:19 -08:00
Vidar Holen 2d5ed23ca1 Warn about cp/mv/ln with a single argument. Fixes #1080. 2018-01-13 16:44:58 -08:00
Vidar Holen 31d6b063d9 Improve indented here doc token message. 2018-01-10 21:12:22 -08:00
Vidar Holen 3c5c74ff04 Add quote warning specific to : ${var=val}. Fixes #1084 2018-01-06 10:53:53 -08:00
Vladimir Panteleev 6ed60b403f Extend SC2216/SC2217 with 'true' and 'false' 2017-12-21 03:29:17 +00:00
Mike Frysinger 161801a86e convert http:// URIs to https://
Also update the ShellCheck homepage to the new dedicated domain.
2017-12-14 01:06:43 -05:00
koalaman 51e6bf809f
Merge pull request #1041 from LukeShu/fix-isClosingFileOp
Fix isClosingFileOp (fixes issue #862)
2017-11-08 10:15:21 -08:00
Vidar Holen 53f63b85bb Use Data.Map.Strict instead of Map.insertWith' 2017-11-05 20:11:04 -08:00
Luke Shumaker df068bc8ed Fix isClosingFileOp (fixes issue #862)
The isClosingFileOp function expected closing file ops to use T_IoFile, but
they actually use T_IoDuplicate; so it effectively always returned False.
2017-11-05 18:53:01 -05:00
Vidar Holen 102683ab04 Try to warn when using directives after commands (#981) 2017-11-04 15:22:17 -07:00
Vidar Holen acead72c93 Improve directive parsing 2017-10-29 17:39:13 -07:00
Vidar Holen 0c1e2bbd4d Warn when using directives in front of elif and case items (#1036) 2017-10-29 16:31:46 -07:00
Vidar Holen 3785a08906 Don't suggest $@ in [[ $* = "" ]] (#976) 2017-10-01 10:27:21 -07:00
Vidar Holen 74c199b51a Warn when one case pattern overrides another. 2017-09-16 15:23:51 -07:00
Vidar Holen 371dcdda3a Warn about missing default case for getopts. 2017-09-16 10:26:28 -07:00
Vidar Holen 38044e3f75 Fix 2062 for grep -e -foo bar* and --regex -foo bar* 2017-09-09 17:03:29 -07:00
Vidar Holen b0f6f935f3 Don't suggset quoting in grep -- -foo bar* (#517) 2017-09-09 16:57:06 -07:00
Vidar Holen bd2facb245 Suggest (( expr )) over let expr (#813) 2017-09-09 16:07:38 -07:00
Vidar Holen 895ba31337 Add ^@![]/ to allowed function characters (#909) 2017-09-09 15:34:08 -07:00
Jordan Atwood 7f36c369f3
SC2154: Fix false positive on `local` 2017-09-06 15:40:31 -07:00
Vidar Holen 8dd40efb44 Add support for -a: emit for sourced files. 2017-08-13 19:34:45 -07:00
Martin Schwenke 807d899f3b Fix incorrect detection of bash-style substring expansion
Substring expansion detection only considers ':' as a separator..  It
needs to avoid triggering for ":-", ":=", ":+" and ":?", since they
mean other things.

This is a regression introduced by commit
a90b6d14b3

Signed-off-by: Martin Schwenke <martin@meltin.net>
2017-07-20 15:59:05 +10:00
Vidar Holen 81388cefd2 Warn when calling functions before defining them. 2017-07-10 22:53:26 -07:00
Vidar Holen 43bb6a20ad Improve message for SC1052-54 about 'then;' 2017-07-08 17:25:54 -07:00
Vidar Holen 8f99d2b008 Don't warn about missing path for find -O3 . (#942) 2017-07-08 15:46:02 -07:00
Vidar Holen 79ae89076a Swap SC1041 and SC1042 for better sort order. 2017-07-08 15:21:58 -07:00
Vidar Holen aa33280cb0 Improve here doc diagnosis 2017-07-08 14:00:02 -07:00
Vidar Holen bd13224907 Use standard Haskell 'void' instead of custom 2017-07-08 10:23:51 -07:00
Vidar Holen b064cf3038 Fix parsing here docs like << '#foo' (#947) 2017-07-07 22:26:12 -07:00
Vidar Holen 1463cf773a Suggest explicit escape "\\n" for "\n" 2017-07-04 11:06:52 -07:00
Vidar Holen 31bb02d6b7 Ignore leading \ for commands (#927) 2017-07-03 16:40:11 -07:00
Vidar Holen 5bd33dbf92 Warn when piping/redirecting to mv/cp/echo/etc (#921) 2017-07-03 16:02:58 -07:00
Vidar Holen a3c6aff0fb Improve parsing of line breaks in for statements (#926) 2017-07-03 13:58:10 -07:00
Vidar Holen 8184ef1e8b Don't complain about missing space in {( (#937) 2017-07-03 12:22:19 -07:00