mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-04 03:27:12 -05:00 
			
		
		
		
	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.
		
			
				
	
	
		
			27 lines
		
	
	
		
			504 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
		
			504 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/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}"
 |