Skip to content

Commit 4679eed

Browse files
ci(ruff): enable ruff-format (#2599)
ci(ruff): enable ruff-format Enable ruff-format Disable black Fixes #2597 Reviewed-by: Laura Barcziová Reviewed-by: Nikola Forró
2 parents 4c3add3 + a00143d commit 4679eed

File tree

109 files changed

+675
-1341
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+675
-1341
lines changed

.pre-commit-config.yaml

Lines changed: 29 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,12 @@
33
# pre-commit install -t pre-commit -t pre-push
44

55
repos:
6-
- repo: https://github.com/psf/black
7-
rev: 24.8.0
8-
hooks:
9-
- id: black
10-
- repo: https://github.com/pre-commit/mirrors-prettier
11-
rev: v4.0.0-alpha.8
12-
hooks:
13-
- id: prettier
14-
exclude: tests_openshift/openshift_integration/test_data/
15-
- repo: https://github.com/pre-commit/pre-commit-hooks
16-
rev: v4.6.0
6+
- repo: https://github.com/astral-sh/ruff-pre-commit
7+
rev: v0.7.0
178
hooks:
18-
- id: check-added-large-files
19-
- id: check-ast
20-
- id: check-builtin-literals
21-
- id: check-docstring-first
22-
- id: check-executables-have-shebangs
23-
- id: check-merge-conflict
24-
- id: check-symlinks
25-
- id: check-yaml
26-
args: [--allow-multiple-documents]
27-
- id: detect-private-key
28-
exclude: tests/conftest.py
29-
- id: detect-aws-credentials
30-
args: [--allow-missing-credentials]
31-
- id: end-of-file-fixer
32-
- id: mixed-line-ending
33-
- id: trailing-whitespace
9+
- id: ruff
10+
args: [--fix, --exit-non-zero-on-fix]
11+
- id: ruff-format
3412
- repo: https://github.com/pre-commit/mirrors-mypy
3513
rev: v1.11.2
3614
hooks:
@@ -57,6 +35,30 @@ repos:
5735
types-cachetools,
5836
]
5937
exclude: files/scripts/
38+
- repo: https://github.com/pre-commit/mirrors-prettier
39+
rev: v4.0.0-alpha.8
40+
hooks:
41+
- id: prettier
42+
exclude: tests_openshift/openshift_integration/test_data/
43+
- repo: https://github.com/pre-commit/pre-commit-hooks
44+
rev: v4.6.0
45+
hooks:
46+
- id: check-added-large-files
47+
- id: check-ast
48+
- id: check-builtin-literals
49+
- id: check-docstring-first
50+
- id: check-executables-have-shebangs
51+
- id: check-merge-conflict
52+
- id: check-symlinks
53+
- id: check-yaml
54+
args: [--allow-multiple-documents]
55+
- id: detect-private-key
56+
exclude: tests/conftest.py
57+
- id: detect-aws-credentials
58+
args: [--allow-missing-credentials]
59+
- id: end-of-file-fixer
60+
- id: mixed-line-ending
61+
- id: trailing-whitespace
6062
- repo: https://github.com/shellcheck-py/shellcheck-py
6163
rev: v0.10.0.1
6264
hooks:
@@ -116,9 +118,3 @@ repos:
116118
- LICENSE_HEADER.txt
117119
- --comment-style
118120
- "#"
119-
- repo: https://github.com/astral-sh/ruff-pre-commit
120-
# Ruff version.
121-
rev: v0.0.291
122-
hooks:
123-
- id: ruff
124-
args: [--fix, --exit-non-zero-on-fix]

alembic/versions/0ad4d1c2a2d8_srpmbuildmodel_copr_related_fields.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
from alembic import op
3030
from packit_service.models import ProjectAndEventsConnector
3131

32-
if TYPE_CHECKING: # noqa: SIM108
32+
if TYPE_CHECKING:
3333
Base = object
3434
else:
3535
Base = declarative_base()

alembic/versions/46b37040cb19_add_koji_build_scratch_attribute.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
depends_on = None
2525

2626

27-
if TYPE_CHECKING: # noqa: SIM108
27+
if TYPE_CHECKING:
2828
Base = object
2929
else:
3030
Base = declarative_base()

alembic/versions/68ce6a306b30_add_koji_build_groups.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
from alembic import op
3333
from packit_service.models import ProjectAndEventsConnector
3434

35-
if TYPE_CHECKING: # noqa: SIM108
35+
if TYPE_CHECKING:
3636
Base = object
3737
else:
3838
Base = declarative_base()

alembic/versions/70c369f7ba80_add_explicit_mapping_of_tf_to_copr.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
from alembic import op
3131
from packit_service.models import ProjectAndEventsConnector
3232

33-
if TYPE_CHECKING: # noqa: SIM108
33+
if TYPE_CHECKING:
3434
Base = object
3535
else:
3636
Base = declarative_base()

alembic/versions/726cb0f70c6d_link_srpmbuildmodel_to_jobtriggermodel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
depends_on = None
3737

3838

39-
if TYPE_CHECKING: # noqa: SIM108
39+
if TYPE_CHECKING:
4040
Base = object
4141
else:
4242
Base = declarative_base()

alembic/versions/7d2b9fb924fa_add_sync_release_pull_request_table.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
from alembic import op
2222

23-
if TYPE_CHECKING: # noqa: SIM108
23+
if TYPE_CHECKING:
2424
Base = object
2525
else:
2626
Base = declarative_base()
@@ -181,7 +181,9 @@ def upgrade():
181181
pr_id = int(url[(url.rfind("/pull-request/") + 14) :]) # noqa[203]
182182
namespace = "rpms"
183183
repo = url[
184-
(url.rfind("rpms/") + 5) : url.rfind("/pull-request") # noqa[203]
184+
(url.rfind("rpms/") + 5) : url.rfind(
185+
"/pull-request",
186+
) # noqa[203]
185187
]
186188
pull_request = SyncReleasePullRequestModel.get_or_create(
187189
pr_id,

alembic/versions/800abbbb23c9_allow_multiple_forges_in_allowlist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626

2727
# https://github.com/python/mypy/issues/2477#issuecomment-313984522 ^_^
28-
if TYPE_CHECKING: # noqa: SIM108
28+
if TYPE_CHECKING:
2929
Base = object
3030
else:
3131
Base = declarative_base()

alembic/versions/8fee25b27402_drop_merge_duplicate_gitlab_projects.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from alembic import op
1616

1717
# https://github.com/python/mypy/issues/2477#issuecomment-313984522 ^_^
18-
if TYPE_CHECKING: # noqa: SIM108
18+
if TYPE_CHECKING:
1919
Base = object
2020
else:
2121
Base = declarative_base()
@@ -72,9 +72,7 @@ def upgrade():
7272
len(project.project_authentication_issue) <= 0
7373
and len(project_dot_git.project_authentication_issue) > 0
7474
):
75-
project_authentication_issue = project_dot_git.project_authentication_issue[
76-
0
77-
]
75+
project_authentication_issue = project_dot_git.project_authentication_issue[0]
7876
project_authentication_issue.project_id = project.id
7977
session.add(project_authentication_issue)
8078
# we need to commit here explicitly b/c we are changing the foreign key

alembic/versions/9fe0e970880f_add_copr_build_groups.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
from alembic import op
3333
from packit_service.models import ProjectAndEventsConnector
3434

35-
if TYPE_CHECKING: # noqa: SIM108
35+
if TYPE_CHECKING:
3636
Base = object
3737
else:
3838
Base = declarative_base()

0 commit comments

Comments
 (0)