Skip to content

Commit

Permalink
Move bash code from YAML to fix_style.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
jngrad committed Nov 5, 2019
1 parent 03ccea7 commit e581b95
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
3 changes: 0 additions & 3 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ style:
- git submodule deinit .
script:
- maintainer/CI/fix_style.sh
- git --no-pager diff > style.patch
- git diff-index --quiet HEAD -- || (echo "Failed style check. Download $CI_JOB_URL/artifacts/raw/style.patch to see which changes are necessary." && exit 1)
- echo "Passed style check"
tags:
- docker
- linux
Expand Down
25 changes: 20 additions & 5 deletions maintainer/CI/fix_style.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,18 @@ find . -type f -executable ! -name '*.sh' ! -name '*.py' ! -name '*.sh.in' ! -na
if [ "$CI" != "" ]; then
maintainer/gh_post_style_patch.py
fi
git diff-index --quiet HEAD --
if [ $? = 1 ]; then
if [ "$CI" != "" ]; then
git --no-pager diff > style.patch
echo "Failed style check. Download $CI_JOB_URL/artifacts/raw/style.patch to see which changes are necessary." >&2
else
echo "Failed style check" >&2
fi
exit 1
else
echo "Passed style check"
fi

pylint_command () {
if hash pylint 2> /dev/null; then
Expand All @@ -60,18 +72,21 @@ pylint_command () {
elif hash pylint-3 2> /dev/null; then
pylint-3 "$@"
else
echo "pylint not found";
echo "pylint not found" >&2
exit 1
fi
}
pylint_command --score=no --reports=no --output-format=text src doc maintainer testsuite samples | tee pylint.log
errors=$(grep -P '^[a-z]+/.+?.py:[0-9]+:[0-9]+: [CRWEF][0-9]+:' pylint.log | wc -l)

if [ "$CI" != "" ]; then
maintainer/gh_post_pylint.py ${errors} pylint.log
fi
if [ ${errors} != 0 ]; then
echo "pylint found ${errors} errors"
echo "pylint found ${errors} errors" >&2
exit 1
else
echo "pylint found no error"
fi

if [ "$CI" != "" ]; then
maintainer/gh_post_pylint.py ${errors} pylint.log
fi
exit 0

0 comments on commit e581b95

Please sign in to comment.