Skip to content

Commit d546d1c

Browse files
Codacy linting updates
1 parent 471147b commit d546d1c

7 files changed

Lines changed: 31 additions & 16 deletions

File tree

.pylintrc

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,37 @@
1+
[MASTER]
2+
# Support both old pylint ([MASTER]) and new pylint ([MAIN]) section names.
3+
py-version = 3.12
4+
15
[MAIN]
26
py-version = 3.12
37

48
[BASIC]
59
# h and s are intentional short names that map directly to API query parameters.
6-
good-names = h,s,e,i,j,k,_
10+
# bp_* are idiomatic FastAPI APIRouter instance names, not constants.
11+
good-names = h,s,e,i,j,k,_,bp_dc,bp_hc,bp_marvel
712

813
[DESIGN]
914
# _build_options and route handlers mirror the full set of API query parameters.
1015
max-args = 15
1116
max-positional-arguments = 15
1217

1318
[MESSAGES CONTROL]
14-
# 'format' and 'help' shadow builtins intentionally — they are public API
15-
# query-parameter names whose spelling cannot be changed without breaking clients.
19+
# redefined-builtin: 'format' and 'help' shadow builtins intentionally — they
20+
# are public API query-parameter names that cannot be renamed.
21+
# line-too-long: not enforced in this project.
22+
# missing-module-docstring: modules use file-level docstrings only where needed.
23+
# E0611 (no-name-in-module): false positive — Annotated/Literal exist in
24+
# typing since Python 3.8/3.9; old pylint doesn't know this.
25+
# E1136 (unsubscriptable-object): false positive — list[x]/dict[x] are valid
26+
# in Python 3.9+; old pylint doesn't know this.
27+
# C0326 (bad-whitespace): false positive — PEP 8 requires spaces around '='
28+
# for annotated function parameters; old pylint flags these incorrectly.
29+
# C0330 (wrong-hanging-indentation): removed in pylint 2.6+ but triggers as a
30+
# false positive in older Codacy pylint builds.
1631
disable = redefined-builtin,
1732
line-too-long,
18-
missing-module-docstring
33+
missing-module-docstring,
34+
no-name-in-module,
35+
unsubscriptable-object,
36+
bad-whitespace,
37+
wrong-hanging-indentation

service/routes/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
from .healthcheck import bp_hc
55
from .marvel import bp_marvel
66

7-
87
def init_app(app: FastAPI) -> None:
98
app.include_router(bp_dc)
109
app.include_router(bp_hc)
1110
app.include_router(bp_marvel)
12-

service/routes/dc.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ def dc_get_by_character(
214214
prune: Annotated[Optional[str], Query(description=f"Remove keys with null values. {_TF_TEXT}")] = None,
215215
s: Annotated[Optional[str], Query(description="Columns to sort on.")] = None,
216216
):
217+
"""GET handler for DC universe character search by name."""
217218
api = ApiUtils()
218219
safe_chars = _sanitize(characters)
219220
options = _build_options(
@@ -241,6 +242,7 @@ def dc_get_by_character(
241242
description=_POST_DESCRIPTION,
242243
)
243244
def dc_post(body: CharacterSearchBody):
245+
"""POST handler for DC universe character search."""
244246
api = ApiUtils()
245247
options = body.model_dump(exclude_none=True)
246248
options.setdefault("universe", "dc")

service/routes/healthcheck.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88

99
bp_hc = APIRouter()
1010

11-
1211
@bp_hc.get("/healthcheck", tags=["healthcheck"], summary="Test if the Service is up", response_model=HealthResponse)
1312
def healthcheck() -> HealthResponse:
1413
"""Simple health check endpoint."""
1514
return HealthResponse(status="Ok")
16-

service/routes/marvel.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ def marvel_get_by_character(
217217
prune: Annotated[Optional[str], Query(description=f"Remove keys with null values. {_TF_TEXT}")] = None,
218218
s: Annotated[Optional[str], Query(description="Columns to sort on.")] = None,
219219
):
220+
"""GET handler for Marvel universe character search by name."""
220221
api = ApiUtils()
221222
safe_chars = _sanitize(characters)
222223
options = _build_options(
@@ -244,6 +245,7 @@ def marvel_get_by_character(
244245
description=_POST_DESCRIPTION,
245246
)
246247
def marvel_post(body: CharacterSearchBody):
248+
"""POST handler for Marvel universe character search."""
247249
api = ApiUtils()
248250
options = body.model_dump(exclude_none=True)
249251
options.setdefault("universe", "marvel")

service/utils/file.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -205,13 +205,10 @@ def sort_i18n_str(self, row: dict, sort_col: str, sort_dir: bool) -> tuple:
205205
if self.config.get("nulls") == "first" and not self.config.get("prune"):
206206
if not sort_dir:
207207
return (itm is not None, itm != "", itm)
208-
else:
209-
return (itm is None, itm != "", itm)
210-
else:
211-
if not sort_dir:
212-
return (itm is None, itm != "", itm)
213-
else:
214-
return (itm is not None, itm != "", itm)
208+
return (itm is None, itm != "", itm)
209+
if not sort_dir:
210+
return (itm is None, itm != "", itm)
211+
return (itm is not None, itm != "", itm)
215212

216213
def sort_results(self, results: list, srt_ordr: list | None = None) -> list:
217214
"""

unit/conftest.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,4 +151,3 @@ def common_config_options(request):
151151
if request is not None and data.get(request.param):
152152
val = data[request.param]
153153
return val
154-

0 commit comments

Comments
 (0)