Skip to content

Commit daed45d

Browse files
bearomorphismLee-W
authored andcommitted
build(ruff,mypy): more strict rules
1 parent 0de0753 commit daed45d

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

commitizen/git.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ def get_core_editor() -> str | None:
312312
return None
313313

314314

315-
def smart_open(*args, **kwargs): # type: ignore[no-untyped-def,unused-ignore]
315+
def smart_open(*args, **kwargs): # type: ignore[no-untyped-def,unused-ignore] # noqa: ANN201
316316
"""Open a file with the EOL style determined from Git."""
317317
return open(*args, newline=EOLType.for_open(), **kwargs)
318318

pyproject.toml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,9 @@ line-length = 88
186186

187187
[tool.ruff.lint]
188188
select = [
189+
# flake8-annotations
190+
"ANN001",
191+
"ANN2",
189192
# pycodestyle
190193
"E",
191194
# Pyflakes
@@ -201,21 +204,29 @@ select = [
201204
]
202205
ignore = ["E501", "D1", "D415"]
203206

207+
[tool.ruff.lint.per-file-ignores]
208+
"tests/*" = ["ANN"]
209+
204210
[tool.ruff.lint.isort]
205211
known-first-party = ["commitizen", "tests"]
206212

207213
[tool.ruff.lint.pydocstyle]
208214
convention = "google"
209215

210216
[tool.mypy]
211-
files = "commitizen"
217+
files = ["commitizen", "tests"]
218+
disallow_untyped_defs = true
212219
disallow_untyped_decorators = true
213220
disallow_subclassing_any = true
214221
warn_return_any = true
215222
warn_redundant_casts = true
216223
warn_unused_ignores = true
217224
warn_unused_configs = true
218225

226+
[[tool.mypy.overrides]]
227+
module = "tests/*"
228+
disallow_untyped_defs = false
229+
219230
[[tool.mypy.overrides]]
220231
module = "py.*" # Legacy pytest dependencies
221232
ignore_missing_imports = true
@@ -232,14 +243,14 @@ poetry_command = ""
232243
[tool.poe.tasks]
233244
format.help = "Format the code"
234245
format.sequence = [
235-
{ cmd = "ruff check --fix commitizen tests" },
236-
{ cmd = "ruff format commitizen tests" },
246+
{ cmd = "ruff check --fix" },
247+
{ cmd = "ruff format" },
237248
]
238249

239250
lint.help = "Lint the code"
240251
lint.sequence = [
241-
{ cmd = "ruff check commitizen/ tests/ --fix" },
242-
{ cmd = "mypy commitizen/ tests/" },
252+
{ cmd = "ruff check" },
253+
{ cmd = "mypy" },
243254
]
244255

245256
check-commit.help = "Check the commit message"

0 commit comments

Comments
 (0)