Skip to content

Commit 837412f

Browse files
authored
CI[Python]: Add pylint (#664)
Signed-off-by: Anton Pryakhin <[email protected]>
1 parent 6f76316 commit 837412f

File tree

3 files changed

+53
-2
lines changed

3 files changed

+53
-2
lines changed

.github/workflows/pylint.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Python linter check
2+
3+
on:
4+
pull_request:
5+
types:
6+
- "opened"
7+
- "reopened"
8+
- "synchronize"
9+
- "labeled"
10+
- "unlabeled"
11+
12+
jobs:
13+
python_linter_check:
14+
name: Python Linter Check
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
- uses: actions/setup-python@v5
21+
with:
22+
python-version: '3.12.4'
23+
- name: Install dependencies
24+
run: |
25+
pip3 install pylint lint-diffs
26+
ln -s ${{ github.workspace }}/src/python/pylintrc ${{ github.workspace }}/.pylintrc
27+
echo [pylint] > ${{ github.workspace }}/.lint-diffs
28+
echo extensions=.py >> ${{ github.workspace }}/.lint-diffs
29+
- name: Check the whole repo with pylint
30+
run: |
31+
pylint -j 8 src || true
32+
- name: Check the PR with pylint
33+
run: |
34+
git diff -U0 origin/main | lint-diffs

src/integration-tests/pylintrc

Lines changed: 0 additions & 2 deletions
This file was deleted.

src/python/pylintrc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
[MAIN]
22

3+
disable=attribute-defined-outside-init,
4+
disallowed-name,
5+
duplicate-code,
6+
fixme,
7+
invalid-name,
8+
line-too-long,
9+
missing-class-docstring,
10+
missing-function-docstring,
11+
missing-module-docstring,
12+
redefined-outer-name,
13+
too-few-public-methods,
14+
too-many-arguments,
15+
too-many-branches,
16+
too-many-instance-attributes,
17+
too-many-lines,
18+
too-many-locals,
19+
too-many-public-methods,
20+
too-many-statements
21+
322
# Analyse import fallback blocks. This can be used to support both Python 2 and
423
# 3 compatible code, which means that the block might have code that exists
524
# only in one or another interpreter, leading to false positives when analysed.

0 commit comments

Comments
 (0)