Skip to content

Commit d22a130

Browse files
committed
Wrap ruff with pre-commit
1 parent f81047e commit d22a130

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

.pre-commit-config.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
repos:
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.11.13
4+
hooks:
5+
- id: ruff
6+
name: ruff lint
7+
args: ["--fix"]
8+
- id: ruff-format
9+
name: ruff format

setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
def get_version():
1010
version_file = open("django_prometheus/__init__.py").read()
1111
version_match = re.search(
12-
r'^__version__ = [\'"]([^\'"]*)[\'"]', version_file, re.MULTILINE
12+
r'^__version__ = [\'"]([^\'"]*)[\'"]',
13+
version_file,
14+
re.MULTILINE,
1315
)
1416
if version_match:
1517
return version_match.group(1)

tox.ini

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ commands =
3535

3636
[testenv:py39-lint]
3737
deps =
38-
ruff==0.11.13
38+
pre-commit==4.2.0
3939
commands =
40-
ruff format --check django_prometheus/
41-
ruff check django_prometheus/
40+
pre-commit run --all-files

update_version_from_git.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
git symbolic-ref -q --short HEAD || git describe --tags --exact-match
2222
"""
2323

24-
import io
2524
import re
2625
import subprocess
2726
import sys
@@ -125,5 +124,6 @@ def release_version_correct():
125124
else:
126125
print(
127126
"Invalid usage. Supply 0 or 1 arguments. "
128-
"Argument can be either a version '1.2.3' or 'patch' if you want to increase the patch-version (1.2.3 -> 1.2.4.dev)"
127+
"Argument can be either a version '1.2.3' or 'patch' "
128+
"if you want to increase the patch-version (1.2.3 -> 1.2.4.dev)"
129129
)

0 commit comments

Comments
 (0)