mirror of
				https://github.com/luanti-org/luanti.git
				synced 2025-11-04 09:15:29 +01:00 
			
		
		
		
	LINT: Switch whitelist check from egrep to awk
Bonus: make CI happy with the last rules fix
This commit is contained in:
		@@ -6,6 +6,7 @@ function perform_lint() {
 | 
			
		||||
	else
 | 
			
		||||
		CLANG_FORMAT=clang-format
 | 
			
		||||
	fi
 | 
			
		||||
	echo "LINT: Using binary $CLANG_FORMAT"
 | 
			
		||||
	CLANG_FORMAT_WHITELIST="util/travis/clang-format-whitelist.txt"
 | 
			
		||||
 | 
			
		||||
	if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then
 | 
			
		||||
@@ -22,10 +23,10 @@ function perform_lint() {
 | 
			
		||||
		d=$(diff -u "$f" <(${CLANG_FORMAT} "$f") || true)
 | 
			
		||||
 | 
			
		||||
		if ! [ -z "$d" ]; then
 | 
			
		||||
			whitelisted=$(egrep -c "^${f}" "${CLANG_FORMAT_WHITELIST}")
 | 
			
		||||
			whitelisted=$(awk '$1 == "'$f'" { print 1 }' "$CLANG_FORMAT_WHITELIST")
 | 
			
		||||
 | 
			
		||||
			# If file is not whitelisted, mark a failure
 | 
			
		||||
			if [ ${whitelisted} -eq 0 ]; then
 | 
			
		||||
			if [ -z ${whitelisted} ]; then
 | 
			
		||||
				errorcount=$((errorcount+1))
 | 
			
		||||
 | 
			
		||||
				printf "The file %s is not compliant with the coding style" "$f"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user