Skip to content

Commit 4a69986

Browse files
committed
build(ruff,mypy): more strict rules
1 parent 6350ff0 commit 4a69986

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
@@ -197,21 +200,29 @@ select = [
197200
]
198201
ignore = ["E501", "D1", "D415"]
199202

203+
[tool.ruff.lint.per-file-ignores]
204+
"tests/*" = ["ANN"]
205+
200206
[tool.ruff.lint.isort]
201207
known-first-party = ["commitizen", "tests"]
202208

203209
[tool.ruff.lint.pydocstyle]
204210
convention = "google"
205211

206212
[tool.mypy]
207-
files = "commitizen"
213+
files = ["commitizen", "tests"]
214+
disallow_untyped_defs = true
208215
disallow_untyped_decorators = true
209216
disallow_subclassing_any = true
210217
warn_return_any = true
211218
warn_redundant_casts = true
212219
warn_unused_ignores = true
213220
warn_unused_configs = true
214221

222+
[[tool.mypy.overrides]]
223+
module = "tests/*"
224+
disallow_untyped_defs = false
225+
215226
[[tool.mypy.overrides]]
216227
module = "py.*" # Legacy pytest dependencies
217228
ignore_missing_imports = true
@@ -228,14 +239,14 @@ poetry_command = ""
228239
[tool.poe.tasks]
229240
format.help = "Format the code"
230241
format.sequence = [
231-
{ cmd = "ruff check --fix commitizen tests" },
232-
{ cmd = "ruff format commitizen tests" },
242+
{ cmd = "ruff check --fix" },
243+
{ cmd = "ruff format" },
233244
]
234245

235246
lint.help = "Lint the code"
236247
lint.sequence = [
237-
{ cmd = "ruff check commitizen/ tests/ --fix" },
238-
{ cmd = "mypy commitizen/ tests/" },
248+
{ cmd = "ruff check" },
249+
{ cmd = "mypy" },
239250
]
240251

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

0 commit comments

Comments
 (0)