Commit 6c9c3042 authored by carignani's avatar carignani
Browse files

write output of linter to logfile and not stdout

parent e9d7809e
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
#!/bin/bash
# Copyright ETSI 2020

LOGFILE=yang-linting.log

echo "------ Switching to $1 folder --------"
cd $1

@@ -21,11 +23,19 @@ docker run --rm -v $(pwd)/yang-models:/yang hellt/pyang:2.1 pyang --version

echo "------ Linting all YANG files ------"
#  Display all  errors and warnings to the user. Errors are allowed.
docker run --rm -v $(pwd)/yang-models:/yang hellt/pyang:2.1 "/bin/sh" -c 'pyang --lint -p external-yams _3gpp-*.yang'
docker run --rm -v $(pwd)/yang-models:/yang hellt/pyang:2.1 "/bin/sh" -c 'pyang --lint -p external-yams _3gpp-*.yang' 2>>$LOGFILE >>$LOGFILE
ret=$?

echo "Output of Linting commad saved to $LOGFILE."

echo "------ Linting result ------"
echo $ret

if [ $ret == 1 ] ; then
	echo "Some issues were collected by the linter, but they are treated as warnings and are not failing the validation."
	echo "To see the full output of the linter, download the archived artifact named '$LOGFILE'."
fi

# exit $ret
exit 0