Skip to content

Commit 6c287a9

Browse files
committed
Switch to mypy for type checking
Signed-off-by: Martin Prpič <martin.prpic@gmail.com>
1 parent 11d8278 commit 6c287a9

4 files changed

Lines changed: 13 additions & 9 deletions

File tree

pyproject.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ test = [
4747
"pytest>=8.0.0",
4848
"pytest-cov>=4.0.0",
4949
"ruff>=0.8.0",
50-
"ty>=0.0.1a11",
50+
"mypy>=1.0.0",
5151
"tox>=4.0.0",
5252
]
5353
docs = [
@@ -56,4 +56,8 @@ docs = [
5656
dev = [
5757
{ include-group = "test" },
5858
{ include-group = "docs" }
59-
]
59+
]
60+
61+
[tool.mypy]
62+
allow_redefinition = true
63+
warn_unused_ignores = true

src/mdlint/linter.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,13 +261,13 @@ def fix_file(self, path: Path, content: str | None = None) -> FileResult:
261261
if not rule.fixable:
262262
continue
263263

264-
violations = rule.check(document, config)
265-
cached_violations[rule.id] = violations
266-
if not violations:
264+
rule_violations = rule.check(document, config)
265+
cached_violations[rule.id] = rule_violations
266+
if not rule_violations:
267267
continue
268268

269269
# Skip fix if all violations for this rule are suppressed
270-
non_suppressed = filter_suppressed(document, violations)
270+
non_suppressed = filter_suppressed(document, rule_violations)
271271
if not non_suppressed:
272272
continue
273273

src/mdlint/rules/md060.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def _check_table(
184184
if style_tight_allowed:
185185
candidates.append(errors_tight)
186186

187-
return min(candidates, key=len) if candidates else [] # type: ignore[return-value]
187+
return min(candidates, key=len) if candidates else []
188188

189189
def _check_aligned_style(
190190
self,

tox.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@ commands = ruff format .
3535

3636
[testenv:typecheck]
3737
description = Run type checker
38-
deps = ty
39-
commands = ty check src/
38+
deps = mypy
39+
commands = mypy src/

0 commit comments

Comments
 (0)