Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ jobs:
run: "uv run ruff check ."
- name: "Linting: ruff format"
run: "uv run ruff format --check --diff ."
- name: "Linting: ty check"
run: "uv run ty check ."


markdown-lint:
Expand Down
63 changes: 63 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ lint = [
"mypy==1.11.2",
"ruff==0.14.5",
"astroid>=3.1,<4.0",
"ty==0.0.4",
]
types = [
"types-ujson",
Expand Down Expand Up @@ -116,6 +117,68 @@ filterwarnings = [
]
addopts = "-vs --cov-report term-missing --cov-report xml --dist loadscope"

[tool.ty]

[tool.ty.environment]
python-version = "3.10"

[[tool.ty.overrides]]
include = ["infrahub_sdk/**"]

[tool.ty.overrides.rules]
##################################################################################################
# The ignored rules below should be removed once the code has been updated, they are included #
# like this so that we can reactivate them one by one. #
##################################################################################################
division-by-zero = "ignore"
invalid-argument-type = "ignore"
invalid-assignment = "ignore"
invalid-await = "ignore"
invalid-return-type = "ignore"
invalid-type-form = "ignore"
missing-argument = "ignore"
no-matching-overload = "ignore"
possibly-unresolved-reference = "ignore"
redundant-cast = "ignore"
too-many-positional-arguments = "ignore"
type-assertion-failure = "ignore"
unknown-argument = "ignore"
unresolved-attribute = "ignore"
unresolved-import = "ignore"
unsupported-operator = "ignore"


[[tool.ty.overrides]]
include = ["tests/**"]

[tool.ty.overrides.rules]
##################################################################################################
# The ignored rules below should be removed once the code has been updated, they are included #
# like this so that we can reactivate them one by one. #
##################################################################################################
invalid-argument-type = "ignore"
invalid-assignment = "ignore"
invalid-method-override = "ignore"
invalid-return-type = "ignore"
no-matching-overload = "ignore"
non-subscriptable = "ignore"
not-iterable = "ignore"
possibly-missing-attribute = "ignore"
unresolved-attribute = "ignore"
unresolved-import = "ignore"


[[tool.ty.overrides]]
include = ["docs/**"]

[tool.ty.overrides.rules]
##################################################################################################
# The ignored rules below should be removed once the code has been updated, they are included #
# like this so that we can reactivate them one by one. #
##################################################################################################
invalid-assignment = "ignore"


[tool.mypy]
pretty = true
ignore_missing_imports = true
Expand Down
10 changes: 10 additions & 0 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,15 @@ def lint_mypy(context: Context) -> None:
context.run(exec_cmd)


@task
def lint_ty(context: Context) -> None:
"""Run ty type checker against all Python files."""
print(" - Check code with ty")
exec_cmd = "uv run ty check ."
with context.cd(MAIN_DIRECTORY_PATH):
context.run(exec_cmd)


@task
def lint_ruff(context: Context) -> None:
"""Run Linter to check all Python files."""
Expand Down Expand Up @@ -220,6 +229,7 @@ def lint_all(context: Context) -> None:
"""Run all linters."""
lint_yaml(context)
lint_ruff(context)
lint_ty(context)
lint_mypy(context)
lint_docs(context)

Expand Down
29 changes: 29 additions & 0 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.