Skip to content

Commit cff63c1

Browse files
committed
Switch linting + isort to ruff (run via pre-commit)
1 parent c3dd2e2 commit cff63c1

File tree

5 files changed

+69
-126
lines changed

5 files changed

+69
-126
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,8 @@ jobs:
1212
- name: Setup Python
1313
uses: actions/setup-python@v4
1414
with:
15-
python-version: 3.9
16-
cache: pip
17-
cache-dependency-path: |
18-
requirements-dev.txt
19-
setup.py
20-
- name: Install dependencies
21-
run: |
22-
python -m pip install --upgrade pip setuptools wheel
23-
python -m pip install -r requirements-dev.txt
24-
- name: Run flake8
25-
run: flake8
15+
python-version: 3.11
16+
- uses: pre-commit/[email protected]
2617
build:
2718
runs-on: ubuntu-latest
2819
strategy:

.pre-commit-config.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
minimum_pre_commit_version: 2.15.0
2+
ci:
3+
autofix_prs: false
4+
repos:
5+
- repo: https://github.com/astral-sh/ruff-pre-commit
6+
rev: v0.0.278
7+
hooks:
8+
- id: ruff
9+
args:
10+
- --fix
11+
- repo: https://github.com/psf/black
12+
rev: 23.7.0
13+
hooks:
14+
- id: black

pyproject.toml

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,47 @@ line-length = 99
33
target-version = ['py36']
44
skip-string-normalization = true
55

6-
[tool.isort]
7-
profile = "black"
8-
multi_line_output = 3
6+
[tool.ruff]
7+
exclude = [
8+
".git",
9+
"ENV",
10+
"__pycache__",
11+
"build",
12+
]
13+
ignore = [
14+
"D100",
15+
"D104",
16+
"D105",
17+
"D200",
18+
"D202",
19+
"D203",
20+
"D205",
21+
"D212",
22+
"D400",
23+
"D401",
24+
"D403",
25+
"D415",
26+
"E501",
27+
]
28+
line-length = 99
29+
select = [
30+
# NB: `hacking` rules aren't supported by ruff
31+
"B",
32+
"D",
33+
"E",
34+
"F",
35+
"I",
36+
"S",
37+
"W",
38+
]
39+
40+
[tool.ruff.per-file-ignores]
41+
"*/__init__.py" = ["F401"]
42+
"test/*" = [
43+
"D",
44+
"F841",
45+
"S101",
46+
"S105",
47+
"S106",
48+
"B011",
49+
]

requirements-dev.in

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,5 @@
1-
black~=21.4b1; platform_python_implementation != "PyPy"
2-
flake8
3-
flake8-bandit
4-
flake8-black; platform_python_implementation != "PyPy"
5-
flake8-bugbear
6-
flake8-docstrings
7-
flake8-isort
8-
flake8-pytest
9-
hacking
10-
isort
111
mock
122
pip-tools
133
pytest
144
pytest-cov
155
responses
16-
safety

requirements-dev.txt

Lines changed: 9 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,27 @@
11
#
2-
# This file is autogenerated by pip-compile
3-
# To update, run:
2+
# This file is autogenerated by pip-compile with Python 3.10
3+
# by the following command:
44
#
55
# pip-compile requirements-dev.in
66
#
7-
appdirs==1.4.4
8-
# via black
97
attrs==20.3.0
10-
# via
11-
# flake8-bugbear
12-
# pytest
13-
bandit==1.7.0
14-
# via flake8-bandit
15-
black==21.4b1 ; platform_python_implementation != "PyPy"
16-
# via
17-
# -r requirements-dev.in
18-
# flake8-black
8+
# via pytest
199
certifi==2020.12.5
2010
# via requests
2111
chardet==4.0.0
2212
# via requests
2313
click==7.1.2
24-
# via
25-
# black
26-
# pip-tools
27-
# safety
14+
# via pip-tools
2815
coverage==5.5
2916
# via pytest-cov
30-
dparse==0.5.1
31-
# via safety
32-
flake8-bandit==2.1.2
33-
# via -r requirements-dev.in
34-
flake8-black==0.2.1 ; platform_python_implementation != "PyPy"
35-
# via -r requirements-dev.in
36-
flake8-bugbear==21.4.3
37-
# via -r requirements-dev.in
38-
flake8-docstrings==1.6.0
39-
# via -r requirements-dev.in
40-
flake8-isort==4.0.0
41-
# via -r requirements-dev.in
42-
flake8-polyfill==1.0.2
43-
# via flake8-bandit
44-
flake8-pytest==1.3
45-
# via -r requirements-dev.in
46-
flake8==3.8.4
47-
# via
48-
# -r requirements-dev.in
49-
# flake8-bandit
50-
# flake8-black
51-
# flake8-bugbear
52-
# flake8-docstrings
53-
# flake8-isort
54-
# flake8-polyfill
55-
# flake8-pytest
56-
# hacking
57-
gitdb==4.0.7
58-
# via gitpython
59-
gitpython==3.1.14
60-
# via bandit
61-
hacking==4.1.0
62-
# via -r requirements-dev.in
6317
idna==2.10
6418
# via requests
6519
iniconfig==1.1.1
6620
# via pytest
67-
isort==5.8.0
68-
# via
69-
# -r requirements-dev.in
70-
# flake8-isort
71-
mccabe==0.6.1
72-
# via flake8
7321
mock==4.0.3
7422
# via -r requirements-dev.in
75-
mypy-extensions==0.4.3
76-
# via black
7723
packaging==20.9
78-
# via
79-
# dparse
80-
# pytest
81-
# safety
82-
pathspec==0.8.1
83-
# via black
84-
pbr==5.6.0
85-
# via stevedore
24+
# via pytest
8625
pep517==0.10.0
8726
# via pip-tools
8827
pip-tools==6.1.0
@@ -91,52 +30,22 @@ pluggy==0.13.1
9130
# via pytest
9231
py==1.10.0
9332
# via pytest
94-
pycodestyle==2.6.0
95-
# via
96-
# flake8
97-
# flake8-bandit
98-
pydocstyle==6.0.0
99-
# via flake8-docstrings
100-
pyflakes==2.2.0
101-
# via flake8
10233
pyparsing==2.4.7
10334
# via packaging
104-
pytest-cov==2.11.1
105-
# via -r requirements-dev.in
10635
pytest==6.2.3
10736
# via
10837
# -r requirements-dev.in
10938
# pytest-cov
110-
pyyaml==6.0.1
111-
# via
112-
# bandit
113-
# dparse
114-
regex==2021.4.4
115-
# via black
39+
pytest-cov==2.11.1
40+
# via -r requirements-dev.in
11641
requests==2.25.1
117-
# via
118-
# responses
119-
# safety
42+
# via responses
12043
responses==0.13.2
12144
# via -r requirements-dev.in
122-
safety==1.10.3
123-
# via -r requirements-dev.in
12445
six==1.15.0
125-
# via
126-
# bandit
127-
# responses
128-
smmap==4.0.0
129-
# via gitdb
130-
snowballstemmer==2.1.0
131-
# via pydocstyle
132-
stevedore==3.3.0
133-
# via bandit
134-
testfixtures==6.17.1
135-
# via flake8-isort
46+
# via responses
13647
toml==0.10.2
13748
# via
138-
# black
139-
# dparse
14049
# pep517
14150
# pytest
14251
urllib3==1.26.5
@@ -146,4 +55,3 @@ urllib3==1.26.5
14655

14756
# The following packages are considered to be unsafe in a requirements file:
14857
# pip
149-
# setuptools

0 commit comments

Comments
 (0)