Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions pre_commit_hooks/linting.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,18 @@ echo "black: `black --version`"

cd $CODE_REPO_PATH

FAILINGSTEP=""
RETURNCODE=0
if [ $RUN_FLAKE8 != "FALSE" ]
then
echo
echo "FLAKE8:"
flake8 --config=.flake8 --count --statistics --show-source .
if [ $? -ne 0 ]
then
RETURNCODE=1
FAILINGSTEP="FLAKE8"
fi
else
echo
echo "FLAKE8 configured to be skipped"
Expand All @@ -124,6 +131,11 @@ then
wget https://raw.githubusercontent.com/mundialis/github-workflows/main/linting-config-examples/.pylintrc
fi
pylint .
if [ $? -ne 0 ]
then
RETURNCODE=1
FAILINGSTEP="$FAILINGSTEP PYLINT"
fi

echo
echo "PYLINT more strict:"
Expand All @@ -146,7 +158,18 @@ then
echo
echo "BLACK:"
black --check --diff --line-length 79 .
if [ $? -ne 0 ]
then
RETURNCODE=1
FAILINGSTEP="$FAILINGSTEP BLACK"
fi
else
echo
echo "BLACK configured to be skipped"
fi

if [ $RETURNCODE -ne 0 ]
then
echo "Failing steps: ${FAILINGSTEP}"
fi
exit $RETURNCODE