Skip to content

Commit c42cfa6

Browse files
committed
Updated pre-commit modules and switched to ruff
1 parent d47211c commit c42cfa6

File tree

5 files changed

+24
-38
lines changed

5 files changed

+24
-38
lines changed

.pre-commit-config.yaml

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# * Run "pre-commit install".
66
repos:
77
- repo: https://github.com/pre-commit/pre-commit-hooks
8-
rev: v4.2.0
8+
rev: v4.4.0
99
hooks:
1010
- id: check-toml
1111
- id: check-yaml
@@ -15,38 +15,19 @@ repos:
1515
args: [ "--fix=lf" ]
1616
- id: trailing-whitespace
1717

18-
- repo: https://github.com/asottile/pyupgrade
19-
rev: v2.32.1
18+
- repo: https://github.com/charliermarsh/ruff-pre-commit
19+
rev: v0.0.270
2020
hooks:
21-
- id: pyupgrade
22-
args: [ "--py37-plus", "--keep-runtime-typing" ]
21+
- id: ruff
22+
args: [--fix, --show-fixes]
2323

2424
- repo: https://github.com/psf/black
25-
rev: 22.3.0
25+
rev: 23.3.0
2626
hooks:
2727
- id: black
2828

29-
- repo: https://github.com/pycqa/isort
30-
rev: 5.10.1
31-
hooks:
32-
- id: isort
33-
34-
- repo: https://github.com/csachs/pyproject-flake8
35-
rev: v0.0.1a4
36-
hooks:
37-
- id: pyproject-flake8
38-
3929
- repo: https://github.com/pre-commit/mirrors-mypy
40-
rev: v0.950
30+
rev: v1.3.0
4131
hooks:
4232
- id: mypy
43-
44-
- repo: https://github.com/pre-commit/pygrep-hooks
45-
rev: v1.9.0
46-
hooks:
47-
- id: python-check-blanket-noqa
48-
- id: python-check-blanket-type-ignore
49-
- id: python-no-eval
50-
- id: rst-backticks
51-
- id: rst-directive-colons
52-
- id: rst-inline-touching-normal
33+
additional_dependencies: ["pytest"]

pyproject.toml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,18 @@ raygun = "asphalt.exceptions.reporters.raygun:RaygunExceptionReporter"
6060
version_scheme = "post-release"
6161
local_scheme = "dirty-tag"
6262

63-
[tool.isort]
64-
src_paths = ["src"]
65-
skip_gitignore = true
66-
profile = "black"
63+
[tool.ruff]
64+
line-length = 99
65+
select = [
66+
"E", "F", "W", # default flake-8
67+
"I", # isort
68+
"PGH", # pygrep-hooks
69+
"UP", # pyupgrade
70+
]
71+
target-version = "py37"
6772

68-
[tool.flake8]
69-
max-line-length = 99
73+
[tool.ruff.isort]
74+
known-first-party = ["asphalt.exceptions"]
7075

7176
[tool.pytest.ini_options]
7277
addopts = "-rsx --tb=short"

src/asphalt/exceptions/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
def report_exception(
1818
ctx: Context,
1919
message: str,
20-
exception: BaseException = None,
20+
exception: BaseException | None = None,
2121
*,
2222
logger: logging.Logger | str | bool = True,
2323
) -> None:

src/asphalt/exceptions/component.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import logging
44
from asyncio import AbstractEventLoop
55
from functools import partial
6-
from typing import Any, AsyncIterator, Dict, Optional
6+
from typing import Any, AsyncIterator
77

88
from asphalt.core import (
99
Component,
@@ -62,7 +62,7 @@ class ExceptionReporterComponent(Component):
6262

6363
def __init__(
6464
self,
65-
reporters: Dict[str, Optional[Dict[str, Any]]] = None,
65+
reporters: dict[str, dict[str, Any] | None] | None = None,
6666
install_default_handler: bool = True,
6767
**default_args,
6868
) -> None:

src/asphalt/exceptions/reporters/sentry.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import annotations
22

33
import logging
4-
from typing import Any, Dict, Sequence, Union
4+
from typing import Any, Sequence
55

66
import sentry_sdk
77
from asphalt.core import Context, resolve_reference
@@ -41,7 +41,7 @@ class SentryExceptionReporter(ExceptionReporter):
4141
"""
4242

4343
def __init__(
44-
self, integrations: Sequence[Union[Integration, Dict[str, Any]]] = (), **options
44+
self, integrations: Sequence[Integration | dict[str, Any]] = (), **options
4545
) -> None:
4646
check_argument_types()
4747
options.setdefault("environment", "development" if __debug__ else "production")

0 commit comments

Comments
 (0)