Skip to content

Commit d47b246

Browse files
committed
fix ruff linux OS compatibility error for CI/CD workflow
1 parent 3cec69a commit d47b246

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

scripts/ruff_check_format_assets.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,17 @@ if [ ! -f "requirements.txt" ]; then
88
exit 1
99
fi
1010

11-
# Fix SQL whitespace issues before running ruff
11+
# Fix SQL whitespace issues before running ruff (Linux/macOS compatible)
1212
echo "Fixing SQL whitespace issues in BigQuery provider..."
13-
find src/models -name "*.py" -type f -exec sed -i '' -E 's/([A-Z]+) +$/\1/g' {} \;
14-
find src/models -name "*.py" -type f -exec sed -i '' -E 's/^( +)$//' {} \;
13+
if [[ "$OSTYPE" == "darwin"* ]]; then
14+
# macOS
15+
find src/models -name "*.py" -type f -exec sed -i '' -E 's/([A-Z]+) +$/\1/g' {} \;
16+
find src/models -name "*.py" -type f -exec sed -i '' -E '/^[[:space:]]*$/d' {} \;
17+
else
18+
# Linux (CI environment)
19+
find src/models -name "*.py" -type f -exec sed -i -E 's/([A-Z]+) +$/\1/g' {} \;
20+
find src/models -name "*.py" -type f -exec sed -i -E '/^[[:space:]]*$/d' {} \;
21+
fi
1522
echo "SQL whitespace issues fixed!"
1623

1724
# Run ruff check with auto-fix, including unsafe fixes for typing annotations

0 commit comments

Comments
 (0)