Skip to content

Commit 1edd85b

Browse files
authored
Replace flake8 and isort with ruff (#394)
1 parent 15e8ea7 commit 1edd85b

File tree

7 files changed

+128
-46
lines changed

7 files changed

+128
-46
lines changed

.github/workflows/tox.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
1-
name: tox
1+
name: ruff_and_tox
22
on:
33
push:
44
branches: [master]
55
pull_request:
66
branches: [master]
77
jobs:
8+
ruff: # https://beta.ruff.rs
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
- run: pip install --user "codespell[toml]" ruff
13+
- run: codespell
14+
- run: ruff --format=github .
15+
816
tox:
17+
needs: ruff
918
strategy:
1019
fail-fast: false
1120
max-parallel: 6

.pre-commit-config.yaml

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
11
repos:
2-
- repo: https://github.com/PyCQA/isort
3-
rev: 5.12.0
4-
hooks:
5-
- id: isort
6-
- repo: https://github.com/psf/black
7-
rev: 23.3.0
8-
hooks:
9-
- id: black
102
- repo: https://github.com/pre-commit/pre-commit-hooks
113
rev: v4.4.0
124
hooks:
@@ -20,6 +12,7 @@ repos:
2012
- id: check-json
2113
- id: check-merge-conflict
2214
- id: check-symlinks
15+
- id: check-toml
2316
- id: check-xml
2417
- id: check-yaml
2518
- id: debug-statements
@@ -32,12 +25,30 @@ repos:
3225
- id: pretty-format-json
3326
args: ["--autofix", "--no-sort-keys", "--indent=4"]
3427
- id: trailing-whitespace
35-
- repo: https://github.com/PyCQA/flake8
36-
rev: 6.0.0
28+
29+
- repo: https://github.com/codespell-project/codespell
30+
rev: v2.2.4
3731
hooks:
38-
- id: flake8
32+
- id: codespell
3933
additional_dependencies:
40-
- flake8-assertive
41-
- flake8-builtins
42-
- flake8-comprehensions
43-
- flake8-logging-format
34+
- tomli
35+
36+
- repo: https://github.com/charliermarsh/ruff-pre-commit
37+
rev: v0.0.263
38+
hooks:
39+
- id: ruff
40+
41+
- repo: https://github.com/psf/black
42+
rev: 23.3.0
43+
hooks:
44+
- id: black
45+
46+
- repo: https://github.com/tox-dev/pyproject-fmt
47+
rev: 0.10.0
48+
hooks:
49+
- id: pyproject-fmt
50+
51+
- repo: https://github.com/abravalheri/validate-pyproject
52+
rev: v0.12.2
53+
hooks:
54+
- id: validate-pyproject

CHANGELOG.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ v3.4.0 (2016-02-02)
274274
This change uses 'non-mutable' message that is complemented
275275
with extracted data that using string formatting option supplied
276276
by Python logging. Thanks to this, Sentry and other solutions
277-
can perform better grouping of loging messages (by status code).
277+
can perform better grouping of logging messages (by status code).
278278

279279
This is approach that is already used in handling other errors.
280280

@@ -613,7 +613,7 @@ v3.0.6 (2013-04-13)
613613

614614
- Merge pull request #71 from mjumbewu/master. [Daniel Lindsley]
615615

616-
Trailing slash in the base URL will break reqeusts
616+
Trailing slash in the base URL will break requests
617617

618618
- Make sure trailing and leading slashes do not collide. [Mjumbe Wawatu
619619
Ukweli]

Pipfile

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,8 @@ url = "https://pypi.org/simple"
44
verify_ssl = true
55

66
[dev-packages]
7-
bandit = "*"
8-
black = "==19.3b0"
97
coverage = "*"
10-
flake8 = "*"
11-
flake8-assertive = "*"
12-
flake8-bugbear = "*"
13-
flake8-builtins = "*"
14-
flake8-comprehensions = "*"
15-
flake8-eradicate = "*"
16-
flake8-logging-format = "*"
17-
isort = "*"
8+
ruff = "*"
189

1910
[packages]
2011
requests = "*"

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ Custom Authentication
174174

175175
.. code-block:: python
176176
177-
# Setup a Solr instance in a kerborized enviornment
177+
# Setup a Solr instance in a kerborized environment
178178
from requests_kerberos import HTTPKerberosAuth, OPTIONAL
179179
kerberos_auth = HTTPKerberosAuth(mutual_authentication=OPTIONAL, sanitize_mutual_error_response=False)
180180

pyproject.toml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
[tool.codespell]
2+
ignore-words-list = "dekstop,nwe,yello"
3+
skip="./.*"
4+
5+
[tool.ruff]
6+
select = [
7+
"A", # flake8-builtins
8+
"B", # flake8-bugbear
9+
"BLE", # flake8-blind-except
10+
"C4", # flake8-comprehensions
11+
"C90", # McCabe cyclomatic complexity
12+
"E", # pycodestyle
13+
"ERA", # eradicate
14+
"EXE", # flake8-executable
15+
"F", # Pyflakes
16+
"G", # flake8-logging-format
17+
"I", # isort
18+
"ICN", # flake8-import-conventions
19+
"INP", # flake8-no-pep420
20+
"INT", # flake8-gettext
21+
"ISC", # flake8-implicit-str-concat
22+
"N", # pep8-naming
23+
"PGH", # pygrep-hooks
24+
"PIE", # flake8-pie
25+
"PL", # Pylint
26+
"PT", # flake8-pytest-style
27+
"PTH", # flake8-use-pathlib
28+
"PYI", # flake8-pyi
29+
"RET", # flake8-return
30+
"RSE", # flake8-raise
31+
"RUF", # Ruff-specific rules
32+
"S", # flake8-bandit
33+
"T10", # flake8-debugger
34+
"TCH", # flake8-type-checking
35+
"TID", # flake8-tidy-imports
36+
"W", # pycodestyle
37+
"YTT", # flake8-2020
38+
# "ANN", # flake8-annotations
39+
# "ARG", # flake8-unused-arguments
40+
# "COM", # flake8-commas
41+
# "D", # pydocstyle
42+
# "DJ", # flake8-django
43+
# "DTZ", # flake8-datetimez
44+
# "EM", # flake8-errmsg
45+
# "FBT", # flake8-boolean-trap
46+
# "NPY", # NumPy-specific rules
47+
# "PD", # pandas-vet
48+
# "Q", # flake8-quotes
49+
# "SIM", # flake8-simplify
50+
# "SLF", # flake8-self
51+
# "T20", # flake8-print
52+
# "TRY", # tryceratops
53+
# "UP", # pyupgrade
54+
]
55+
ignore = [
56+
"B018",
57+
"B026",
58+
"B904",
59+
"N802",
60+
"N803",
61+
"N806",
62+
"PGH004",
63+
"PLR5501",
64+
"PLW2901",
65+
"PT009",
66+
"PTH123",
67+
"RET505",
68+
"RET506",
69+
"RUF100",
70+
"S113",
71+
"S311",
72+
"S314",
73+
"S603",
74+
]
75+
target-version = "py37"
76+
77+
[tool.ruff.mccabe]
78+
max-complexity = 16
79+
80+
[tool.ruff.pylint]
81+
allow-magic-value-types = ["int", "str"]
82+
max-args = 12
83+
max-branches = 20
84+
max-returns = 7
85+
max-statements = 54
86+
87+
[tool.ruff.per-file-ignores]
88+
"tests/*" = ["S101"]

setup.cfg

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,2 @@
11
[wheel]
22
universal = 1
3-
4-
[flake8]
5-
exclude = .venv,node_modules
6-
max-line-length = 88
7-
enable-extensions = G
8-
9-
[isort]
10-
default_section = THIRDPARTY
11-
ensure_newline_before_comments = True
12-
force_grid_wrap = 0
13-
include_trailing_comma = True
14-
known_first_party = pysolr
15-
line_length = 88
16-
multi_line_output = 3
17-
not_skip = __init__.py
18-
skip = .venv
19-
use_parentheses = True

0 commit comments

Comments
 (0)