Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: lint.sh script --fix flag #338

Merged
merged 1 commit into from
Jul 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading