<commit_before>#!/bin/bash
# Checkt of alle bestanden die eindigen op .php correcte php syntax hebben.

function parse_file {
	if [[ $(php -l $1) != "No syntax errors detected in $file" ]]; then
		echo "syntax error"
		exit 1
	fi
}

function parse_directory {
	for file in $1/*
	do
		if [[ -f $file ]]; then
			echo $file | grep -q .php$
			if [[ $? -eq 0 ]]; then
				parse_file $file
			fi
		else
			parse_directory $file
		fi
	done
}

parse_directory $1

echo "valid"
exit 0<commit_msg>Make the Travis script more verbose<commit_after>#!/bin/bash
# Checkt of alle bestanden die eindigen op .php correcte php syntax hebben.

error_count=0

function parse_file {
	parse_output=$(php -l $1)
	if [[ $parse_output != "No syntax errors detected in $file" ]]; then
		echo
		echo "Found a syntax error in $1:"
		while read -r line
		do
			echo "> $line"
		done <<< "$parse_output"
		#echo "$parse_output"
		echo
		error_count=$(($error_count+1))
	else
		echo "Valid: $file"
	fi
}

function parse_directory {
	for file in $1/*
	do
		if [[ -f $file ]]; then
			echo $file | grep -q .php$
			if [[ $? -eq 0 ]]; then
				parse_file $file
			fi
		else
			parse_directory $file
		fi
	done
}

echo "Checking all .php files for syntax errors..."
echo
parse_directory $1
echo
echo "Found $error_count file(s) with syntax errors."
if [[ $error_count > 255 ]]; then
	exit 255
else
	exit $error_count
fi
{'fraction_non_alphanumeric': 0.12121212121212122, 'fraction_numerical': 0.013708513708513708, 'mean_word_length': 3.190332326283988, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2045645', 'n_tokens_mistral': 562, 'n_tokens_neox': 496, 'n_words': 181}