Skip to content

Commit af1b9c2

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

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

188188
[tool.ruff.lint]
189189
select = [
190+
# flake8-annotations
191+
"ANN001",
192+
"ANN2",
190193
# pycodestyle
191194
"E",
192195
# Pyflakes
@@ -202,21 +205,29 @@ select = [
202205
]
203206
ignore = ["E501", "D1", "D415"]
204207

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

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

211217
[tool.mypy]
212-
files = "commitizen"
218+
files = ["commitizen", "tests"]
219+
disallow_untyped_defs = true
213220
disallow_untyped_decorators = true
214221
disallow_subclassing_any = true
215222
warn_return_any = true
216223
warn_redundant_casts = true
217224
warn_unused_ignores = true
218225
warn_unused_configs = true
219226

227+
[[tool.mypy.overrides]]
228+
module = "tests/*"
229+
disallow_untyped_defs = false
230+
220231
[[tool.mypy.overrides]]
221232
module = "py.*" # Legacy pytest dependencies
222233
ignore_missing_imports = true
@@ -233,14 +244,14 @@ poetry_command = ""
233244
[tool.poe.tasks]
234245
format.help = "Format the code"
235246
format.sequence = [
236-
{ cmd = "ruff check --fix commitizen tests" },
237-
{ cmd = "ruff format commitizen tests" },
247+
{ cmd = "ruff check --fix" },
248+
{ cmd = "ruff format" },
238249
]
239250

240251
lint.help = "Lint the code"
241252
lint.sequence = [
242-
{ cmd = "ruff check commitizen/ tests/ --fix" },
243-
{ cmd = "mypy commitizen/ tests/" },
253+
{ cmd = "ruff check" },
254+
{ cmd = "mypy" },
244255
]
245256

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

0 commit comments

Comments
 (0)