Commit 4e205f3f authored by Matthias Simon's avatar Matthias Simon
Browse files

Make format-and-check more robust

parent 596b50e3
Loading
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -12,11 +12,11 @@ function error() {


echo "Removing dot-files..."
find ATS -name ".*" | xargs rm -rfv
find ATS -name ".*" -print0 | xargs -0 rm -rfv

echo "Fixing permissions..."
find ATS -type f | xargs chmod 664
find ATS -type d | xargs chmod 775
find ATS -type f -print0 | xargs -0 chmod 664
find ATS -type d -print0 | xargs -0 chmod 775

echo "Looking for unknown file types..."
while IFS= read -r -d $'\0' file; do
@@ -24,14 +24,14 @@ while IFS= read -r -d $'\0' file; do
done < <(find ATS -type f ! -name "*.xml" -a ! -name "*.xsd" -a ! -name "*.ttcn" -a -name "*.json" -a -name "NOTES")

echo "Converting Windows line endings to Unix..."
find ATS -type f -name \*.ttcn | xargs dos2unix 1>/dev/null
find ATS -type f -name \*.ttcn -print0 | xargs -0 dos2unix 1>/dev/null

echo "Removing trailing whitespace"
find ATS -type f -name \*.ttcn | xargs sed -i 's/[[:space:]]*$//'
find ATS -type f -name \*.ttcn -print0 | xargs -0 sed -i 's/[[:space:]]*$//'

echo "Linting TTCN-3 files..."
while IFS= read -r -d $'\0' file; do
	name=$(basename $file .ttcn)
	name=$(basename "$file" .ttcn)

	: Verify that the file path only contains valid characters.
	if ! [[ ${file%.ttcn} =~ [A-Za-z0-9_/]+ ]]; then