Commit graph

1495 commits

Author SHA1 Message Date
Joseph C. Sible
bd116f252b Use findM instead of filterM
Using filterM makes us run the monadic predicate on every list element.
Use findM instead so that we can stop once we find a matching one.
2020-02-08 22:55:45 -05:00
Joseph C. Sible
ef51ed3950
Simplify literalEquals 2020-02-08 14:09:17 -05:00
Vidar Holen
61b073d507 Merge pull request #1817 from furkanpham/master
README.md: Fix pre-compiled binary URL for aarch64
2020-02-08 10:48:37 -08:00
Vidar Holen
9d604ae732
Merge pull request #1822 from yetamrra/arrayindex
SC2191: Tighten index checks
2020-02-08 10:48:07 -08:00
Vidar Holen
1ca0b72329
Merge pull request #1816 from josephcsible/cleanups
Various cleanups and refactorings
2020-02-08 10:38:27 -08:00
Benjamin Gordon
474b23d6e7 SC2191: Tighten index checks
When adding a value containing an equals sign to an indexed array, the
left side is treated as an index if it looks like [N]=val and N is
numeric.  SC2191 currently warns about anything that looks like key=val
even though non-numeric values of key will never be treated as an index.
This causes spurious warnings for the common pattern of building up
program arguments in an array, such as:
  args=(
    --dry-run
    --in="${my_var}"
    --out=/some/path
    -f
  )
  /bin/program "${args[@]}"

Since only numeric expressions can be a valid index for an indexed
array, only emit SC2191 if the left side of a literal string containing
an equals looks numeric.  Other more complicated constructs should still
warn because shellcheck doesn't know if they may evaluate to a numeric
result.  Associative arrays still warn because a non-numeric left side
is a valid subscript.
2020-02-05 16:50:32 -07:00
Furkan Pham
fe2b4b5079 Fix pre-compiled binary URL for aarch64 2020-02-03 13:00:10 +01:00
Joseph C. Sible
e820a5642b Adjust a pattern to get rid of a fromJust 2020-02-02 00:40:22 -05:00
Joseph C. Sible
392b57b8e8 Use maybe instead of isJust and fromJust 2020-02-02 00:27:05 -05:00
Joseph C. Sible
6595e14d25 Adjust a pattern to avoid tail 2020-02-02 00:24:24 -05:00
Joseph C. Sible
115ef29079 Use pattern matching instead of head 2020-02-02 00:16:59 -05:00
Joseph C. Sible
76b798394f Use case matching instead of null
Using null followed by a head, tail, or a partial pattern match is
an anti-pattern. Use case matching instead.
2020-02-01 23:07:16 -05:00
Joseph C. Sible
8a005526cc Use drop instead of splitAt since we only use the second half 2020-02-01 23:04:04 -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
f25b8bd03a Use gets instead of fmapping the result of get 2020-02-01 22:50:20 -05:00
Joseph C. Sible
d7278b95f2 Remove unnecessary "map snd" 2020-02-01 22:50:19 -05:00
Joseph C. Sible
5487b3f229 Use sortOn instead of sortBy and comparing 2020-02-01 22:50:18 -05:00
Joseph C. Sible
28978a8b65 Use maybe instead of fromMaybe and fmap 2020-02-01 22:50:17 -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
Joseph C. Sible
93be86f988 Use "drop 1" instead of clumsily rewriting it 2020-02-01 22:50:14 -05:00
Joseph C. Sible
3449e6be21 Get rid of our getOpt, as it already exists as lookup 2020-02-01 22:50:13 -05:00
Joseph C. Sible
2e52c2b56a Use notElem instead of not on the result of elem 2020-02-01 22:50:11 -05:00
Vidar Holen
1696296c0a Make SC2141 trigger more broadly 2020-02-01 16:51:40 -08:00
Marcin Szydelski
93486ed6ac SC2016: disable for mumps -run %XCMD and LOOP%XCMD 2020-01-21 12:43:27 +01:00
Artur Klauser
499e0ceaba
Add multi-architecture Docker image build
* Adds a shell script with functions to install multi-architecture docker
  support, as well as build, deploy, and test the shellcheck docker images for
  the same set of architectures for which binaries were already built and
  deployed as tarballs.
* Hooks up the multi-architecture docker build, deploy, and test to the existing
  Travis CI/CD pipeline. It is organized as a separate stage which only runs if
  all previous steps in the already existing test stage succeed.
2020-01-07 21:05:17 +01:00
Vidar Holen
ff5f29f661
Merge pull request #1784 from ArturKlauser/travis-warnings
Fix Travis warnings
2020-01-05 12:53:42 -08:00
Vidar Holen
c7bf1fd96e
Merge pull request #1783 from ArturKlauser/fix-osx-travis-build
Fix OSX build on Travis
2020-01-05 12:53:28 -08:00
Artur Klauser
b96b7f35f4
Fix Travis warnings
Fixing the following Travis build config validation warnings:
  * root: deprecated key sudo (The key `sudo` has no effect anymore.)
  * root: missing os, using the default linux
  * deploy: key local-dir is not underscored, using local_dir
  * language: value sh is an alias for shell, using shell
  * root: key matrix is an alias for jobs, using jobs
2019-12-28 14:24:23 +01:00
Artur Klauser
926ee54036
Fix OSX build on Travis
Symlink was failing due to pre-existing target file:
  sudo ln -s /usr/local/bin/gsha512sum /usr/local/bin/sha512sum
  ln: /usr/local/bin/sha512sum: File exists
2019-12-28 09:51:11 +01:00
Vidar Holen
9008a6833b
Merge pull request #1711 from renatoassis01/master
add github actions link
2019-12-21 18:53:16 -08:00
Vidar Holen
ce60a1764f Merge branch 'jabberabbe-iss1724-builtin-support' 2019-12-21 18:50:52 -08: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
83187dafd7 Added a unit test for parsing shell keyword case branches 2019-12-21 17:59:09 -08:00
Vidar Holen
d919aaa847 Merge branch 'Gandalf--issue_1731_case_pattern_literals' 2019-12-21 17:56:26 -08:00
Gandalf-
3f296a08c1 Issue 1731 Literals in case patterns
https://github.com/koalaman/shellcheck/issues/1731

Any literal except esac is valid pattern in a case statement
2019-12-18 20:23:48 -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
Vidar Holen
5c7d8129ad Try to search for binary on macOS/Cabal3 2019-11-18 17:12:25 -08:00
Vidar Holen
e075cde357 Revert docker image to 18.04 since ld fails on later versions 2019-11-16 11:46:58 -08:00
Vidar Holen
9f578f41a1 Explicitly add 'mappend' for old GHC versions 2019-11-16 11:16:15 -08:00
Vidar Holen
2c026f1ec7 Support Cabal 3. Man page no longer autobuilds. 2019-11-16 11:06:18 -08:00
Vidar Holen
874bdcb514
Merge pull request #1728 from mgttlinger/patch-1
Nix install instructions
2019-11-15 21:03:01 -08:00
Vidar Holen
fa3eb47193
Merge pull request #1716 from ryantig/ryantig-patch-1
Update README.md
2019-11-15 21:01:24 -08:00
Vidar Holen
989ac32625
Merge pull request #1734 from gabrielelana/braced-regular-for
Parse regular `for` with body in curly braces
2019-11-15 20:59:51 -08:00
Vidar Holen
2bbfd0570d
Merge pull request #1735 from gabrielelana/quoted-heredoc
Support for heredoc quoted token like `'"FOO"`
2019-11-15 20:27:10 -08:00
Vidar Holen
9b1befadc1 Update brew before building on macOS due to incompatible Ruby 2019-11-15 09:26:01 -08:00
Vidar Holen
f44624a9c0 Hide <> from Writer to not conflict with Semigroup 2019-11-14 20:02:25 -08:00
Vidar Holen
c75bbcbd60 Include missing Semigroup import 2019-11-13 22:10:27 -08:00