Skip to content

Commit

Permalink
Merge pull request #536 from DannyBen/refactor/example-tester
Browse files Browse the repository at this point in the history
Refactor static analysis checks
  • Loading branch information
DannyBen authored Jul 14, 2024
2 parents 908edc6 + 1242144 commit 1d611b0
Show file tree
Hide file tree
Showing 23 changed files with 287 additions and 547 deletions.
22 changes: 5 additions & 17 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,14 @@ jobs:
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1'
ruby-version: '3.2'
bundler-cache: true

- name: Generate all examples
- name: Generate all examples and fixtures
run: bundle exec run examples regen

- name: Generate all fixtures
run: bundle exec run fixtures regen

- name: Run shellcheck tests (examples)
run: bundle exec run shellcheck examples

- name: Run shellcheck tests (fixtures)
run: bundle exec run shellcheck fixtures

- name: Run shfmt tests (examples)
run: bundle exec run shfmt examples

- name: Run shfmt tests (fixtures)
run: bundle exec run shfmt fixtures
- name: Run shellcheck and shfmt tests
run: bundle exec run static

json_schema:
name: Validate JSON schemas
Expand Down Expand Up @@ -77,7 +65,7 @@ jobs:
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1'
ruby-version: '3.2'
bundler-cache: true

- name: Generate all subjects
Expand Down
2 changes: 2 additions & 0 deletions examples/render-mandoc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
download
src/*.sh
2 changes: 2 additions & 0 deletions examples/render-markdown/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
download
src/*.sh
1 change: 0 additions & 1 deletion runfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require 'debug'
require 'bashly/version'
require_relative 'support/runfile/example'
require_relative 'support/runfile/workspace_fixture'

title 'Bashly Developer Toolbelt'
summary 'Runfile tasks for building the Bashly gem'
Expand Down
2 changes: 2 additions & 0 deletions spec/fixtures/workspaces/completions-private/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
completions.yml
private
src/*.sh
1 change: 1 addition & 0 deletions spec/fixtures/workspaces/lib-custom-source/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cli
184 changes: 0 additions & 184 deletions spec/fixtures/workspaces/lib-custom-source/cli

This file was deleted.

31 changes: 14 additions & 17 deletions spec/fixtures/workspaces/lib-upgrade/src/lib/colors.sh
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
# ---
# Color functions [@bashly-upgrade colors]
# This file is a part of Bashly standard library
#
# Usage:
# Use any of the functions below to color or format a portion of a string.
#
# echo "before $(red this is red) after"
# echo "before $(green_bold this is green_bold) after"
#
# Color output will be disabled if `NO_COLOR` environment variable is set
# in compliance with https://no-color.org/
#
# ---

## Color functions [@bashly-upgrade colors]
## This file is a part of Bashly standard library
##
## Usage:
## Use any of the functions below to color or format a portion of a string.
##
## echo "before $(red this is red) after"
## echo "before $(green_bold this is green_bold) after"
##
## Color output will be disabled if `NO_COLOR` environment variable is set
## in compliance with https://no-color.org/
##
print_in_color() {
local color="$1"
shift
if [[ -z ${NO_COLOR+x} ]]; then
printf "$color%b\e[0m\n" "$*";
printf "$color%b\e[0m\n" "$*"
else
printf "%b\n" "$*";
printf "%b\n" "$*"
fi
}

Expand Down
Loading

0 comments on commit 1d611b0

Please sign in to comment.