Skip to content

Commit bc91723

Browse files
committed
update pre-commt
1 parent b22ea62 commit bc91723

File tree

4 files changed

+33
-24
lines changed

4 files changed

+33
-24
lines changed

.pre-commit-config.yaml

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414

1515
exclude: |
1616
(?x)(
17-
^tests/test_cydifflib_expect.html
17+
^tests/test_cydifflib_expect.html|
18+
tools/sdist.patch
1819
)
1920
20-
2121
repos:
2222
# Standard hooks
2323
- repo: https://github.com/pre-commit/pre-commit-hooks
24-
rev: "v4.5.0"
24+
rev: "v5.0.0"
2525
hooks:
2626
- id: check-added-large-files
2727
- id: check-case-conflict
@@ -37,27 +37,27 @@ repos:
3737
- id: trailing-whitespace
3838

3939
# Black, the code formatter, natively supports pre-commit
40-
- repo: https://github.com/psf/black
41-
rev: "24.1.1" # Keep in sync with blacken-docs
40+
- repo: https://github.com/psf/black-pre-commit-mirror
41+
rev: "25.1.0" # Keep in sync with blacken-docs
4242
hooks:
4343
- id: black
4444

4545
# Also code format the docs
4646
- repo: https://github.com/asottile/blacken-docs
47-
rev: "1.16.0"
47+
rev: "1.19.1"
4848
hooks:
4949
- id: blacken-docs
5050
additional_dependencies:
51-
- black==22.8.0 # keep in sync with black hook
51+
- black==24.2.0 # keep in sync with black hook
5252

5353
# Changes tabs to spaces
5454
- repo: https://github.com/Lucas-C/pre-commit-hooks
55-
rev: "v1.5.4"
55+
rev: "v1.5.5"
5656
hooks:
5757
- id: remove-tabs
5858

5959
- repo: https://github.com/sirosen/texthooks
60-
rev: "0.6.4"
60+
rev: "0.6.8"
6161
hooks:
6262
- id: fix-ligatures
6363
- id: fix-smartquotes
@@ -74,7 +74,7 @@ repos:
7474

7575
# PyLint has native support - not always usable, but works for us
7676
- repo: https://github.com/PyCQA/pylint
77-
rev: "v3.0.3"
77+
rev: "v3.3.6"
7878
hooks:
7979
- id: pylint
8080
files: ^pybind11
@@ -99,30 +99,30 @@ repos:
9999

100100
# Checks the manifest for missing files (native support)
101101
- repo: https://github.com/mgedmin/check-manifest
102-
rev: "0.49"
102+
rev: "0.50"
103103
hooks:
104104
- id: check-manifest
105105
# This is a slow hook, so only run this if --hook-stage manual is passed
106106
stages: [manual]
107107
additional_dependencies: [cmake, ninja]
108108

109109
- repo: https://github.com/charliermarsh/ruff-pre-commit
110-
rev: v0.2.0
110+
rev: v0.11.5
111111
hooks:
112112
- id: ruff
113113
args: ["--fix", "--show-fixes"]
114114

115115
# Check for spelling
116116
- repo: https://github.com/codespell-project/codespell
117-
rev: "v2.2.6"
117+
rev: "v2.4.1"
118118
hooks:
119119
- id: codespell
120120
exclude: ".*/test_.*.py"
121121
args: ["-L", "aline,alo,ore"]
122122

123123
# Check for common shell mistakes
124124
- repo: https://github.com/shellcheck-py/shellcheck-py
125-
rev: "v0.9.0.6"
125+
rev: "v0.10.0.1"
126126
hooks:
127127
- id: shellcheck
128128

@@ -134,3 +134,10 @@ repos:
134134
language: pygrep
135135
entry: PyBind|Numpy|Cmake|CCache|PyTest
136136
exclude: ^\.pre-commit-config.yaml$
137+
138+
# Clang format the codebase automatically
139+
- repo: https://github.com/pre-commit/mirrors-clang-format
140+
rev: "v20.1.0"
141+
hooks:
142+
- id: clang-format
143+
types_or: [c++, c]

pyproject.toml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,14 @@ disable = [
9292
]
9393

9494
[tool.ruff]
95+
target-version = "py37"
96+
src = ["src"]
97+
exclude = []
98+
flake8-unused-arguments.ignore-variadic-names = true
99+
isort.required-imports = ["from __future__ import annotations"]
100+
101+
102+
[tool.ruff.lint]
95103
select = [
96104
"E", "F", "W", # flake8
97105
"B", # flake8-bugbear
@@ -120,25 +128,19 @@ select = [
120128
extend-ignore = [
121129
"PLR", # Design related pylint codes
122130
"E501", # Line too long
123-
"PT004", # Use underscore for non-returning fixture (use usefixture instead)
124131
"PTH123", # use pathlib instead of builtin open
125132

126133
"F403", # todo we should do better in the future
127134
"RUF001", # this simply leads to incorrect code
128135

129-
"PT027" # we want to keep the test code close to the one in cpython
136+
"PT027", "UP031", "RUF021" # we want to keep the test code close to the one in cpython
130137
]
131-
target-version = "py37"
132-
src = ["src"]
133138
unfixable = [
134139
"T20", # Removes print statements
135140
"F841", # Removes unused variables
136141
]
137-
exclude = []
138-
flake8-unused-arguments.ignore-variadic-names = true
139-
isort.required-imports = ["from __future__ import annotations"]
140142

141-
[tool.ruff.per-file-ignores]
143+
[tool.ruff.lint.per-file-ignores]
142144
"tests/**" = ["T20", "PT009", "ARG001", "PTH118", "PTH120"]
143145
"bench/**" = ["T20"]
144146
"setup.py" = ["T20"]

src/cydifflib/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ function(create_cython_target _name)
1818
endif()
1919
endfunction(create_cython_target)
2020

21-
2221
function(rf_add_library name)
2322
if(CMAKE_VERSION VERSION_LESS 3.17)
2423
python_add_library(${name} MODULE ${ARGV})
@@ -35,7 +34,6 @@ function(rf_add_library name)
3534
endif()
3635
endfunction(rf_add_library)
3736

38-
3937
create_cython_target(_initialize)
4038
rf_add_library(_initialize ${_initialize})
4139
target_compile_features(_initialize PUBLIC cxx_std_17)

src/cydifflib/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
For producing HTML side by side comparison with change highlights.
2727
"""
2828

29+
from __future__ import annotations
30+
2931
__author__ = "Max Bachmann"
3032
__license__ = "MIT"
3133
__version__: str = "1.2.0"

0 commit comments

Comments
 (0)