Skip to content

Commit fceb1d3

Browse files
committed
build(ruff,mypy): more strict rules
1 parent 433d22c commit fceb1d3

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
@@ -185,6 +185,9 @@ line-length = 88
185185

186186
[tool.ruff.lint]
187187
select = [
188+
# flake8-annotations
189+
"ANN001",
190+
"ANN2",
188191
# pycodestyle
189192
"E",
190193
# Pyflakes
@@ -196,21 +199,29 @@ select = [
196199
]
197200
ignore = ["E501", "D1", "D415"]
198201

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

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

205211
[tool.mypy]
206-
files = "commitizen"
212+
files = ["commitizen", "tests"]
213+
disallow_untyped_defs = true
207214
disallow_untyped_decorators = true
208215
disallow_subclassing_any = true
209216
warn_return_any = true
210217
warn_redundant_casts = true
211218
warn_unused_ignores = true
212219
warn_unused_configs = true
213220

221+
[[tool.mypy.overrides]]
222+
module = "tests/*"
223+
disallow_untyped_defs = false
224+
214225
[[tool.mypy.overrides]]
215226
module = "py.*" # Legacy pytest dependencies
216227
ignore_missing_imports = true
@@ -227,14 +238,14 @@ poetry_command = ""
227238
[tool.poe.tasks]
228239
format.help = "Format the code"
229240
format.sequence = [
230-
{ cmd = "ruff check --fix commitizen tests" },
231-
{ cmd = "ruff format commitizen tests" },
241+
{ cmd = "ruff check --fix" },
242+
{ cmd = "ruff format" },
232243
]
233244

234245
lint.help = "Lint the code"
235246
lint.sequence = [
236-
{ cmd = "ruff check commitizen/ tests/ --fix" },
237-
{ cmd = "mypy commitizen/ tests/" },
247+
{ cmd = "ruff check" },
248+
{ cmd = "mypy" },
238249
]
239250

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

0 commit comments

Comments
 (0)