From 1a649d0fa14cd9002071c5a63b28b4bfe69a3b0c Mon Sep 17 00:00:00 2001 From: Ishan Rai Date: Wed, 8 Jul 2020 19:30:30 +0530 Subject: [PATCH] show error report on pylint test --- .github/workflows/python_lint.yml | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python_lint.yml b/.github/workflows/python_lint.yml index d119a048f..d309d875f 100644 --- a/.github/workflows/python_lint.yml +++ b/.github/workflows/python_lint.yml @@ -16,10 +16,29 @@ jobs: uses: actions/setup-python@v2 with: python-version: 2.7 - - name: Install and Pylint + - name: Install Pylint run: | python2 -m pip install pylint - - name: Lint with pylint + - name: Generate error reports run: | - pylint ${{ env.GIT_DIFF }} + pylint --msg-template='{path}:{line:3d}:{column}: [{msg_id}] {msg} ({symbol})' --suggestion-mode=y --reports=y --disable=RP0101,RP0401,RP0402,RP0701,RP0801 ${{ env.GIT_DIFF }} | tee temp.txt if: env.GIT_DIFF + - name: Parse output + if: env.GIT_DIFF && github.event_name == 'pull_request' + run: | + cat temp.txt | sed -n '/Report/,$p' | sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g' > report.txt + - name: Comment Test Coverage + if: env.GIT_DIFF && github.event_name == 'pull_request' + env: + URL: ${{ github.event.pull_request.comments_url }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + curl -X POST $URL \ + -H "Content-Type: application/json" -H \ + "Authorization: token $GITHUB_TOKEN" \ + --data '{ "body": "
'"$(head -n 1 report.txt)"'
" }' + - name: Check warnings and errors + run: | + pylint --msg-template='{path}:{line:3d}:{column}: [{msg_id}] {msg} ({symbol})' --suggestion-mode=y --disable=all --enable=E,W ${{ env.GIT_DIFF }} + if: env.GIT_DIFF + \ No newline at end of file