Skip to content

Commit eae5fc1

Browse files
committed
Update pre-commit hooks
1 parent d157b71 commit eae5fc1

File tree

6 files changed

+121
-70
lines changed

6 files changed

+121
-70
lines changed

.pre-commit-config.yaml

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
exclude: ".yarn/|yarn.lock|\\.min\\.(css|js)$"
22
repos:
33
- repo: https://github.com/pre-commit/pre-commit-hooks
4-
rev: v4.4.0
4+
rev: v6.0.0
55
hooks:
66
- id: check-added-large-files
77
- id: check-builtin-literals
@@ -14,33 +14,27 @@ repos:
1414
- id: mixed-line-ending
1515
- id: trailing-whitespace
1616
- repo: https://github.com/adamchainz/django-upgrade
17-
rev: 1.13.0
17+
rev: 1.25.0
1818
hooks:
1919
- id: django-upgrade
2020
args: [--target-version, "3.2"]
21-
- repo: https://github.com/MarcoGorelli/absolufy-imports
22-
rev: v0.3.1
23-
hooks:
24-
- id: absolufy-imports
25-
- repo: https://github.com/charliermarsh/ruff-pre-commit
26-
rev: "v0.0.272"
21+
- repo: https://github.com/astral-sh/ruff-pre-commit
22+
rev: "v0.12.8"
2723
hooks:
2824
- id: ruff
29-
- repo: https://github.com/psf/black
30-
rev: 23.3.0
31-
hooks:
32-
- id: black
33-
- repo: https://github.com/pre-commit/mirrors-prettier
34-
rev: v3.0.0-alpha.9-for-vscode
35-
hooks:
36-
- id: prettier
37-
args: [--list-different, --no-semi]
38-
exclude: "^conf/|.*\\.html$"
25+
args: [--unsafe-fixes]
26+
- id: ruff-format
27+
- repo: https://github.com/biomejs/pre-commit
28+
rev: "v2.1.4"
29+
hooks:
30+
- id: biome-check
31+
args: [--unsafe]
32+
verbose: true
3933
- repo: https://github.com/tox-dev/pyproject-fmt
40-
rev: 0.11.2
34+
rev: v2.6.0
4135
hooks:
4236
- id: pyproject-fmt
4337
- repo: https://github.com/abravalheri/validate-pyproject
44-
rev: v0.13
38+
rev: v0.24.1
4539
hooks:
4640
- id: validate-pyproject

biome.json

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/2.1.4/schema.json",
3+
"assist": { "actions": { "source": { "organizeImports": "off" } } },
4+
"formatter": {
5+
"enabled": true,
6+
"indentStyle": "space",
7+
"indentWidth": 2
8+
},
9+
"linter": {
10+
"enabled": true,
11+
"rules": {
12+
"recommended": true,
13+
"a11y": {
14+
"noSvgWithoutTitle": "off"
15+
},
16+
"correctness": {
17+
"noUndeclaredVariables": "error",
18+
"noUnusedImports": "error",
19+
"noUnusedVariables": "error",
20+
"useHookAtTopLevel": "error"
21+
},
22+
"security": {
23+
"noDangerouslySetInnerHtml": "warn"
24+
},
25+
"style": {
26+
"noParameterAssign": "off",
27+
"useForOf": "warn",
28+
"useArrayLiterals": "error"
29+
},
30+
"suspicious": {
31+
"noArrayIndexKey": "warn",
32+
"noAssignInExpressions": "off"
33+
}
34+
}
35+
},
36+
"javascript": {
37+
"formatter": {
38+
"semicolons": "asNeeded"
39+
},
40+
"globals": ["django", "CKEDITOR"]
41+
},
42+
"css": {
43+
"formatter": {
44+
"enabled": true
45+
},
46+
"linter": {
47+
"enabled": true
48+
}
49+
},
50+
"json": {
51+
"formatter": {
52+
"enabled": false
53+
}
54+
}
55+
}

feincms3_downloads/previews.py

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

55
def preview_as_jpeg(path):
66
with tempfile.TemporaryDirectory() as directory:
7-
preview = "%s/preview.jpg" % directory
7+
preview = f"{directory}/preview.jpg"
88
if path.lower().endswith(".pdf"):
99
cmd = [
1010
"pdftocairo",
@@ -24,7 +24,7 @@ def preview_as_jpeg(path):
2424
"300x300>",
2525
"-quality",
2626
"90",
27-
"%s[0]" % path,
27+
f"{path}[0]",
2828
preview,
2929
]
3030

pyproject.toml

Lines changed: 43 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ requires = [
88
name = "feincms3-downloads"
99
description = "Downloads plugin for feincms3"
1010
readme = "README.rst"
11-
license = {text = "MIT"}
11+
license = { text = "MIT" }
1212
authors = [
13-
{ name = "Matthias Kestenholz", email = "[email protected]" },
13+
{ name = "Matthias Kestenholz", email = "[email protected]" },
1414
]
1515
requires-python = ">=3.8"
1616
classifiers = [
@@ -27,6 +27,8 @@ classifiers = [
2727
"Programming Language :: Python :: 3.9",
2828
"Programming Language :: Python :: 3.10",
2929
"Programming Language :: Python :: 3.11",
30+
"Programming Language :: Python :: 3.12",
31+
"Programming Language :: Python :: 3.13",
3032
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
3133
"Topic :: Software Development",
3234
"Topic :: Software Development :: Libraries :: Application Frameworks",
@@ -35,80 +37,77 @@ dynamic = [
3537
"version",
3638
]
3739
dependencies = [
38-
"Django>=3.2",
40+
"django>=3.2",
3941
"feincms3>=4",
40-
"Pillow",
42+
"pillow",
4143
]
42-
[project.optional-dependencies]
43-
tests = [
44+
optional-dependencies.tests = [
4445
"coverage",
4546
]
46-
[project.urls]
47-
Homepage = "https://github.com/matthiask/feincms3-downloads/"
47+
urls.Homepage = "https://github.com/matthiask/feincms3-downloads/"
4848

4949
[tool.hatch.version]
5050
path = "feincms3_downloads/__init__.py"
5151

5252
[tool.ruff]
53-
extend-select = [
54-
# pyflakes, pycodestyle
55-
"F", "E", "W",
56-
# mmcabe
57-
"C90",
58-
# isort
59-
"I",
60-
# pep8-naming
61-
"N",
62-
# pyupgrade
63-
"UP",
64-
# flake8-2020
65-
"YTT",
66-
# flake8-boolean-trap
67-
"FBT",
68-
# flake8-bugbear
69-
"B",
53+
target-version = "py38"
54+
55+
fix = true
56+
show-fixes = true
57+
lint.extend-select = [
7058
# flake8-builtins
7159
"A",
60+
# flake8-bugbear
61+
"B",
7262
# flake8-comprehensions
7363
"C4",
64+
# mmcabe
65+
"C90",
7466
# flake8-django
7567
"DJ",
68+
"E",
69+
# pyflakes, pycodestyle
70+
"F",
71+
# flake8-boolean-trap
72+
"FBT",
7673
# flake8-logging-format
7774
"G",
78-
# flake8-pie
79-
"PIE",
80-
# flake8-simplify
81-
"SIM",
75+
# isort
76+
"I",
8277
# flake8-gettext
8378
"INT",
79+
# pep8-naming
80+
"N",
8481
# pygrep-hooks
8582
"PGH",
83+
# flake8-pie
84+
"PIE",
85+
"PLC",
8686
# pylint
87-
"PL",
87+
"PLE",
88+
"PLW",
8889
# unused noqa
8990
"RUF100",
91+
# flake8-simplify
92+
"SIM",
93+
# pyupgrade
94+
"UP",
95+
"W",
96+
# flake8-2020
97+
"YTT",
9098
]
91-
extend-ignore = [
99+
lint.extend-ignore = [
92100
# Allow zip() without strict=
93101
"B905",
94102
# No line length errors
95103
"E501",
96104
]
97-
fix = true
98-
show-fixes = true
99-
target-version = "py38"
100-
101-
[tool.ruff.isort]
102-
combine-as-imports = true
103-
lines-after-imports = 2
104-
105-
[tool.ruff.mccabe]
106-
max-complexity = 15
107-
108-
[tool.ruff.per-file-ignores]
109-
"*/migrat*/*" = [
105+
lint.per-file-ignores."*/migrat*/*" = [
110106
# Allow using PascalCase model names in migrations
111107
"N806",
112108
# Ignore the fact that migration files are invalid module names
113109
"N999",
114110
]
111+
lint.isort.combine-as-imports = true
112+
lint.isort.lines-after-imports = 2
113+
lint.mccabe.max-complexity = 15

tests/testapp/models.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
class Article(models.Model):
1010
regions = [Region(key="main", title=_("main"))]
1111

12+
def __str__(self):
13+
return ""
14+
1215

1316
ArticlePlugin = create_plugin_base(Article)
1417

tests/testapp/test_downloads.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313

1414
def zero_management_form_data(prefix):
1515
return {
16-
"%s-TOTAL_FORMS" % prefix: 0,
17-
"%s-INITIAL_FORMS" % prefix: 0,
18-
"%s-MIN_NUM_FORMS" % prefix: 0,
19-
"%s-MAX_NUM_FORMS" % prefix: 1000,
16+
f"{prefix}-TOTAL_FORMS": 0,
17+
f"{prefix}-INITIAL_FORMS": 0,
18+
f"{prefix}-MIN_NUM_FORMS": 0,
19+
f"{prefix}-MAX_NUM_FORMS": 1000,
2020
}
2121

2222

0 commit comments

Comments
 (0)