Skip to content

Commit df67ec7

Browse files
Add shellcheck github workflow (#190)
* Add shellcheck github workflow * Fix shellcheck * Remove shellcheck exceptions
1 parent a47547d commit df67ec7

File tree

4 files changed

+33
-3
lines changed

4 files changed

+33
-3
lines changed

.github/workflows/shellcheck.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: shellcheck
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
jobs:
10+
shellcheck:
11+
name: Run shellcheck on scripts
12+
runs-on: ubuntu-22.04
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
16+
17+
- name: Run shellcheck
18+
uses: ludeeus/action-shellcheck@00cae500b08a931fb5698e11e79bfbd38e612a38

bin/bootstrap

+12-3
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,10 @@ system("rm -rf %s" % File.join(dir, ".git"))
4545
system("rm -rf %s" % File.join(dir, "Gemfile"))
4646
system("rm -rf %s" % File.join(dir, "Gemfile.lock"))
4747
system("rm -rf %s" % File.join(dir, ".ruby-version"))
48-
system("rm -rf %s" % File.join(dir, "bin/bootstrap"))
49-
system("rm -rf %s" % File.join(dir, ".github/ISSUE_TEMPLATE.md"))
50-
system("rm -rf %s" % File.join(dir, ".github/workflows/pause-community-contributions.yml"))
48+
system("rm -rf %s" % File.join(dir, "bin", "bootstrap"))
49+
system("rm -rf %s" % File.join(dir, ".github", "ISSUE_TEMPLATE.md"))
50+
system("rm -rf %s" % File.join(dir, ".github", "workflows", "pause-community-contributions.yml"))
51+
system("rm -rf %s" % File.join(dir, ".github", "workflows", "shellcheck.yml"))
5152
system("mv %s/TRACK_README.md %s/README.md" % [dir, dir])
5253

5354
f = File.join(dir, 'LICENSE')
@@ -62,6 +63,14 @@ File.open(f, "w") do |f|
6263
f.write contents.gsub('{{UUID}}') {|m| SecureRandom.uuid }
6364
end
6465

66+
%w[verify-exercises verify-exercises-in-docker].each do |name|
67+
f = File.join(dir, 'bin', name)
68+
contents = File.read(f)
69+
File.open(f, "w") do |f|
70+
f.write contents.gsub(/^\s*# shellcheck.*?\n/, '')
71+
end
72+
end
73+
6574
[
6675
"config.json",
6776
"README.md",

bin/verify-exercises

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ copy_example_or_examplar_to_solution() {
2929
}
3030

3131
unskip_tests() {
32+
# shellcheck disable=SC2034
3233
jq -r '.files.test[]' .meta/config.json | while read -r test_file; do
3334
noop # TODO: replace this with the command to unskip the tests.
3435
# Note: this function runs from within an exercise directory.

bin/verify-exercises-in-docker

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ copy_example_or_examplar_to_solution() {
3030
}
3131

3232
pull_docker_image() {
33+
# shellcheck disable=SC1083
3334
docker pull exercism/{{SLUG}}-test-runner ||
3435
die $'Could not find the `exercism/{{SLUG}}-test-runner` Docker image.\nCheck the test runner docs at https://exercism.org/docs/building/tooling/test-runners for more information.'
3536
}
@@ -38,6 +39,7 @@ run_tests() {
3839
local slug
3940
slug="${1}"
4041

42+
# shellcheck disable=SC1083
4143
docker run \
4244
--rm \
4345
--network none \

0 commit comments

Comments
 (0)