Skip to content

Commit 963d66b

Browse files
authored
Merge pull request #323 from DannyBen/fix/static-ci
Fix static analysis in CI
2 parents e7fc336 + 17fa9c8 commit 963d66b

File tree

3 files changed

+31
-6
lines changed

3 files changed

+31
-6
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,9 @@ jobs:
5959
ruby-version: '3.1'
6060
bundler-cache: true
6161

62+
- name: Generate all subjects
63+
run: bundle exec run examples regen
6264
- name: Run shellcheck tests
6365
run: bundle exec run shellcheck
64-
6566
- name: Run shfmt tests
6667
run: bundle exec run shfmt

Runfile

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ end
2121

2222
help "Run shellcheck on all examples"
2323
action :shellcheck do
24+
allowed_skips = 1
2425
Example.executables.each do |example|
2526
if File.exist? example
2627
success = system "shellcheck #{example}"
@@ -29,15 +30,26 @@ action :shellcheck do
2930
exit 1 unless success
3031
else
3132
say "- skip !txtcyn!#{example}"
33+
allowed_skips -= 1
34+
if allowed_skips < 0
35+
say "- aborted: too many skips"
36+
exit 1
37+
end
3238
end
3339
end
3440
end
3541

3642
help "Run shfmt checks on all examples"
3743
action :shfmt do
44+
allowed_skips = 2
3845
Example.executables.each do |example|
3946
if example == 'examples/heredoc/cli' || !File.exist?(example)
4047
say "- skip !txtcyn!#{example}"
48+
allowed_skips -= 1
49+
if allowed_skips < 0
50+
say "- aborted: too many skips"
51+
exit 1
52+
end
4153
next
4254
end
4355

@@ -58,9 +70,22 @@ action :changelog do
5870
File.write "CHANGELOG.md", File.read("CHANGELOG.md").gsub('repeatableflags', 'repeatable flags')
5971
end
6072

73+
command :examples
74+
75+
help "Regenerate example scripts"
76+
action :regen do
77+
# Patch the PATH to allow the extensible example to run properly
78+
ENV['PATH']="#{Dir.pwd}/examples/extensible:#{ENV['PATH']}"
79+
Example.all.each do |example|
80+
say example.dir
81+
Dir.chdir example.dir do
82+
system 'bash test.sh >/dev/null 2>&1'
83+
end
84+
end
85+
end
86+
6187
help "Append the content of bashly.yml to all example READMEs"
62-
action :examples do
63-
# Disable color output (for the color examples)
88+
action :readme do
6489
ENV['NO_COLOR']='1'
6590

6691
# Patch the PATH to allow the extensible example to run properly
@@ -71,5 +96,7 @@ action :examples do
7196
end
7297
end
7398

99+
endcommand
100+
74101
require_relative 'helpers/release'
75102
require './debug.rb' if File.exist? 'debug.rb'

examples/custom-strings/README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,11 @@ usage: download SOURCE [OPTIONS]
8181
download - Sample minimal application with custom strings
8282
8383
== Usage ==
84-
8584
download SOURCE [OPTIONS]
8685
download --help | -h
8786
download --version | -v
8887
8988
== Options ==
90-
9189
--help, -h
9290
Show this helpful help
9391
@@ -98,7 +96,6 @@ download - Sample minimal application with custom strings
9896
Target directory
9997
10098
== Arguments ==
101-
10299
SOURCE
103100
URL to download from
104101

0 commit comments

Comments
 (0)