Skip to content

Commit 1723e65

Browse files
authored
Merge pull request #170 from twisted/ruff-pre-commit
Update pre-commit config for ruff
2 parents fd785a8 + bafd9bb commit 1723e65

File tree

5 files changed

+20
-43
lines changed

5 files changed

+20
-43
lines changed

.pre-commit-config.yaml

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,13 @@
11
repos:
2-
- repo: https://github.com/asottile/pyupgrade
3-
rev: v2.11.0
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.12.9
44
hooks:
5-
- id: pyupgrade
6-
args:
7-
- --keep-percent-format
8-
9-
- repo: https://github.com/psf/black
10-
rev: 20.8b1
11-
hooks:
12-
- id: black
13-
14-
- repo: https://gitlab.com/pycqa/flake8
15-
rev: 3.9.0
16-
hooks:
17-
- id: flake8
18-
19-
- repo: https://github.com/asottile/yesqa
20-
rev: v1.2.2
21-
hooks:
22-
- id: yesqa
5+
- id: ruff-check
6+
args: [ --fix ]
7+
- id: ruff-format
238

249
- repo: https://github.com/pre-commit/pre-commit-hooks
25-
rev: v3.4.0
10+
rev: v6.0.0
2611
hooks:
2712
- id: check-merge-conflict
2813
- id: check-toml

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ select = [
8686
"F",
8787
"UP",
8888
"I",
89+
"RUF",
8990
]
9091
ignore = [
9192
"E501",

src/incremental/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,4 +548,4 @@ def _extract_tool_incremental(data: Dict[str, object]) -> Optional[Dict[str, obj
548548

549549
from ._version import __version__ # noqa: E402
550550

551-
__all__ = ["__version__", "Version", "getVersionString"]
551+
__all__ = ["Version", "__version__", "getVersionString"]

src/incremental/update.py

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -48,31 +48,22 @@ def _run(
4848
path = _findPath(_getcwd(), package)
4949

5050
if (
51-
newversion
52-
and patch
53-
or newversion
54-
and dev
55-
or newversion
56-
and rc
57-
or newversion
58-
and post
51+
(newversion and patch)
52+
or (newversion and dev)
53+
or (newversion and rc)
54+
or (newversion and post)
5955
):
6056
raise ValueError("Only give --newversion")
6157

62-
if dev and patch or dev and rc or dev and post:
58+
if (dev and patch) or (dev and rc) or (dev and post):
6359
raise ValueError("Only give --dev")
6460

6561
if (
66-
create
67-
and dev
68-
or create
69-
and patch
70-
or create
71-
and rc
72-
or create
73-
and post
74-
or create
75-
and newversion
62+
(create and dev)
63+
or (create and patch)
64+
or (create and rc)
65+
or (create and post)
66+
or (create and newversion)
7667
):
7768
raise ValueError("Only give --create")
7869

tests/test_examples.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
from subprocess import run
1111
from tempfile import TemporaryDirectory
1212

13+
from build import BuildBackendException, ProjectBuilder
14+
from build.env import DefaultIsolatedEnv
1315
from twisted.python.filepath import FilePath
1416
from twisted.trial.unittest import TestCase
1517

16-
from build import BuildBackendException, ProjectBuilder
17-
from build.env import DefaultIsolatedEnv
1818
from incremental import Version
1919

2020
TEST_DIR = FilePath(os.path.abspath(os.path.dirname(__file__)))

0 commit comments

Comments
 (0)