mirror of
				https://github.com/traefik/traefik.git
				synced 2025-11-04 02:11:15 +01:00 
			
		
		
		
	… instead of /bin/bash, to work better on more platforms. Signed-off-by: Vincent Demeester <vincent@sbr.pm>
		
			
				
	
	
		
			34 lines
		
	
	
		
			877 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			34 lines
		
	
	
		
			877 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/usr/bin/env bash
 | 
						|
 | 
						|
source "$(dirname "$BASH_SOURCE")/.validate"
 | 
						|
 | 
						|
IFS=$'\n'
 | 
						|
src=( $(validate_diff --diff-filter=ACMR --name-only -- '*.go' | grep -v '^\(integration/\)\?vendor/\|autogen' || true) )
 | 
						|
docs=( $(validate_diff --diff-filter=ACMR --name-only -- 'docs/*.md') )
 | 
						|
unset IFS
 | 
						|
files=("${src[@]}" "${docs[@]}")
 | 
						|
 | 
						|
errors=()
 | 
						|
for f in "${files[@]}"; do
 | 
						|
	# we use source text here so we also check spelling of variable names
 | 
						|
	failedSpell=$(misspell -source=text "$f")
 | 
						|
	if [ "$failedSpell" ]; then
 | 
						|
		errors+=( "$failedSpell" )
 | 
						|
	fi
 | 
						|
done
 | 
						|
 | 
						|
if [ ${#errors[@]} -eq 0 ]; then
 | 
						|
	echo 'Congratulations!  All Go source files and docs have been checked for common mispellings.'
 | 
						|
else
 | 
						|
	{
 | 
						|
		echo "Errors from misspell:"
 | 
						|
		for err in "${errors[@]}"; do
 | 
						|
			echo "$err"
 | 
						|
		done
 | 
						|
		echo
 | 
						|
		echo 'Please fix the above errors. You can test via "misspell" and commit the result.'
 | 
						|
		echo
 | 
						|
	} >&2
 | 
						|
	false
 | 
						|
fi
 |