Commit Graph

76 Commits

Author SHA1 Message Date
Vidar Holen cbcca528ae Merge branch 'iss1724-builtin-support' of https://github.com/jabberabbe/shellcheck into jabberabbe-iss1724-builtin-support 2019-12-21 18:13:07 -08:00
Vidar Holen 0f15fa49ba Make SC2230 optional 2019-12-07 16:11:49 -08:00
Vidar Holen 0a4580e234 Mention that ShellCheck is now compatible with Cabal 3 2019-12-07 16:11:49 -08:00
Benjamin Gordon 2341a4c683 SC2256: Check for translated strings matching known variables
SC2247 already warns about translated strings that look like $"(foo)" or
$"{foo}".  Since typical use of translated strings is to translate whole
messages, a string like $"foo" is likely to be a similar mistake if foo
is the name of an existing variable.  Conversely, a string like
$"foo bar" is potentially meant to be a message id even if foo is a
known variable.

Add a warning for the $"foo" case, but make it separate from the
existing warning so that projects that reuse variable names as their
message ids can separately disable the new warning.
2019-11-13 16:41:16 -07:00
Vidar Holen 5962b01816 Correctly handle empty variables for SC2086 (fixes #1722) 2019-11-03 12:46:25 -08:00
Tito Sacchi 5becc673b2 Modify CHANGELOG.md 2019-11-01 14:36:15 +01:00
Tito Sacchi 0e0de94045 Fix issue #1724
(bash: missing support for 'builtin' keyword)
Now shellcheck looks for the arguments to 'builtin' to determine
read/written variables. A change in the parser makes sure that
assignments are parsed correctly in commands that start with 'builtin'.
2019-11-01 13:49:17 +01:00
Vidar Holen afea62de4e Suggest using `$((..))` in `[ 2*3 -eq 6 ]` (fixes #1641) 2019-10-12 19:55:20 -07:00
Vidar Holen e01c470598 Suggest quoting case patterns, as for SC2053 (fixes #1682) 2019-09-08 20:08:43 -07:00
Vidar Holen c175971bf0 Make `-f diff` stop saying it found more issues when it didn't. 2019-07-28 20:50:50 -07:00
Vidar Holen b7b4d5d29e Stable version 0.7.0
This release is dedicated to RetroArch: the second best way to make your
PC feel like a 16bit system (right after building ShellCheck with GHC)
2019-07-28 18:12:25 -07:00
Vidar Holen b2dd00e4ee Mention aarch64 and macOS binaries in CHANGELOG 2019-07-28 17:26:31 -07:00
Vidar Holen 023ae5dfda Don't warn about printf '%()T' without corresponding argument 2019-07-20 15:10:41 -07:00
Vidar Holen bee4303c32 Add an empty Custom.hs to simplify site-specific patching 2019-07-02 20:07:05 -07:00
Vidar Holen 561075ea79 Merge branch 'shflags' of https://github.com/yetamrra/shellcheck into yetamrra-shflags 2019-07-01 20:00:28 -07:00
Vidar Holen 544047c5af Warn about ending double quotes just to make $ literal 2019-06-30 18:43:42 -07:00
Benjamin Gordon f6ba500d6b Add support for basic shflags semantics
The shflags command-line flags library creates variables at runtime
with a few well-defined functions.  This causes shellcheck to spit out
lots of warnings about unassigned variables, as well as miss warnings
about unused flag variables.

We can address this with two parts:

1. Pretend that the shflags global variables are predefined like other
   shell variables so that shellcheck doesn't expect users to set them.
2. Treat DEFINE_string, DEFINE_int, etc. as new commands that create
   variables, similar to the existing read, local, mapfile, etc.

Part 1 can theoretically be addresssed without this by following sourced
files, but that doesn't help if people are otherwise not following
external sources.

The new behavior is on by default, similar to automatic bats test
behavior.

Addresses #1597
2019-06-25 12:14:54 -06:00
Vidar Holen b1aeee564c Add a Diff output format 2019-06-23 20:02:01 -07:00
Vidar Holen 9f0ef5983a Optionally check for unassigned uppercase variables 2019-06-02 10:29:04 -07:00
Vidar Holen 3e7c2bfec0 Warn about [ $a != x ] || [ $a != y ] 2019-06-02 09:26:54 -07:00
Vidar Holen 95b1185882 Inform about ineffectual ! on commands (fixes #1531) 2019-05-22 17:14:28 -07:00
Benjamin Gordon 64c9c83cc8 SC2250: New optional check for braces around variable references
Always using braces makes it harder to accidentally change a variable by
pasting other text next to it, but the warning is off by default because
it's definitely a style preference.  Omit special and positional
variables from the check because appending additional characters to them
already doesn't change parsing.
2019-05-14 11:01:38 -06:00
Benjamin Gordon 50af8aba29 Add json1 format that ignores tabs
The new json1 format works just like json except that it treats tabs as
single characters instead of 8-character tabstops.

The main use case is to allow editors to pass -fjson1 so that they can
consume the json output in a character-oriented way without breaking
backwards compatibility.

Also addresses #1048.
2019-05-13 10:55:16 -06:00
Vidar Holen 5fb1da6814 Replace verbose checks with optional checks 2019-05-12 19:14:04 -07:00
Vidar Holen d9e419d60f Add support for source-path directives (fixes #1577) 2019-05-09 19:54:41 -07:00
Vidar Holen bf1003eae3 Auto-disable SC2119 when disabling SC2120 (fixes #703) 2019-04-27 15:20:07 -07:00
Vidar Holen c6c12f52bd Expand root paths into source paths 2019-04-24 18:51:24 -07:00
Vidar Holen 5b7354918f SC2249: When verbose, warn about missing default case (fixes #997) 2019-04-14 16:58:17 -07:00
Vidar Holen b76c0a8221 SC2248: Warn about unquoted variables without special chars 2019-04-13 20:19:13 -07:00
Vidar Holen c860b74505 Set SC2243/SC2244 level to "verbose" 2019-04-13 13:40:18 -07:00
Vidar Holen 9652ccfdbd Add a verbose mode: `-S verbose` 2019-04-13 13:16:41 -07:00
Vidar Holen f514f5f735 Warn about flipped $ and " in $"(cmd)" (fixes #1517) 2019-03-20 22:10:04 -07:00
Vidar Holen 581bcc3907 Add support for `.shellcheckrc` files 2019-03-03 18:57:13 -08:00
Vidar Holen 6dcf4b8e64 Mention extension in changelog and man page 2019-01-21 16:55:01 -08:00
Vidar Holen e1fe9be7af Fix minor details in new Bats support 2019-01-20 14:02:42 -08:00
Vidar Holen e0a4241baa Warn if a shebang's interpreter ends in / (fixes #373) 2019-01-13 17:32:25 -08:00
Vidar Holen 1835ebd3a0 SC2245: Warn that Ksh [ -f * ] only applies to first (Fixes #1452) 2019-01-13 16:41:08 -08:00
Vidar Holen 73822c3588 Allow SC2243 and SC2244 to trigger with quotes, add fix 2018-12-28 19:02:06 -08:00
Vidar Holen 3cba76dc7d Update CHANGELOG with new release and autofix merge 2018-12-09 15:01:08 -08:00
Vidar Holen cb57b4a74f Stable version 0.6.0
This release is dedicated to Factorio. If this is how much fun it is to
build factories and oppress natives, then history makes a lot of sense.
2018-12-02 19:08:06 -08:00
Vidar Holen a7a404a5a8 Fill in missing bits in CHANGELOG 2018-12-02 14:49:04 -08:00
Vidar Holen cb76951ad2 Add warnings for 'exit' similar to 'return' (fixes #1388) 2018-11-24 23:05:40 -08:00
Zero King f4044fbcc7 Fix typo in CHANGELOG 2018-11-08 03:07:52 +00:00
Vidar Holen 2827b35696 SC2240: Warn about `. script args..` in sh/dash (fixes #1373) 2018-11-07 18:04:18 -08:00
Vidar Holen df0a0d41fa Add SC1133: Warn when a line starts with |/||/&& (fixes #1359) 2018-10-21 17:46:46 -07:00
Vidar Holen 07b5aa2971 Add SC2239: shebang is not absolute path. 2018-10-17 20:38:21 -07:00
Vidar Holen e0e46e979a Add wiki links to output, and a -W controlling it. (Fixes #920) 2018-10-10 21:53:43 -07:00
Vidar Holen 3e2cb26119 Add SC2238 about redirections to command names 2018-09-17 17:46:49 -07:00
Vidar Holen 3d03b0ab3b Suggest -z/-n instead of ! -n/-z (fixes #1326). 2018-08-28 20:15:54 -07:00
Vidar Holen 49250eadae Add --severity to CHANGELOG 2018-08-18 20:06:31 -07:00