Skip to content

Commit

Permalink
fix: add missing per-project formatter for migrations (#616)
Browse files Browse the repository at this point in the history
* fix: add missing per-project formatter for migrations

adds per-project formatters, just like linters

* make fmt
  • Loading branch information
evadnoob authored and yj-yan committed Aug 8, 2023
1 parent fce6d81 commit 73bad98
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions shell/fmt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,19 @@ source "$DIR/lib/bootstrap.sh"
# shellcheck source=./lib/shell.sh
source "$DIR/lib/shell.sh"

# add extra (per project) linters
linters=("$DIR/linters"/*.sh)
if [[ -z $workspaceFolder ]]; then
workspaceFolder="$(get_repo_directory)"
fi
if [[ -d "$workspaceFolder"/scripts/linters ]]; then
linters+=("$workspaceFolder/scripts/linters/"*.sh)
fi

info "Running formatters"

started_at="$(get_time_ms)"
for languageScript in "$DIR/linters"/*.sh; do
languageName="$(basename "${languageScript%.sh}")"
for linterScript in "${linters[@]}"; do

# We use a sub-shell to prevent inheriting
# the changes to functions/variables to the parent
Expand All @@ -29,7 +37,7 @@ for languageScript in "$DIR/linters"/*.sh; do

# Why: Dynamic
# shellcheck disable=SC1090
source "$DIR/linters/$languageName.sh"
source "$linterScript"

matched=false
if [[ "$(find_files_with_extensions "${extensions[@]}" | wc -l | tr -d ' ')" -gt 0 ]]; then
Expand Down

0 comments on commit 73bad98

Please sign in to comment.