Skip to content

Commit fc81ae1

Browse files
committed
CI/Lint: Add pyright and isort to the project
1 parent 39f7529 commit fc81ae1

File tree

4 files changed

+105
-2
lines changed

4 files changed

+105
-2
lines changed

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ format: install-dev
6363

6464
lint: install-dev
6565
$(POETRY) run black --check --extend-exclude test-data/gardenlinux .
66+
$(POETRY) run isort --check-only --skip test-data/gardenlinux .
67+
$(POETRY) run pyright
6668

6769
security: install-dev
6870
@if [ "$(CI)" = "true" ]; then \

poetry.lock

Lines changed: 63 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ black = "^25.1.0"
2828
moto = "^5.1.9"
2929
pytest = "^8.4.1"
3030
pytest-cov = "^6.2.1"
31+
isort = "^6.0.1"
32+
pyright = "^1.1.403"
3133

3234
[tool.poetry.group.docs.dependencies]
3335
sphinx-rtd-theme = "^3.0.2"
@@ -43,6 +45,17 @@ gl-s3 = "gardenlinux.s3.__main__:main"
4345
pythonpath = ["src"]
4446
norecursedirs = "test-data"
4547

48+
[tool.isort]
49+
profile = "black"
50+
line_length = 120
51+
known_first_party = ["gardenlinux"]
52+
53+
[tool.pyright]
54+
typeCheckingMode = "strict"
55+
venvPath = "."
56+
venv = ".venv"
57+
exclude = ["test-data", "docs", "hack", ".venv", ".pytest-cache", "**/__pycache"]
58+
4659
[build-system]
4760
requires = ["poetry-core"]
4861
build-backend = "poetry.core.masonry.api"

pyrightconfig.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
// Pyright is configured in 'strict' mode in pyproject.toml
3+
// This file overrides some reports and tones them down to warnings, if they are not critical.
4+
// It also turns some up to become warnings or errors.
5+
"reportShadowedImports": "warning",
6+
"reportImportCycles": "error",
7+
"reportOptionalMemberAccess": "warning",
8+
"reportOptionalSubscript": "warning",
9+
"reportOptionalContextManager": "warning",
10+
"reportOptionalCall": "warning",
11+
"reportUnusedVariable": "warning",
12+
"reportUnusedImport": "warning",
13+
"reportUnusedFunction": "warning",
14+
"reportUnusedCallResult": "warning",
15+
"reportUnusedClass": "warning",
16+
"reportUnnecessaryCast": "warning",
17+
"reportUnnecessaryComparison": "warning",
18+
"reportUnnecessaryIsInstance": "warning",
19+
"reportUnnecessaryContains": "warning",
20+
// Becomes useful after introduction of type annotations
21+
// "reportUnknownMemberType": "warning",
22+
// "reportUnknownParameterType": "warning",
23+
// "reportUnknownArgumentType": "warning",
24+
// "reportUnknownVariableType": "warning",
25+
"reportTypedDictNotRequiredAccess": "error",
26+
"reportDeprecated": "warning",
27+
}

0 commit comments

Comments
 (0)