Skip to content

Commit

Permalink
Add a lint check to prevent whitespace issues
Browse files Browse the repository at this point in the history
Whitespace issues as understood by git (by default) are trailing
whitespace at EOL, whitespace on an otherwise empty line, a space
character immediately followed by a tab character in the indentation of
a line, and multiple newlines at EOF.

References:
- https://git-scm.com/docs/git-diff#Documentation/git-diff.txt---check
- https://peter.eisentraut.org/blog/2014/11/04/checking-whitespace-with-git
  • Loading branch information
matrss committed Apr 22, 2024
1 parent 1a52d58 commit 903ec36
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,11 @@ jobs:
files_with_crlf="$(git ls-files --eol | awk '$1 ~ "crlf"')"
echo "$files_with_crlf"
[ "$files_with_crlf" == "" ] || exit 1
no-whitespace-issues-in-git:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Check for whitespace issues in the repository
run: git diff --check $(git hash-object -t tree /dev/null) HEAD

0 comments on commit 903ec36

Please sign in to comment.