We made a script to run robottidy. The script by default only checks but can be used to fix all formatting issues also by providing -f flag.
The gist:
CHECK="--check"
while test $# != 0
do
case "$1" in
-f|--fix) unset CHECK ;;
esac
shift
done
find ${DIRECTORIES_TO_CHECK_ROBOT} -name "*.robot"
robotidy --list
find ${DIRECTORIES_TO_CHECK_ROBOT} -name "*.robot" -exec robotidy -v ${CHECK} {} +
EXIT_CODE_ROBOT_TIDY=$?
if [ $EXIT_CODE_ROBOT_TIDY -ne 0 ]
then
# print the changes robotidy would make
find ${DIRECTORIES_TO_CHECK_ROBOT} -name "*.robot" -exec robotidy -v --diff --check {} +
echo "Format for robot code not ok"
else
echo "Done Checking format of robot code. Format ok."
fi
We observed different behavior, when executing that script locally and when executing in a ci-action. The ci-runner executes the same script. But there it seems robotidy does not detect misformating and returns with 0 exit code.
Any ideas what could be causing this? Or any workaround suggestions?
Could it have to do with interactive vs non-interactive shells?
Help is greatly appreciated.
We made a script to run robottidy. The script by default only checks but can be used to fix all formatting issues also by providing
-fflag.The gist:
We observed different behavior, when executing that script locally and when executing in a ci-action. The ci-runner executes the same script. But there it seems
robotidydoes not detect misformating and returns with0exit code.Any ideas what could be causing this? Or any workaround suggestions?
Could it have to do with
interactivevsnon-interactiveshells?Help is greatly appreciated.