-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bdb52bb
commit 6cbe567
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Whitespace Check | ||
# Run only on pull requests | ||
on: | ||
pull_request: | ||
jobs: | ||
check-whitespace: | ||
name: Check Whitespace | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- run: | # adapted from https://github.com/JuliaLang/julia/blob/f5ce7c4cb9b3e2140819b6b089530ee69aea3d2f/contrib/check-whitespace.sh | ||
set -f # disable glob expansion in this script | ||
file_patterns=' | ||
*.jl | ||
*.md | ||
*.toml | ||
*.yml | ||
' | ||
# TODO: Look also for trailing empty lines, and missing '\n' after the last line | ||
if git --no-pager grep --color -n --full-name -e ' $' -- $file_patterns; then | ||
echo "Error: trailing whitespace found in source file(s)" | ||
echo "" | ||
echo "This can often be fixed with:" | ||
echo " git rebase --whitespace=fix HEAD~1" | ||
echo "or" | ||
echo " git rebase --whitespace=fix master" | ||
echo "and then a forced push of the correct branch" | ||
exit 1 | ||
fi | ||
echo "Whitespace check found no issues" |