Skip to content

Commit

Permalink
Makefile: add check_with_docker
Browse files Browse the repository at this point in the history
  • Loading branch information
ko1nksm committed Jul 19, 2024
1 parent 0b77ec7 commit be21b05
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions .shellcheck-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v0.10.0
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,18 @@ build: bin/getoptions bin/gengetoptions
clean:
rm -f bin/getoptions bin/gengetoptions getoptions.tar.gz gengetoptions.tar.gz

check:
check: build
shellcheck --version
shellcheck src/* lib/*.sh spec/*.sh examples/*.sh
bin/gengetoptions library --shellcheck | shellcheck -s sh -
bin/gengetoptions parser -f examples/parser_definition.sh --shellcheck parser_definition parser prog | shellcheck -

check_with_docker: build
support/shellcheck.sh --version
support/shellcheck.sh src/* lib/*.sh spec/*.sh examples/*.sh
bin/gengetoptions library --shellcheck | support/shellcheck.sh -s sh -
bin/gengetoptions parser -f examples/parser_definition.sh --shellcheck parser_definition parser prog | support/shellcheck.sh -

test:
shellspec

Expand Down
8 changes: 8 additions & 0 deletions support/shellcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh

set -eu

version=$(cat .shellcheck-version)
cid=$(docker create --rm -i "koalaman/shellcheck:$version" "$@")
docker cp -q ./ "$cid:/mnt"
docker start -ai "$cid"

0 comments on commit be21b05

Please sign in to comment.