This repository was archived by the owner on Sep 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 51
44 lines (41 loc) · 1.55 KB
/
python_lint.yml
File metadata and controls
44 lines (41 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
name: PyLint test
on: [push, pull_request]
jobs:
lint-python:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2.2.0
- name: Get Diff Action
uses: technote-space/get-diff-action@v1.2.8
with:
SUFFIX_FILTER: .py
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 2.7
- name: Install Pylint
run: |
python2 -m pip install pylint
- name: Generate error reports
run: |
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": "<pre>'"$(head -n 1 report.txt)"'</pre>" }'
- 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