mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-12-04 08:48:45 +00:00
style(cli-meta): satisfy ruff in complexity model/render
Two pre-existing ruff findings in the complexity reporter (from an earlier refactor) blocked `make autoformat` / `make test`: model.py used a bare hashlib.sha1 for a non-security cache key (S324) and render.py built a list with a for-append loop (PERF401). Pass usedforsecurity=False and switch to list.extend. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
8ea4a81ae1
commit
72aa792db3
2 files changed
+4
-3
No files matched your search
@@ -45,7 +45,9 @@ class ComplexityRow(NamedTuple):
|
||||
|
||||
def _base_hash(name: str, services: list[str]) -> str:
|
||||
members = sorted({name, *services})
|
||||
return hashlib.sha1("\n".join(members).encode("utf-8")).hexdigest()
|
||||
return hashlib.sha1(
|
||||
"\n".join(members).encode("utf-8"), usedforsecurity=False
|
||||
).hexdigest()
|
||||
|
||||
|
||||
def _attach_siblings(rows: list[ComplexityRow]) -> list[ComplexityRow]:
|
||||
|
||||
@@ -38,8 +38,7 @@ def render_table(rows: list[ComplexityRow]) -> str:
|
||||
_line([title for title, _, _ in cols]),
|
||||
" ".join("-" * w for w in widths),
|
||||
]
|
||||
for i in range(len(rows)):
|
||||
lines.append(_line([cells[i] for _, _, cells in cols]))
|
||||
lines.extend(_line([cells[i] for _, _, cells in cols]) for i in range(len(rows)))
|
||||
return "\n".join(lines)
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user