Commit graph

68 commits

Author SHA1 Message Date
Joseph C. Sible
aaffe38198 Use the Identity monad to avoid unnecessary uses of fromJust 2020-02-08 23:20:54 -05:00
Joseph C. Sible
392b57b8e8 Use maybe instead of isJust and fromJust 2020-02-02 00:27:05 -05:00
Joseph C. Sible
c29b6afa56 Use null instead of comparing with empty lists 2020-02-01 23:04:04 -05:00
Joseph C. Sible
e6e89d68fd Use list comprehensions instead of clunky combinations of map and filter 2020-02-01 23:04:04 -05:00
Joseph C. Sible
d7278b95f2 Remove unnecessary "map snd" 2020-02-01 22:50:19 -05:00
Joseph C. Sible
f5c6771016 Use find instead of listToMaybe and filter 2020-02-01 22:50:16 -05:00
Joseph C. Sible
0f48bb78a5 Remove incorrect otherwise
You're supposed to use otherwise where you need a Boolean, not a pattern
match. This is misleadingly shadowing the real otherwise. Use _ instead.
2020-02-01 22:50:14 -05:00
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
e701cf6fad Warn about [ x -ot y ] in POSIX mode 2019-11-03 13:25:35 -08:00
Tito Sacchi
84ca7711c4 Make command-specific checks act on builtin ...
Now if shellchecks encounters a command like `builtin cmd ...`
it applies the same check that would be applied to `cmd ...`.
2019-11-01 14:28:00 +01:00
Vidar Holen
4dfd7eb1cf Use single quotes for the format string example in SC2059 2019-10-24 10:33:17 -07:00
Vidar Holen
7473d4a743 Make read -t 0 test more forgiving towards other flags 2019-10-12 20:45:36 -07:00
Vidar Holen
38bb156a1c Warn about $_ in POSIX sh (fixes #1647) 2019-07-21 21:22:16 -07:00
Vidar Holen
023ae5dfda Don't warn about printf '%()T' without corresponding argument 2019-07-20 15:10:41 -07:00
Vidar Holen
914974bd4f Don't consider .* a glob-like regex (fixes #1214) 2019-07-04 17:41:23 -07:00
Vidar Holen
c0d3a98fcd Add warning for chmod -r (fixes #1321) 2019-07-04 16:54:42 -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
f4be53eb19 Warn about [ -v var ] for POSIX sh 2019-06-02 10:28:20 -07:00
Vidar Holen
52a9d90e1a
Merge pull request #1580 from virgilwashere/copyright
Update Copyright to year 2019; README linting
2019-05-19 12:03:15 -07:00
Benjamin Gordon
aa3b709b5d Track whether braces were present in T_DollarBraced
References of the form $var and ${var} both map to the same structure in
the AST, which prevents any later analysis functions from distinguishing
them.  In preparation for adding checks that need this info, add a Bool
to T_DollarBraced that tracks whether the braces were seen at parsing
time and update all references so that this change is a no-op.
2019-05-14 11:01:38 -06:00
Virgil
ea05271fa3 📝 Update Copyright to year 2019 and Markdown linting
- [x] 📝 Update Copyright to year 2019

- [x] 📝 MD009/no-trailing-spaces: Trailing spaces [Expected: 0 or 2; Actual: 1]
- [x] 📝 MD034/no-bare-urls: Bare URL used

- [ ] 📝 ~MD004/ul-style: Unordered list style [Expected: dash; Actual: asterisk]~
- [ ] ~add missing TOC entries~
2019-05-14 20:12:34 +10:00
Vidar Holen
e2e65e1350 Warn about arithmetic base conversation in sh (fixes #1547) 2019-04-29 18:02:44 -07:00
Cristian Adrián Ontivero
d3f6e045e2 Check wait flags in dash & POSIX sh
Flags for the wait builtin are undefined under both POSIX sh and dash.
Bash though, accepts [-fn].
2019-02-10 12:44:22 +01:00
Vidar Holen
d984f8cbe7 Don't look at 'set' options after a non-literal. 2019-02-08 22:36:22 -08:00
Cristian Adrián Ontivero
acef53be9c Check set flags under dash & POSIX sh (fixes #990)
The set builtin accepts certain flags, and some longer synonyms (for
instance set -e is the same as set -o errexit) under POSIX sh. This
makes ShellCheck warn if any of the used flags and options are
undefined when targeting POSIX sh.

This fixes #990, while adding general flag-support checking for set in
the process.
2019-02-03 17:27:36 +01:00
Cristian Adrián Ontivero
a669e1684b
Check hash flags under dash and POSIX sh
Flags for the hash builtin other than [-r] are undefined under POSIX sh.
Dash also accepts [-v], while bash adds [-l] [-p filename] [-dt] aside
from [-r].
2019-01-27 08:22:37 +01:00
Vidar Holen
420d913bbf Merge branch 'issue_1330_unsupported_echo_flags' of https://github.com/Gandalf-/shellcheck 2019-01-26 20:16:34 -08:00
Gandalf-
112a7d8b9b Issue 1330 unsupported echo flags
Issue https://github.com/koalaman/shellcheck/issues/1330

Addresses false positives when quoted arguments to echo begin with what
looks like a flag. Now, warn only when the first argument is a
recognized echo flag when flags are unsupported.
2019-01-24 19:00:19 -08:00
Cristian Adrián Ontivero
31c5601c5e
Check unset flags under dash and POSIX sh
The only acceptable flags for the unset builtin under POSIX sh and dash
are [-fv]. Bash though, accepts [-n] too. This commits makes shellcheck
warn about this.
2019-01-23 06:35:08 +01:00
Cristian Adrián Ontivero
63a259e5be
Check type flags under dash and POSIX sh (fixes #1471)
There are no flags for the type builtin defined under POSIX sh, nor does
dash define any. Bash, however, allows [-aftpP]. We check this now under
POSIX and dash.
2019-01-21 19:49:14 +01:00
Vidar Holen
978bfdd5da
Merge pull request #1462 from contivero/trap-flags
Check trap flags under dash & POSIX sh (fixes #1461)
2019-01-20 14:48:01 -08:00
Vidar Holen
a03d94c0b2
Merge pull request #1468 from Gandalf-/issue_824_grep_fixed_strings
Issue 824 grep fixed strings and SC2063
2019-01-20 14:06:40 -08:00
Vidar Holen
e1fe9be7af Fix minor details in new Bats support 2019-01-20 14:02:42 -08:00
Gandalf-
661be056f1 Issue 824 grep fixed strings and SC2063
Issue https://github.com/koalaman/shellcheck/issues/824

Fix up to original change to include '--fixed-strings' in the grep +
regex special cases.
2019-01-19 08:49:26 -08:00
Cristian Adrián Ontivero
8e31e86cc4
Check trap flags under dash & POSIX sh (fixes #1461) 2019-01-16 08:44:41 +01:00
Vidar Holen
c6c615217b Allow specifying that flags should not be checked for support.
This was motivated by the fact that `-a` was missing from Dash's
long list.
2019-01-15 19:50:23 -08:00
Cristian Adrián Ontivero
3107a1bae0
Check umask flags under dash & POSIX sh (fixes #1459) 2019-01-15 08:24:23 +01:00
Cristian Adrián Ontivero
c3a56659f4
Check cd flags under dash & POSIX sh (fixes #1457) 2019-01-14 08:18:17 +01:00
Cristian Adrián Ontivero
3760e7945f
Check readonly flags in dash/POSIX sh (fixes #1448) 2019-01-10 11:05:37 +01:00
Vidar Holen
df7f00eaed Remove duplicate pathTo and unused replaceMultiLines 2019-01-09 17:51:43 -08:00
Vidar Holen
0e21f91c07
Merge pull request #1433 from contivero/fix-export-p
Fix 'export -p' being undefined under POSIX sh
2019-01-08 19:33:03 -08:00
Vidar Holen
4ecdc10599 Merge branch 'shellcheck_sed_herestring_130' of https://github.com/Gandalf-/shellcheck 2019-01-08 19:19:44 -08:00
Vidar Holen
baa4d2e555 Let checkGrepRe only parse flags once 2019-01-08 19:06:00 -08:00
Gandalf-
4a2b2c7396 Issue 1404 grep glob false positives
https://github.com/koalaman/shellcheck/issues/1404

Some grep flags support globs; these are now all checked prevent false
positives.
2019-01-06 17:45:29 -08:00
Gandalf-
9425654a42 Expand echo + sed style warning to herestrings
https://github.com/koalaman/shellcheck/issues/130
2018-12-31 15:33:37 -08:00
Cristian Adrián Ontivero
29dedbdc9c
Fix 'export -p' being undefined under POSIX sh
Fixes #1432
2018-12-28 21:23:49 -03:00
Cristian Adrián Ontivero
73a41cdd2f
Check jobs flags in dash/POSIX sh (fixes #1429) 2018-12-28 10:04:19 -03:00
Ng Zhi An
bd04af0769 Update supported ulimit flags for dash
Values are retrieved from https://linux.die.net/man/1/dash, search for
ulimit.

Fixes #1406
2018-12-25 09:33:58 +08:00
Vidar Holen
cb76951ad2 Add warnings for 'exit' similar to 'return' (fixes #1388) 2018-11-24 23:05:40 -08:00