Skip to content

Commit 124fde4

Browse files
[pre-commit.ci] pre-commit autoupdate (#426)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent 601583f commit 124fde4

File tree

8 files changed

+57
-29
lines changed

8 files changed

+57
-29
lines changed

.github/workflows/check.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: check
22
on:
33
workflow_dispatch:
44
push:
5-
branches: "main"
5+
branches: ["main"]
66
tags-ignore: ["**"]
77
pull_request:
88
schedule:

.pre-commit-config.yaml

+15-8
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@ repos:
44
hooks:
55
- id: end-of-file-fixer
66
- id: trailing-whitespace
7-
- repo: https://github.com/astral-sh/ruff-pre-commit
8-
rev: "v0.2.0"
7+
- repo: https://github.com/python-jsonschema/check-jsonschema
8+
rev: 0.28.0
99
hooks:
10-
- id: ruff
11-
args: [--fix, --exit-non-zero-on-fix]
12-
- repo: https://github.com/psf/black
13-
rev: 24.1.1
10+
- id: check-github-workflows
11+
args: [ "--verbose" ]
12+
- repo: https://github.com/codespell-project/codespell
13+
rev: v2.2.6
1414
hooks:
15-
- id: black
15+
- id: codespell
16+
additional_dependencies: ["tomli>=2.0.1"]
1617
- repo: https://github.com/tox-dev/tox-ini-fmt
1718
rev: "1.3.1"
1819
hooks:
@@ -22,7 +23,13 @@ repos:
2223
rev: "1.7.0"
2324
hooks:
2425
- id: pyproject-fmt
25-
additional_dependencies: ["tox>=4.11.4"]
26+
additional_dependencies: ["tox>=4.12.1"]
27+
- repo: https://github.com/astral-sh/ruff-pre-commit
28+
rev: "v0.2.1"
29+
hooks:
30+
- id: ruff-format
31+
- id: ruff
32+
args: ["--fix", "--unsafe-fixes", "--exit-non-zero-on-fix"]
2633
- repo: meta
2734
hooks:
2835
- id: check-hooks-apply

ignore-words.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
master
2+
manuel

pyproject.toml

+17-6
Original file line numberDiff line numberDiff line change
@@ -68,27 +68,38 @@ version.source = "vcs"
6868
line-length = 120
6969

7070
[tool.ruff]
71-
select = ["ALL"]
7271
line-length = 120
7372
target-version = "py37"
74-
isort = {known-first-party = ["tox", "tests"], required-imports = ["from __future__ import annotations"]}
75-
ignore = [
76-
"ANN101", # no typoe annotation for self
73+
lint.select = ["ALL"]
74+
lint.isort = {known-first-party = ["sphinx_autodoc_typehints", "tests"], required-imports = ["from __future__ import annotations"]}
75+
lint.ignore = [
76+
"ANN101", # no type annotation for self
7777
"ANN401", # allow Any as type annotation
7878
"D203", # `one-blank-line-before-class` (D203) and `no-blank-line-before-class` (D211) are incompatible
7979
"D212", # `multi-line-summary-first-line` (D212) and `multi-line-summary-second-line` (D213) are incompatible
8080
"S104", # Possible binding to all interface
81+
"COM812", # Conflict with formatter
82+
"ISC001", # Conflict with formatter
83+
"CPY", # No copyright statements
8184
]
82-
[tool.ruff.per-file-ignores]
85+
[tool.ruff.lint.per-file-ignores]
8386
"tests/**/*.py" = [
8487
"S101", # asserts allowed in tests...
8588
"FBT", # don"t care about booleans as positional arguments in tests
8689
"INP001", # no implicit namespace
87-
"D", # don"t care about documentation in tests
90+
"D", # don't care about documentation in tests
8891
"S603", # `subprocess` call: check for execution of untrusted input
8992
"PLR2004", # Magic value used in comparison, consider replacing with a constant variable
93+
"PLR0913", # any number of arguments in tests
94+
"PLR0917", # any number of arguments in tests
9095
]
9196

97+
[tool.codespell]
98+
builtin = "clear,usage,en-GB_to_en-US"
99+
ignore-words = "ignore-words.txt"
100+
write-changes = true
101+
count = true
102+
92103
[tool.pytest.ini_options]
93104
testpaths = ["tests"]
94105

tests/roots/test-resolve-typing-guard-tmp/demo_typing_guard.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class SomeClass:
1717
@classmethod
1818
def from_str(cls, input_value: str) -> SomeClass: # noqa: ANN102
1919
"""
20-
Initialise from string
20+
Initialize from string
2121
2222
:param input_value: Input
2323
:return: result
@@ -27,7 +27,7 @@ def from_str(cls, input_value: str) -> SomeClass: # noqa: ANN102
2727
@classmethod
2828
def from_date(cls, input_value: datetime.date) -> SomeClass: # noqa: ANN102
2929
"""
30-
Initialise from date
30+
Initialize from date
3131
3232
:param input_value: Input
3333
:return: result
@@ -37,7 +37,7 @@ def from_date(cls, input_value: datetime.date) -> SomeClass: # noqa: ANN102
3737
@classmethod
3838
def from_time(cls, input_value: datetime.time) -> SomeClass: # noqa: ANN102
3939
"""
40-
Initialise from time
40+
Initialize from time
4141
4242
:param input_value: Input
4343
:return: result

tests/roots/test-resolve-typing-guard/demo_typing_guard.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ def guarded(self, item: Decimal) -> None:
5555
"""
5656

5757

58-
def func(_x: Literal) -> None: ...
58+
def func(_x: Literal) -> None:
59+
...
5960

6061

6162
__all__ = [

tests/test_integration.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -625,11 +625,13 @@ def func_with_examples() -> int:
625625

626626

627627
@overload
628-
def func_with_overload(a: int, b: int) -> None: ...
628+
def func_with_overload(a: int, b: int) -> None:
629+
...
629630

630631

631632
@overload
632-
def func_with_overload(a: str, b: str) -> None: ...
633+
def func_with_overload(a: str, b: str) -> None:
634+
...
633635

634636

635637
@expected(
@@ -1094,7 +1096,7 @@ def docstring_with_bullet_list_after_params(param: int) -> None: # noqa: ARG001
10941096
maybe multiple lines
10951097
10961098
Next Term
1097-
Somethign about it
1099+
Something about it
10981100
10991101
""",
11001102
)
@@ -1110,7 +1112,7 @@ def docstring_with_definition_list_after_params(param: int) -> None: # noqa: AR
11101112
maybe multiple lines
11111113
11121114
Next Term
1113-
Somethign about it
1115+
Something about it
11141116
"""
11151117

11161118

@@ -1162,7 +1164,7 @@ def docstring_with_enum_list_after_params(param: int) -> None: # noqa: ARG001
11621164
maybe multiple lines
11631165
11641166
Next Term
1165-
Somethign about it
1167+
Something about it
11661168
11671169
-[ Example ]-
11681170
""",
@@ -1179,7 +1181,7 @@ def docstring_with_definition_list_after_params_no_blank_line(param: int) -> Non
11791181
maybe multiple lines
11801182
11811183
Next Term
1182-
Somethign about it
1184+
Something about it
11831185
.. rubric:: Example
11841186
"""
11851187

tests/test_sphinx_autodoc_typehints.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import typing_extensions
3535
from sphinx.application import Sphinx
3636
from sphinx.config import Config
37+
3738
from sphinx_autodoc_typehints import (
3839
_resolve_type_guarded_imports,
3940
backfill_type_hints,
@@ -80,17 +81,20 @@ class A:
8081
def get_type(self) -> type:
8182
return type(self)
8283

83-
class Inner: ...
84+
class Inner:
85+
...
8486

8587

8688
class B(Generic[T]):
8789
name = "Foo" # This is set to make sure the correct class name ("B") is picked up
8890

8991

90-
class C(B[str]): ...
92+
class C(B[str]):
93+
...
9194

9295

93-
class D(typing_extensions.Protocol): ...
96+
class D(typing_extensions.Protocol):
97+
...
9498

9599

96100
class E(typing_extensions.Protocol[T]): # type: ignore[misc]
@@ -101,7 +105,8 @@ class Slotted:
101105
__slots__ = ()
102106

103107

104-
class Metaclass(type): ...
108+
class Metaclass(type):
109+
...
105110

106111

107112
class HintedMethods:

0 commit comments

Comments
 (0)