Skip to content

Commit

Permalink
Show flake8 errors introduced
Browse files Browse the repository at this point in the history
  • Loading branch information
sonicaj committed Apr 27, 2021
1 parent d946e39 commit e9e9101
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,28 @@ jobs:
python -m pip install --upgrade pip
pip install flake8
- name: Get current errors
# echo "CURRENT_ERROR_STR=\"$(cat $tmpafter)\"" >> $GITHUB_ENV
run: |
tmpafter=$(mktemp)
find src -name \*.py -exec flake8 --ignore=E402,E501,W504 {} + | egrep -v "alembic/versions/|usr/local/share/pysnmp/mibs/" > $tmpafter
num_errors_after=`cat $tmpafter | wc -l`
echo "CURRENT_ERROR_FILE=${tmpafter}" >> $GITHUB_ENV
echo "CURRENT_ERRORS=${num_errors_after}" >> $GITHUB_ENV
- name: Checkout base branch
uses: actions/checkout@v2
with:
ref: ${{ github.base_ref }}
- name: Get errors from base branch
# echo "OLD_ERROR_STR=\"$(cat $tmpbefore)\"" >> $GITHUB_ENV
run: |
tmpbefore=$(mktemp)
find src -name \*.py -exec flake8 --ignore=E402,E501,W504 {} + | egrep -v "alembic/versions/|usr/local/share/pysnmp/mibs/" > $tmpbefore
num_errors_before=`cat $tmpbefore | wc -l`
echo "OLD_ERROR_FILE=${tmpbefore}" >> $GITHUB_ENV
echo "OLD_ERRORS=${num_errors_before}" >> $GITHUB_ENV
- name: Conclusion
# diff <(echo "${{ env.OLD_ERROR_STR }}") <(echo "${{ env.CURRENT_ERROR_str }}")
run: |
if [ ${{ env.CURRENT_ERRORS }} -gt ${{ env.OLD_ERRORS }} ]; then
echo "New flake8 errors were introduced"
diff -u ${{ env.OLD_ERROR_FILE }} ${{ env.CURRENT_ERROR_FILE }}
exit 1
else
echo "No new flake 8 errors were introduced"
Expand Down

0 comments on commit e9e9101

Please sign in to comment.