Skip to content

Commit

Permalink
fix: lint.sh script --fix flag (#338)
Browse files Browse the repository at this point in the history
It was broken because it used the wrong file as the patch.
See 7a14cfd#r144358642
  • Loading branch information
alexeagle authored Jul 18, 2024
1 parent 32c091a commit d0bd08a
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions example/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,8 @@ fi
bazel build ${args[@]} $@

# TODO: Maybe this could be hermetic with bazel run @aspect_bazel_lib//tools:jq or sth
if [ $machine == "Windows" ]; then
# jq on windows outputs CRLF which breaks this script. https://github.com/jqlang/jq/issues/92
valid_reports=$(jq --arg ext .out --raw-output "$filter" "$buildevents" | tr -d '\r')
else
valid_reports=$(jq --arg ext .out --raw-output "$filter" "$buildevents")
fi
# jq on windows outputs CRLF which breaks this script. https://github.com/jqlang/jq/issues/92
valid_reports=$(jq --arg ext .out --raw-output "$filter" "$buildevents" | tr -d '\r')

# Show the results.
while IFS= read -r report; do
Expand All @@ -101,7 +97,7 @@ while IFS= read -r report; do
done <<<"$valid_reports"

if [ -n "$fix" ]; then
valid_patches=$valid_reports
valid_patches=$(jq --arg ext .patch --raw-output "$filter" "$buildevents" | tr -d '\r')
while IFS= read -r patch; do
# Exclude coverage, and check if the patch is empty.
if [[ "$patch" == *coverage.dat ]] || [[ ! -s "$patch" ]]; then
Expand Down

0 comments on commit d0bd08a

Please sign in to comment.