mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-07-30 18:27:45 -05:00
Normalize whitespace in source files
Ensure that no source files have trailing whitespace at end of lines and ensure that all files end with a single trailing newline. This also adds Github Actions to enforce whitespace conventions.
This commit is contained in:
26
.github/workflow-scripts/check-trailing-whitespace
vendored
Executable file
26
.github/workflow-scripts/check-trailing-whitespace
vendored
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Check for trailing whitespace at end of lines.
|
||||
|
||||
# Exit on first failing command.
|
||||
set -e
|
||||
# Exit on unset variable.
|
||||
set -u
|
||||
|
||||
FOUND_TRAILING_WHITESPACE=0
|
||||
|
||||
while read -r line; do
|
||||
if grep \
|
||||
"\s$" \
|
||||
--line-number \
|
||||
--with-filename \
|
||||
--binary-files=without-match \
|
||||
--exclude="*.svg" \
|
||||
--exclude="*.eps" \
|
||||
"${line}"; then
|
||||
echo "ERROR: Found trailing whitespace" >&2;
|
||||
FOUND_TRAILING_WHITESPACE=1
|
||||
fi
|
||||
done < <(git ls-files)
|
||||
|
||||
exit "${FOUND_TRAILING_WHITESPACE}"
|
Reference in New Issue
Block a user