Skip to content

Commit 5ecc668

Browse files
committed
Enable ruff PL (pylint) rules
- Add targeted ignores for API model patterns (too many args, lazy imports, many returns) - Allow magic values in tests and complex logic in utils - Suppress PLR2004 for HTTP status code and JWT segment comparisons
1 parent 6511168 commit 5ecc668

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-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
@@ -728,7 +728,7 @@ async def _delete(self, path: str) -> None:
728728
async def _parse_response(response: ClientResponse) -> Any:
729729
"""Check response status and parse JSON body (returns None for 204)."""
730730
await check_response(response)
731-
if response.status == 204:
731+
if response.status == 204: # noqa: PLR2004
732732
return None
733733
return await response.json()
734734

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: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,16 +122,21 @@ select = [
122122
"PTH",
123123
# flake8-builtins
124124
"A",
125+
# pylint
126+
"PL",
125127
]
126128
ignore = [
127129
"E501", # Line too long
128130
"TRY003", # Long exception messages are acceptable for domain-specific errors
129131
"A002", # Shadowing builtins (id, type) is intentional for API field names
132+
"PLR0913", # Too many arguments — expected for API model constructors
133+
"PLC0415", # Import not at top level — intentional lazy imports
134+
"PLR0911", # Too many return statements — acceptable in factory functions
130135
]
131136

132137
[tool.ruff.lint.per-file-ignores]
133-
"tests/**" = ["S101", "SLF001"] # Allow assert and private member access in tests
134-
"utils/**" = ["INP001", "BLE001"] # Utils are scripts, not packages
138+
"tests/**" = ["S101", "SLF001", "PLR2004"] # Allow assert, private member access, and magic values in tests
139+
"utils/**" = ["INP001", "BLE001", "PLR0912", "PLR0915"] # Utils are scripts, not packages; complex generators acceptable
135140

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

0 commit comments

Comments
 (0)