Skip to content

Commit cbfe6cd

Browse files
committed
Enable ruff PL (pylint) rules with targeted ignores
Add pylint rule set. Globally ignore PLR0913 (too many args in model constructors), PLC0415 (intentional lazy imports), PLR0911 (factory return statements). Ignore PLR2004 in tests and PLR0912/PLR0915 in utils. Add noqa for well-known HTTP status codes and JWT checks.
1 parent 825b6b7 commit cbfe6cd

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

pyoverkiz/auth/strategies.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ async def _post_login(self, data: Mapping[str, Any]) -> None:
116116
)
117117

118118
# A 204 No Content response cannot have a body, so skip JSON parsing.
119-
if response.status == 204:
119+
if response.status == 204: # noqa: PLR2004
120120
return
121121

122122
result = await response.json()
@@ -419,7 +419,7 @@ def auth_headers(self, path: str | None = None) -> Mapping[str, str]:
419419
def _decode_jwt_payload(token: str) -> dict[str, Any]:
420420
"""Decode the payload of a JWT token."""
421421
parts = token.split(".")
422-
if len(parts) < 2:
422+
if len(parts) < 2: # noqa: PLR2004
423423
raise InvalidTokenError("Malformed JWT received.")
424424

425425
payload_segment = parts[1]

pyoverkiz/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,7 @@ async def _delete(self, path: str) -> None:
731731
async def _parse_response(response: ClientResponse) -> Any:
732732
"""Check response status and parse JSON body (returns None for 204)."""
733733
await check_response(response)
734-
if response.status == 204:
734+
if response.status == 204: # noqa: PLR2004
735735
return None
736736
return await response.json()
737737

pyoverkiz/response_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ async def check_response(response: ClientResponse) -> None:
124124
if "is down for maintenance" in result:
125125
raise MaintenanceError("Server is down for maintenance") from error
126126

127-
if response.status == 503:
127+
if response.status == 503: # noqa: PLR2004
128128
raise ServiceUnavailableError(result) from error
129129

130130
raise OverkizError(

pyproject.toml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,19 @@ select = [
7373
"C4",
7474
# pep8-naming
7575
"N",
76+
# pylint
77+
"PL",
78+
]
79+
ignore = [
80+
"E501", # Line too long
81+
"PLR0913", # Too many arguments — expected for API model constructors
82+
"PLC0415", # Import not at top level — intentional lazy imports
83+
"PLR0911", # Too many return statements — acceptable in factory functions
7684
]
77-
ignore = ["E501"] # Line too long
7885

7986
[tool.ruff.lint.per-file-ignores]
80-
"tests/**" = ["S101"] # Allow assert in tests
87+
"tests/**" = ["S101", "PLR2004"] # Allow assert and magic values in tests
88+
"utils/**" = ["PLR0912", "PLR0915"] # Complex generator scripts are acceptable
8189

8290
[tool.ruff.lint.pydocstyle]
8391
convention = "google" # Accepts: "google", "numpy", or "pep257".

0 commit comments

Comments
 (0)