Skip to content
Open
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
50 changes: 50 additions & 0 deletions .github/workflows/trailing-spaces.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Check Trailing Spaces

on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
- main

jobs:
trailing-spaces:

Check warning on line 11 in .github/workflows/trailing-spaces.yml

View workflow job for this annotation

GitHub Actions / zizmor-output

excessive-permissions

trailing-spaces.yml:11: overly broad permissions: default permissions used due to no permissions: block
name: Check for trailing spaces
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

Check failure on line 16 in .github/workflows/trailing-spaces.yml

View workflow job for this annotation

GitHub Actions / zizmor-output

zizmor/unpinned-uses

unpinned action reference: action is not pinned to a hash (required by blanket policy)

Check failure on line 16 in .github/workflows/trailing-spaces.yml

View workflow job for this annotation

GitHub Actions / zizmor-output

unpinned-uses

trailing-spaces.yml:16: unpinned action reference: action is not pinned to a hash (required by blanket policy)

- name: Check for trailing spaces
run: |
echo "Checking for trailing whitespace in code files..."

# Find files with trailing spaces, excluding binary files and common non-code directories
# File types to check: source code, config, docs, scripts
TRAILING_FILES=$(grep -rIl '[[:blank:]]$' \
--exclude-dir=.git \
--exclude-dir=node_modules \
--exclude-dir=vendor \
--exclude-dir=dist \
--exclude-dir=build \
--exclude-dir=__pycache__ \
--exclude-dir=.venv \
--exclude-dir=venv \
--exclude='*.lock' \
--exclude='*.min.js' \
--exclude='*.min.css' \
. 2>/dev/null || true)

if [ -n "$TRAILING_FILES" ]; then
echo ""
echo "❌ Trailing whitespace found in the following files:"
echo ""
echo "$TRAILING_FILES"
echo ""
echo "Please remove trailing whitespace from these files."
echo "You can use: sed -i 's/[[:blank:]]*$//' <file>"
echo ""
exit 1
else
echo "✅ No trailing whitespace found. All clean!"
fi
Loading