Skip to content

Commit

Permalink
format directly
Browse files Browse the repository at this point in the history
  • Loading branch information
elliottrabac committed Jun 12, 2024
1 parent 67e6608 commit 84cfd2f
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ if [[ "${SQLFLUFF_COMMAND:?}" == "lint" ]]; then
# Allow failures now, as reviewdog handles them
set +Eeuo pipefail
lint_results="sqlfluff-lint.json"
lint_results_rdjson="sqlfluff-lint.rdjson"
# shellcheck disable=SC2086,SC2046
sqlfluff lint \
--format json \
Expand All @@ -75,13 +76,10 @@ if [[ "${SQLFLUFF_COMMAND:?}" == "lint" ]]; then
$(if [[ "x${SQLFLUFF_TEMPLATER}" != "x" ]]; then echo "--templater ${SQLFLUFF_TEMPLATER}"; fi) \
$(if [[ "x${SQLFLUFF_DISABLE_NOQA}" != "x" ]]; then echo "--disable-noqa ${SQLFLUFF_DISABLE_NOQA}"; fi) \
$(if [[ "x${SQLFLUFF_DIALECT}" != "x" ]]; then echo "--dialect ${SQLFLUFF_DIALECT}"; fi) \
$changed_files | tail -n +2 | jq 'del(.[].timings)' | jq 'del(.[].statistics)' > "$lint_results"
$changed_files | tail -n +2 | jq -r -f "${SCRIPT_DIR}/to-rdjson.jq" | tee > "$lint_results_rdjson"

sqlfluff_exit_code=$?
cat "$lint_results"

echo "name=sqlfluff-results::$(cat <"$lint_results" | jq -r -c '.')" >> $GITHUB_OUTPUT # Convert to a single line
echo "name=sqlfluff-exit-code::${sqlfluff_exit_code}" >> $GITHUB_OUTPUT
cat "$lint_results_rdjson"

set -Eeuo pipefail
echo '::endgroup::'
Expand All @@ -90,11 +88,6 @@ if [[ "${SQLFLUFF_COMMAND:?}" == "lint" ]]; then
# Allow failures now, as reviewdog handles them
set +Eeuo pipefail

lint_results_rdjson="sqlfluff-lint.rdjson"
cat <"$lint_results" |
jq -r -f "${SCRIPT_DIR}/to-rdjson.jq" |
tee >"$lint_results_rdjson"

cat <"$lint_results_rdjson" |
reviewdog -f=rdjson \
-name="sqlfluff-lint" \
Expand Down

0 comments on commit 84cfd2f

Please sign in to comment.