Skip to content

Commit df4fb05

Browse files
authored
Merge pull request #1 from SAP/refactor
Refactor whole project
2 parents f0bd43c + 96b6113 commit df4fb05

29 files changed

Lines changed: 480 additions & 332 deletions

File tree

.flake8

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[flake8]
2+
max-line-length = 100
3+
enable-extensions = FT
4+
select =
5+
C901, # flake8-mccabe
6+
E, # flake8-pycodestyle
7+
F, # flake8-pyflakes
8+
W, # flake8-pycodestyle
9+
FT, # flake8-tergeo
10+
ignore=
11+
# conflict with black formatter
12+
W503,E203,
13+
# ignore !r recommendation
14+
FTB907,
15+
# some things don't need a docstring
16+
FTP306,FTP304,FTP305
17+
per-file-ignores =
18+
test/*:FTP3
19+
ftp-python-version = 3.9.0
20+
ftp-auto-manage-options = true
21+
ftp-pytest-parametrize-names-type = csv
22+
ftp-docstyle-lowercase-words = pylint-per-file-ignores

.github/workflows/main.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: CI
2+
3+
permissions:
4+
contents: read
5+
actions: read
6+
id-token: write
7+
pull-requests: write
8+
9+
on:
10+
push:
11+
branches: [ main ]
12+
pull_request:
13+
branches: [ main ]
14+
15+
jobs:
16+
ci-pre-commit:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
- uses: actions/setup-python@v5
23+
with:
24+
python-version: "3.13.0"
25+
- name: Install project
26+
run: pip install --group dev --group test -e .
27+
- name: run pre-commit
28+
run: "pre-commit run --all"
29+
ci-test:
30+
strategy:
31+
fail-fast: false
32+
matrix:
33+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14.0-beta.2"]
34+
pylint-version: ["3.3.*", "3.*"]
35+
runs-on: ubuntu-latest
36+
steps:
37+
- uses: actions/checkout@v4
38+
with:
39+
fetch-depth: 0
40+
- uses: actions/setup-python@v5
41+
with:
42+
python-version: ${{ matrix.python-version }}
43+
- name: Install project
44+
run: pip install --group test -e .
45+
- name: "Install pylint"
46+
run: "pip install -U pylint==${{ matrix.pylint-version }}"
47+
- name: run tests (with coverage)
48+
run: "pytest --cov --cov-report xml --cov-config pyproject.toml test/"
49+
- name: run diff-cover
50+
run: "diff-cover --config-file pyproject.toml coverage.xml"

.pre-commit-config.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v5.0.0
4+
hooks:
5+
- id: check-yaml
6+
- id: end-of-file-fixer
7+
- id: trailing-whitespace
8+
- repo: https://github.com/fsfe/reuse-tool
9+
rev: v4.0.3
10+
hooks:
11+
- id: reuse
12+
- repo: local
13+
hooks:
14+
- id: black
15+
name: black
16+
entry: black
17+
language: system
18+
types: [python]
19+
- id: isort
20+
name: isort
21+
entry: isort
22+
language: system
23+
types: [python]
24+
- id: mypy
25+
name: mypy
26+
entry: mypy
27+
language: system
28+
types: [python]
29+
require_serial: true
30+
- id: pylint
31+
name: pylint
32+
entry: pylint
33+
language: system
34+
types: [python]
35+
- id: flake8
36+
name: flake8
37+
entry: flake8
38+
language: system
39+
types: [python]
40+
require_serial: true
41+
- id: yesqa
42+
name: yesqa
43+
entry: yesqa
44+
language: system
45+
types: [python]
46+
- id: pyupgrade
47+
name: pyupgrade
48+
entry: pyupgrade
49+
language: system
50+
types: [python]
51+
args: ["--py39-plus"]

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
# Changelog
22

33
## Next version
4+
- Dropped support for pylint versions below 3.3
5+
- Officially support python 3.9-3.14
6+
- Dropped support for python 3.8 and before
7+
- Complete refactoring of the project
8+
- Dropped support for the custom pyproject.toml section
9+
- Support parallel mode of pylint
10+
- Switch from regex patterns to globs

README.md

Lines changed: 15 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,61 @@
11
[![REUSE status](https://api.reuse.software/badge/github.com/SAP/pylint-per-file-ignores)](https://api.reuse.software/info/github.com/SAP/pylint-per-file-ignores)
22

33

4-
# Pylint Per File Ignores 😲
5-
4+
# Pylint Per File Ignores
65
This pylint plugin will enable per-file-ignores in your project!
76

8-
The project was initaly created by [christopherpickering](https://github.com/christopherpickering).
9-
Please stay tuned for fixes, feature, etc. in the next months but please give me some time to board on :).
7+
The project was initially created by [christopherpickering](https://github.com/christopherpickering).
108

119
## Install
12-
1310
```
14-
# w/ poetry
15-
poetry add pylint-per-file-ignores --group dev
16-
17-
# w/ pip
1811
pip install pylint-per-file-ignores
1912
```
2013

2114
## Add to Pylint Settings
22-
2315
```toml
24-
[tool.pylint.MASTER]
16+
[tool.pylint.main]
2517
load-plugins=[
2618
"pylint_per_file_ignores",
2719
...
2820
]
2921
```
3022

31-
3223
## Usage
33-
3424
Add list of patterns and codes you would like to ignore.
25+
The patterns are matched using `globs`.
3526

36-
### Using native pylint settings
37-
38-
Section "MESSAGES CONTROL". Examples:
39-
27+
**.pylintrc**
4028
```ini
41-
# .pylintrc
42-
4329
[MESSAGES CONTROL]
4430
per-file-ignores =
45-
.*_test\.py:protected-access # ignore "protected-access" errors in test files ending in "_test.py"
31+
/folder_1/:missing-function-docstring,W0621,W0240,C0115
32+
file.py:C0116,E0001
4633
```
4734

35+
**setup.cfg**
4836
```ini
49-
# setup.cfg
50-
5137
[pylint.MESSAGES CONTROL]
5238
per-file-ignores =
5339
/folder_1/:missing-function-docstring,W0621,W0240,C0115
5440
file.py:C0116,E0001
5541
```
5642

43+
**pyproject.toml**
5744
```toml
58-
# pyproject.toml
59-
6045
[tool.pylint.'messages control']
6146
per-file-ignores = [
6247
"/folder_1/:missing-function-docstring,W0621,W0240,C0115",
6348
"file.py:C0116,E0001"
6449
]
6550
```
6651

67-
### Using custom `pyproject.toml` section
68-
69-
For backwards compatibility only. Example:
70-
71-
```toml
72-
[tool.pylint-per-file-ignores]
73-
"/folder_1/"="missing-function-docstring,W0621,W0240,C0115"
74-
"file.py"="C0116,E0001"
75-
```
76-
77-
## Thanks
52+
## Build and Publish
7853

79-
To pylint :) And the plugin `pylint-django` who produced most of the complex code.
54+
This project uses `setuptools` as the dependency management and build tool.
55+
To publish a new release, follow these steps:
56+
* Update the version in the `pyproject.toml`
57+
* Add an entry in the changelog
58+
* Push a new tag like `vX.X.X` to trigger the release
8059

8160
## Support, Feedback, Contributing
8261

0 commit comments

Comments
 (0)