treefmt-check
default.checks.x86_64-linux.treefmt
· build #37
· raw
1treefmt v2.5.0ERRO formatter | ruff-check: failed to apply with options '[check --fix]': exit status 123CPY001 Missing copyright notice at top of file4--> biorefs-cli/biorefs_cli/__init__.py:1:156CPY001 Missing copyright notice at top of file7--> biorefs-cli/biorefs_cli/commands/__init__.py:1:189CPY001 Missing copyright notice at top of file10--> biorefs-cli/biorefs_cli/commands/assay.py:1:11112CPY001 Missing copyright notice at top of file13--> biorefs-cli/biorefs_cli/commands/compound.py:1:11415CPY001 Missing copyright notice at top of file16--> biorefs-cli/biorefs_cli/commands/gene.py:1:11718CPY001 Missing copyright notice at top of file19--> biorefs-cli/biorefs_cli/commands/ncbi.py:1:12021CPY001 Missing copyright notice at top of file22--> biorefs-cli/biorefs_cli/commands/nucleotide.py:1:12324CPY001 Missing copyright notice at top of file25--> biorefs-cli/biorefs_cli/commands/openalex.py:1:12627CPY001 Missing copyright notice at top of file28--> biorefs-cli/biorefs_cli/commands/paper.py:1:12930CPY001 Missing copyright notice at top of file31--> biorefs-cli/biorefs_cli/commands/protein.py:1:13233CPY001 Missing copyright notice at top of file34--> biorefs-cli/biorefs_cli/commands/setup.py:1:13536CPY001 Missing copyright notice at top of file37--> biorefs-cli/biorefs_cli/commands/structure.py:1:13839CPY001 Missing copyright notice at top of file40--> biorefs-cli/biorefs_cli/commands/uniprot.py:1:14142CPY001 Missing copyright notice at top of file43--> biorefs-cli/biorefs_cli/config.py:1:14445CPY001 Missing copyright notice at top of file46--> biorefs-cli/biorefs_cli/errors.py:1:14748CPY001 Missing copyright notice at top of file49--> biorefs-cli/biorefs_cli/http.py:1:15051CPY001 Missing copyright notice at top of file52--> biorefs-cli/biorefs_cli/identifiers.py:1:15354CPY001 Missing copyright notice at top of file55--> biorefs-cli/biorefs_cli/jsonshape.py:1:15657CPY001 Missing copyright notice at top of file58--> biorefs-cli/biorefs_cli/main.py:1:15960CPY001 Missing copyright notice at top of file61--> biorefs-cli/biorefs_cli/ncbi_client.py:1:16263CPY001 Missing copyright notice at top of file64--> biorefs-cli/biorefs_cli/output.py:1:16566CPY001 Missing copyright notice at top of file67--> biorefs-cli/biorefs_cli/rate_limit.py:1:16869CPY001 Missing copyright notice at top of file70--> biorefs-cli/biorefs_cli/rcsb_graphql.py:1:17172CPY001 Missing copyright notice at top of file73--> biorefs-cli/tests/__init__.py:1:17475CPY001 Missing copyright notice at top of file76--> biorefs-cli/tests/test_api_specs.py:1:17778CPY001 Missing copyright notice at top of file79--> biorefs-cli/tests/test_assay.py:1:18081CPY001 Missing copyright notice at top of file82--> biorefs-cli/tests/test_compound.py:1:18384CPY001 Missing copyright notice at top of file85--> biorefs-cli/tests/test_core_helpers.py:1:18687CPY001 Missing copyright notice at top of file88--> biorefs-cli/tests/test_gene.py:1:18990CPY001 Missing copyright notice at top of file91--> biorefs-cli/tests/test_http_post.py:1:19293CPY001 Missing copyright notice at top of file94--> biorefs-cli/tests/test_ncbi_command.py:1:19596CPY001 Missing copyright notice at top of file97--> biorefs-cli/tests/test_ncbi_extra.py:1:19899CPY001 Missing copyright notice at top of file100--> biorefs-cli/tests/test_nucleotide.py:1:1101102CPY001 Missing copyright notice at top of file103--> biorefs-cli/tests/test_openalex.py:1:1104105CPY001 Missing copyright notice at top of file106--> biorefs-cli/tests/test_paper.py:1:1107108CPY001 Missing copyright notice at top of file109--> biorefs-cli/tests/test_paper_extra.py:1:1110111CPY001 Missing copyright notice at top of file112--> biorefs-cli/tests/test_protein.py:1:1113114CPY001 Missing copyright notice at top of file115--> biorefs-cli/tests/test_rate_limit.py:1:1116117CPY001 Missing copyright notice at top of file118--> biorefs-cli/tests/test_rcsb_graphql.py:1:1119120CPY001 Missing copyright notice at top of file121--> biorefs-cli/tests/test_render_helpers.py:1:1122123CPY001 Missing copyright notice at top of file124--> biorefs-cli/tests/test_scaffold.py:1:1125126CPY001 Missing copyright notice at top of file127--> biorefs-cli/tests/test_setup.py:1:1128129CPY001 Missing copyright notice at top of file130--> biorefs-cli/tests/test_structure_fetch.py:1:1131132CPY001 Missing copyright notice at top of file133--> biorefs-cli/tests/test_structure_info.py:1:1134135CPY001 Missing copyright notice at top of file136--> biorefs-cli/tests/test_structure_render.py:1:1137138CPY001 Missing copyright notice at top of file139--> biorefs-cli/tests/test_structure_search.py:1:1140141CPY001 Missing copyright notice at top of file142--> biorefs-cli/tests/test_uniprot.py:1:1143144EXE001 Shebang is present but file is not executable145 --> drawio-cli/index-builder/update-baseline.py:1:1146 |1471 | #!/usr/bin/env python3148 | ^^^^^^^^^^^^^^^^^^^^^^1492 | from __future__ import annotations150 |151152TRY004 Prefer `TypeError` exception for invalid type153 --> drawio-cli/index-builder/update-baseline.py:20:9154 |15518 | value = data.get(key)15619 | if not isinstance(value, dict):15720 | raise ValueError(f"manifest {key!r} must be an object")158 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^15921 | return value160 |161162TRY004 Prefer `TypeError` exception for invalid type163 --> drawio-cli/index-builder/update-baseline.py:27:9164 |16525 | value = data.get(key)16626 | if not isinstance(value, int) or isinstance(value, bool):16727 | raise ValueError(f"manifest {key!r} must be an integer")168 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^16928 | if positive and value <= 0:17029 | raise ValueError(f"manifest {key!r} must be positive")171 |172173TRY004 Prefer `TypeError` exception for invalid type174 --> drawio-cli/index-builder/update-baseline.py:88:9175 |17686 | value = json.loads(path.read_text(encoding="utf-8"))17787 | if not isinstance(value, dict):17888 | raise ValueError(f"{path} must contain a JSON object")179 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^18089 | return value181 |182183TRY004 Prefer `TypeError` exception for invalid type184 --> drawio-cli/src/drawio_cli/layout.py:83:9185 |18681 | data = json.load(handle)18782 | if not isinstance(data, dict):18883 | raise ValueError("graph JSON must be an object")189 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^19084 | graph_direction = direction or str(data.get("direction", "TB"))19185 | if graph_direction not in {"TB", "LR"}:192 |193194TRY004 Prefer `TypeError` exception for invalid type195 --> drawio-cli/src/drawio_cli/layout.py:91:9196 |19789 | edges_raw = data.get("edges", [])19890 | if not isinstance(nodes_raw, list) or not isinstance(edges_raw, list):19991 | raise ValueError("nodes and edges must be lists")200 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^20192 |20293 | nodes: list[Node] = []203 |204205TRY004 Prefer `TypeError` exception for invalid type206 --> drawio-cli/src/drawio_cli/layout.py:97:13207 |20895 | for raw in nodes_raw:20996 | if not isinstance(raw, dict):21097 | raise ValueError("node must be an object")211 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^21298 | node_id = str(raw.get("id", ""))21399 | if not node_id or node_id in {"0", "1"}:214 |215216TRY004 Prefer `TypeError` exception for invalid type217 --> drawio-cli/src/drawio_cli/layout.py:129:13218 |219127 | for index, raw in enumerate(edges_raw):220128 | if not isinstance(raw, dict):221129 | raise ValueError("edge must be an object")222 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^223130 | source = str(raw.get("source", ""))224131 | target = str(raw.get("target", ""))225 |226227UP022 Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE`228 --> drawio-cli/src/drawio_cli/layout.py:243:18229 |230241 | dot_path = Path(tmp) / "graph.dot"231242 | dot_path.write_text(source, encoding="utf-8")232243 | result = subprocess.run(233 | __________________^234244 | | [dot, "-Tplain", str(dot_path)],235245 | | check=False,236246 | | text=True,237247 | | stdout=subprocess.PIPE,238248 | | stderr=subprocess.PIPE,239249 | | )240 | |_________^241250 | if result.returncode != 0:242251 | raise RuntimeError(f"dot failed: {result.stderr.strip()}")243 |244help: Replace with `capture_output` keyword argument245246UP022 Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE`247 --> drawio-cli/src/drawio_cli/render.py:63:18248 |24961 | transparent=transparent,25062 | )25163 | result = subprocess.run(252 | __________________^25364 | | cmd,25465 | | check=False,25566 | | text=True,25667 | | stdout=subprocess.PIPE,25768 | | stderr=subprocess.PIPE,25869 | | env=_render_env(Path(tmp)),25970 | | )260 | |_________^26171 | if result.returncode != 0:26272 | raise RuntimeError(263 |264help: Replace with `capture_output` keyword argument265266TRY004 Prefer `TypeError` exception for invalid type267 --> drawio-cli/src/drawio_cli/shapes.py:113:9268 |269111 | rows = raw.get("entries", raw) if isinstance(raw, dict) else raw270112 | if not isinstance(rows, list):271113 | raise ValueError("shape index must contain list or entries list")272 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^273114 | entries: list[ShapeEntry] = []274115 | for index, row in enumerate(rows):275 |276277TRY004 Prefer `TypeError` exception for invalid type278 --> drawio-cli/src/drawio_cli/shapes.py:117:13279 |280115 | for index, row in enumerate(rows):281116 | if not isinstance(row, dict):282117 | raise ValueError(f"shape index entry {index} must be an object")283 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^284118 | entries.append(ShapeEntry.from_json(row))285119 | return ShapeIndex(tuple(entries))286 |287288RUF007 Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs289 --> drawio-cli/src/drawio_cli/validate.py:167:23290 |291165 | corners = [(x, y), (x + width, y), (x + width, y + height), (x, y + height)]292166 | borders = list(zip(corners, [*corners[1:], corners[0]]))293167 | for start, end in zip(points, points[1:]):294 | ^^^295168 | if _point_in_rect(start, box) or _point_in_rect(end, box):296169 | return True297 |298help: Replace `zip()` with `itertools.pairwise()`299300RUF007 Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs301 --> drawio-cli/src/drawio_cli/validate.py:181:31302 |303179 | return any(304180 | _segments_cross(a_start, a_end, b_start, b_end)305181 | for a_start, a_end in zip(a, a[1:])306 | ^^^307182 | for b_start, b_end in zip(b, b[1:])308183 | )309 |310help: Replace `zip()` with `itertools.pairwise()`311312RUF007 Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs313 --> drawio-cli/src/drawio_cli/validate.py:182:31314 |315180 | _segments_cross(a_start, a_end, b_start, b_end)316181 | for a_start, a_end in zip(a, a[1:])317182 | for b_start, b_end in zip(b, b[1:])318 | ^^^319183 | )320 |321help: Replace `zip()` with `itertools.pairwise()`322323CPY001 Missing copyright notice at top of file324--> gmaps-cli/gmaps_cli.py:1:1325326CPY001 Missing copyright notice at top of file327--> gmaps-cli/test_gmaps_cli_integration.py:1:1328329CPY001 Missing copyright notice at top of file330--> kmap-cli/kmap_cli.py:1:1331332CPY001 Missing copyright notice at top of file333--> kmap-cli/tests/test_kmap_cli.py:1:1334335RUF012 Mutable default value for class attribute336 --> linkwarden-cli/tests/test_cli.py:18:38337 |33817 | class State:33918 | requests: list[dict[str, Any]] = []340 | ^^341help: Consider initializing in `__init__` or annotating with `typing.ClassVar`342343CPY001 Missing copyright notice at top of file344--> nmap-cli/nmap_cli.py:1:1345346CPY001 Missing copyright notice at top of file347--> nmap-cli/tests/__init__.py:1:1348349CPY001 Missing copyright notice at top of file350--> nmap-cli/tests/test_nmap_cli.py:1:1351352CPY001 Missing copyright notice at top of file353--> paperfetch-cli/paperfetch_cli/__init__.py:1:1354355CPY001 Missing copyright notice at top of file356--> paperfetch-cli/paperfetch_cli/browser.py:1:1357358CPY001 Missing copyright notice at top of file359--> paperfetch-cli/paperfetch_cli/config.py:1:1360361CPY001 Missing copyright notice at top of file362--> paperfetch-cli/paperfetch_cli/errors.py:1:1363364CPY001 Missing copyright notice at top of file365--> paperfetch-cli/paperfetch_cli/main.py:1:1366367PLR0917 Too many positional arguments (7 > 5)368 --> paperfetch-cli/paperfetch_cli/main.py:285:5369 |370285 | def _browser_pdf( # noqa: PLR0913371 | ^^^^^^^^^^^^372286 | args: argparse.Namespace,373287 | meta: PaperMeta,374 |375376CPY001 Missing copyright notice at top of file377--> paperfetch-cli/paperfetch_cli/resolve.py:1:1378379CPY001 Missing copyright notice at top of file380--> paperfetch-cli/paperfetch_cli/sanitize.py:1:1381382CPY001 Missing copyright notice at top of file383--> paperfetch-cli/tests/__init__.py:1:1384385CPY001 Missing copyright notice at top of file386--> paperfetch-cli/tests/test_browser.py:1:1387388CPY001 Missing copyright notice at top of file389--> paperfetch-cli/tests/test_cli.py:1:1390391CPY001 Missing copyright notice at top of file392--> paperfetch-cli/tests/test_live_e2e.py:1:1393394CPY001 Missing copyright notice at top of file395--> paperfetch-cli/tests/test_resolve.py:1:1396397UP022 Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE`398 --> pymol-cli/pymol_cli/main.py:496:20399 |400494 | return401495 | if not ns.foreground:402496 | run_proc = subprocess.run(403 | ____________________^404497 | | ["pueue", "add", "--print-task-id", "--", *command],405498 | | check=False,406499 | | text=True,407500 | | stdout=subprocess.PIPE,408501 | | stderr=subprocess.PIPE,409502 | | )410 | |_________^411503 | if run_proc.returncode != 0:412504 | raise CLIError(run_proc.stderr.strip() or "pueue launch failed")413 |414help: Replace with `capture_output` keyword argument415416CPY001 Missing copyright notice at top of file417--> shortcuts-cli/shortcuts_cli.py:1:1418419CPY001 Missing copyright notice at top of file420--> shortcuts-cli/tests/test_shortcuts_cli.py:1:1421422RUF012 Mutable default value for class attribute423 --> vikunja-cli/tests/test_client.py:18:26424 |42516 | class Handler(BaseHTTPRequestHandler):42617 | response_status = 20042718 | response_body: Any = {"ok": True}428 | ^^^^^^^^^^^^42919 | response_content_type = "application/json"43020 | seen: dict[str, Any] = {}431 |432help: Consider initializing in `__init__` or annotating with `typing.ClassVar`433434RUF012 Mutable default value for class attribute435 --> vikunja-cli/tests/test_client.py:20:28436 |43718 | response_body: Any = {"ok": True}43819 | response_content_type = "application/json"43920 | seen: dict[str, Any] = {}440 | ^^44121 |44222 | def do_GET(self) -> None:443 |444help: Consider initializing in `__init__` or annotating with `typing.ClassVar`445446CPY001 Missing copyright notice at top of file447--> weather-cli/tests/__init__.py:1:1448449CPY001 Missing copyright notice at top of file450--> weather-cli/tests/test_weather_cli.py:1:1451452CPY001 Missing copyright notice at top of file453--> weather-cli/weather_cli/__init__.py:1:1454455CPY001 Missing copyright notice at top of file456--> weather-cli/weather_cli/main.py:1:1457458RUF012 Mutable default value for class attribute459 --> zhost-cli/tests/test_cli.py:19:46460 |46117 | class State:46218 | version = 1046319 | collections: dict[str, dict[str, Any]] = {}464 | ^^46520 | items: dict[str, dict[str, Any]] = {}46621 | settings: dict[str, dict[str, Any]] = {}467 |468help: Consider initializing in `__init__` or annotating with `typing.ClassVar`469470RUF012 Mutable default value for class attribute471 --> zhost-cli/tests/test_cli.py:20:40472 |47318 | version = 1047419 | collections: dict[str, dict[str, Any]] = {}47520 | items: dict[str, dict[str, Any]] = {}476 | ^^47721 | settings: dict[str, dict[str, Any]] = {}47822 | fulltext: dict[str, dict[str, Any]] = {}479 |480help: Consider initializing in `__init__` or annotating with `typing.ClassVar`481482RUF012 Mutable default value for class attribute483 --> zhost-cli/tests/test_cli.py:21:43484 |48519 | collections: dict[str, dict[str, Any]] = {}48620 | items: dict[str, dict[str, Any]] = {}48721 | settings: dict[str, dict[str, Any]] = {}488 | ^^48922 | fulltext: dict[str, dict[str, Any]] = {}49023 | requests: list[dict[str, Any]] = []491 |492help: Consider initializing in `__init__` or annotating with `typing.ClassVar`493494RUF012 Mutable default value for class attribute495 --> zhost-cli/tests/test_cli.py:22:43496 |49720 | items: dict[str, dict[str, Any]] = {}49821 | settings: dict[str, dict[str, Any]] = {}49922 | fulltext: dict[str, dict[str, Any]] = {}500 | ^^50123 | requests: list[dict[str, Any]] = []50224 | counter = 0503 |504help: Consider initializing in `__init__` or annotating with `typing.ClassVar`505506RUF012 Mutable default value for class attribute507 --> zhost-cli/tests/test_cli.py:23:38508 |50921 | settings: dict[str, dict[str, Any]] = {}51022 | fulltext: dict[str, dict[str, Any]] = {}51123 | requests: list[dict[str, Any]] = []512 | ^^51324 | counter = 0514 |515help: Consider initializing in `__init__` or annotating with `typing.ClassVar`516517RUF015 Prefer `next(...)` over single element slice518 --> zhost-cli/tests/test_cli.py:325:9519 |520323 | main(["-j", "item", "find", "x"])521324 | assert {i["key"] for i in json.loads(capsys.readouterr().out)} == {"PAPER222"}522325 | q = [r for r in _reqs("GET", "/users/1/items") if "q" in r["query"]][0]523 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^524326 | assert q["query"]["qmode"] == ["everything"]525 |526help: Replace with `next(...)`527528RUF015 Prefer `next(...)` over single element slice529 --> zhost-cli/tests/test_cli.py:412:12530 |531410 | State.items["PAPER222"] = {"key": "PAPER222", "itemType": "journalArticle"}532411 | main(["note", "add", "PAPER222", "--text", "<p>hi</p>"])533412 | note = [534 | ____________^535413 | | r for r in _reqs("POST", "/users/1/items") if r["body"][0]["itemType"] == "note"536414 | | ][0]537 | |________^538415 | assert note["body"][0]["parentItem"] == "PAPER222"539416 | main(["note", "list", "PAPER222"])540 |541help: Replace with `next(...)`542543SIM115 Use a context manager for opening files544 --> zhost-cli/tests/test_cli.py:424:5545 |546422 | ) -> None:547423 | pdf = f"{tmp_path}/p.pdf"548424 | open(pdf, "wb").write(b"%PDF-1.7 data")549 | ^^^^550425 | State.items["PAPER222"] = {"key": "PAPER222", "itemType": "journalArticle"}551426 | main(["pdf", "attach", "PAPER222", "--pdf", pdf])552 |553554RUF015 Prefer `next(...)` over single element slice555 --> zhost-cli/tests/test_cli.py:429:11556 |557427 | assert any(r["path"].startswith("/uploads/") for r in State.requests)558428 | # the attachment was created under the paper559429 | att = [560 | ___________^561430 | | r562431 | | for r in _reqs("POST", "/users/1/items")563432 | | if r["body"][0]["itemType"] == "attachment"564433 | | ][0]565 | |________^566434 | assert att["body"][0]["parentItem"] == "PAPER222"567435 | out_path = f"{tmp_path}/dl.pdf"568 |569help: Replace with `next(...)`570571SIM115 Use a context manager for opening files572 --> zhost-cli/tests/test_cli.py:437:12573 |574435 | out_path = f"{tmp_path}/dl.pdf"575436 | main(["pdf", "fetch", "PAPER222", "--output", out_path])576437 | assert open(out_path, "rb").read().startswith(b"%PDF")577 | ^^^^578579RUF015 Prefer `next(...)` over single element slice580 --> zhost-cli/tests/test_cli.py:458:11581 |582456 | }583457 | main(["highlight", "add", "PAPER222", "--pdf", pdf, "--text", "highlight this"])584458 | ann = [585 | ___________^586459 | | r587460 | | for r in _reqs("POST", "/users/1/items")588461 | | if r["body"][0]["itemType"] == "annotation"589462 | | ][0]590 | |________^591463 | assert ann["body"][0]["parentItem"] == "ATTAC222"592464 | assert ann["body"][0]["annotationText"] == "highlight this"593 |594help: Replace with `next(...)`595596SIM115 Use a context manager for opening files597 --> zhost-cli/tests/test_cli.py:503:5598 |599501 | ) -> None:600502 | pdf = f"{tmp_path}/p.pdf"601503 | open(pdf, "wb").write(b"%PDF-1.7 data")602 | ^^^^603504 | main(["-j", "item", "add", "--title", "P", "--pdf", pdf])604505 | out = json.loads(capsys.readouterr().out)605 |606607SIM115 Use a context manager for opening files608 --> zhost-cli/tests/test_cli.py:546:5609 |610544 | ) -> None:611545 | pdf = f"{tmp_path}/p.pdf"612546 | open(pdf, "wb").write(b"%PDF-1.7 new")613 | ^^^^614547 | State.items["PAPER222"] = {"key": "PAPER222", "itemType": "journalArticle"}615548 | State.items["ATTAC222"] = {616 |617618SIM115 Use a context manager for opening files619 --> zhost-cli/tests/test_cli.py:656:27620 |621654 | main(["library", "export", out])622655 |623656 | manifest = json.loads(open(f"{out}/manifest.json").read())624 | ^^^^625657 | assert manifest["counts"]["items"] == 1 # one top-level paper626 |627628SIM115 Use a context manager for opening files629 --> zhost-cli/tests/test_cli.py:659:22630 |631657 | assert manifest["counts"]["items"] == 1 # one top-level paper632658 |633659 | rec = json.loads(open(f"{out}/items/PAPER222.json").read())634 | ^^^^635660 | assert rec["item"]["data"]["title"] == "P"636661 | assert {c["key"] for c in rec["children"]} == {"ATTAC222", "NOTE2222"}637 |638639SIM115 Use a context manager for opening files640 --> zhost-cli/tests/test_cli.py:664:12641 |642662 | assert rec["fulltext"]["ATTAC222"]["content"] == "full body"643663 |644664 | assert open(f"{out}/files/ATTAC222/p.pdf", "rb").read().startswith(b"%PDF")645 | ^^^^646665 | colls = json.loads(open(f"{out}/collections.json").read())647666 | assert any(c["key"] == "FOLDER22" for c in colls)648 |649650SIM115 Use a context manager for opening files651 --> zhost-cli/tests/test_cli.py:665:24652 |653664 | assert open(f"{out}/files/ATTAC222/p.pdf", "rb").read().startswith(b"%PDF")654665 | colls = json.loads(open(f"{out}/collections.json").read())655 | ^^^^656666 | assert any(c["key"] == "FOLDER22" for c in colls)657 |658659SIM115 Use a context manager for opening files660 --> zhost-cli/tests/test_cli.py:717:43661 |662715 | exported_items = {p[:-5] for p in os.listdir(f"{out}/items")}663716 | assert exported_items == {"PAPER222", "SUBPAP22", "CROSS222"}664717 | colls = {c["key"] for c in json.loads(open(f"{out}/collections.json").read())}665 | ^^^^666718 | assert colls == {"ROOT2222", "FOLDER22", "SUBCOL22"}667719 | cross = json.loads(open(f"{out}/items/CROSS222.json").read())668 |669670SIM115 Use a context manager for opening files671 --> zhost-cli/tests/test_cli.py:719:24672 |673717 | colls = {c["key"] for c in json.loads(open(f"{out}/collections.json").read())}674718 | assert colls == {"ROOT2222", "FOLDER22", "SUBCOL22"}675719 | cross = json.loads(open(f"{out}/items/CROSS222.json").read())676 | ^^^^677720 | assert cross["item"]["data"]["collections"] == ["FOLDER22"]678 |679680SIM115 Use a context manager for opening files681 --> zhost-cli/tests/test_cli.py:734:27682 |683732 | main(["library", "export", out])684733 |685734 | settings = json.loads(open(f"{out}/settings.json").read())686 | ^^^^687735 | assert settings["tagColors"]["value"] == [{"name": "read", "color": "#5fb236"}]688 |689690SIM115 Use a context manager for opening files691 --> zhost-cli/zhost_cli/client.py:274:16692 |693272 | ) -> Response:694273 | """Run the full authorize -> upload -> register sequence for `path`."""695274 | data = open(path, "rb").read()696 | ^^^^697275 | md5 = hashlib.md5(data).hexdigest()698276 | stat = os.stat(path)699 |700701Found 134 errors (21 fixed, 113 remaining).702No fixes available (10 hidden fixes can be enabled with the `--unsafe-fixes` option).703704ERRO formatter | ruff-check: failed to apply with options '[check --fix]': exit status 1705706CPY001 Missing copyright notice at top of file707--> context7-cli/context7_cli.py:1:1708709Found 1 error.710711ERRO formatter | ruff-check: failed to apply with options '[check --fix]': exit status 1712713CPY001 Missing copyright notice at top of file714--> crwl-cli/crawl.py:1:1715716Found 1 error.717718ERRO formatter | ruff-check: failed to apply with options '[check --fix]': exit status 1719720CPY001 Missing copyright notice at top of file721--> crabfit-cli/crabfit_cli.py:1:1722723CPY001 Missing copyright notice at top of file724--> crabfit-cli/tests/__init__.py:1:1725726CPY001 Missing copyright notice at top of file727--> crabfit-cli/tests/test_crabfit_cli.py:1:1728729Found 3 errors.730731ERRO formatter | ruff-check: failed to apply with options '[check --fix]': exit status 1732733CPY001 Missing copyright notice at top of file734--> pexpect-cli/pexpect_cli/__init__.py:1:1735736CPY001 Missing copyright notice at top of file737--> pexpect-cli/pexpect_cli/client.py:1:1738739CPY001 Missing copyright notice at top of file740--> pexpect-cli/pexpect_cli/server.py:1:1741742CPY001 Missing copyright notice at top of file743--> pexpect-cli/tests/__init__.py:1:1744745CPY001 Missing copyright notice at top of file746--> pexpect-cli/tests/test_integration.py:1:1747748Found 5 errors.749750ERRO formatter | ruff-check: failed to apply with options '[check --fix]': exit status 1751752SIM102 Use a single `if` statement instead of nested `if` statements753 --> n8n-cli/n8n_cli/commands/apply.py:66:13754 |75565 | # Filter by IDs if specified75666 | / if ids:75767 | | if not wf_id or wf_id not in ids:758 | |_________________________________________________^75968 | continue760 |761help: Combine `if` statements using `and`762763SIM103 Return the condition `local.get("active") != remote.get("active")` directly764 --> n8n-cli/n8n_cli/commands/apply.py:185:5765 |766183 | return True767184 | # Compare active state768185 | / if local.get("active") != remote.get("active"):769186 | | return True770187 | | return False771 | |________________^772help: Replace with `return local.get("active") != remote.get("active")`773774SIM102 Use a single `if` statement instead of nested `if` statements775 --> n8n-cli/n8n_cli/commands/apply.py:272:9776 |777270 | local_updated = data.get("updatedAt")778271 | remote_updated = remote.get("updatedAt")779272 | / if local_updated and remote_updated and remote_updated > local_updated:780273 | | if not ns.force:781 | |____________________________^782274 | print(783275 | f" conflict: {basename} (remote is newer: {remote_updated} > {local_updated})"784 |785help: Combine `if` statements using `and`786787SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements788 --> n8n-cli/tests/conftest.py:333:5789 |790331 | "N8N_API_KEY": "test-key-1234",791332 | }792333 | / with patch.dict("os.environ", env, clear=False):793334 | | with patch("sys.argv", ["n8n-cli", *argv]):794 | |___________________________________________________^795335 | try:796336 | main()797 |798help: Combine `with` statements799800SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements801 --> n8n-cli/tests/conftest.py:354:5802 |803352 | "N8N_API_KEY": "test-key-1234",804353 | }805354 | / with patch.dict("os.environ", env, clear=False):806355 | | with patch("sys.argv", ["n8n-cli", *argv]):807 | |___________________________________________________^808356 | with pytest.raises(SystemExit) as exc_info:809357 | main()810 |811help: Combine `with` statements812813SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements814 --> n8n-cli/tests/test_errors.py:14:9815 |81612 | """Missing API URL/key produces a ConfigError, not a traceback."""81713 | env = {"N8N_API_URL": "", "N8N_API_KEY": ""}81814 | / with patch.dict("os.environ", env, clear=False):81915 | | with patch("sys.argv", ["n8n-cli", "credential", "list"]):820 | |______________________________________________________________________^82116 | with pytest.raises(SystemExit) as exc_info:82217 | main()823 |824help: Combine `with` statements825826SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements827 --> n8n-cli/tests/test_errors.py:24:9828 |82922 | def test_unknown_command(self, capsys: pytest.CaptureFixture[str]) -> None:83023 | """Unknown top-level command exits with code 2 (argparse error)."""83124 | / with patch.dict("os.environ", {"N8N_API_URL": "x", "N8N_API_KEY": "x"}):83225 | | with patch("sys.argv", ["n8n-cli", "bogus"]):833 | |_________________________________________________________^83426 | with pytest.raises(SystemExit) as exc_info:83527 | main()836 |837help: Combine `with` statements838839Found 18 errors (11 fixed, 7 remaining).840No fixes available (2 hidden fixes can be enabled with the `--unsafe-fixes` option).841842ERRO formatter | ruff-check: failed to apply with options '[check --fix]': exit status 1843844CPY001 Missing copyright notice at top of file845--> calendar-cli/calendar_cli/__init__.py:1:1846847CPY001 Missing copyright notice at top of file848--> calendar-cli/calendar_cli/cache.py:1:1849850CPY001 Missing copyright notice at top of file851--> calendar-cli/calendar_cli/config.py:1:1852853CPY001 Missing copyright notice at top of file854--> calendar-cli/calendar_cli/create.py:1:1855856CPY001 Missing copyright notice at top of file857--> calendar-cli/calendar_cli/email_invite.py:1:1858859CPY001 Missing copyright notice at top of file860--> calendar-cli/calendar_cli/errors.py:1:1861862CPY001 Missing copyright notice at top of file863--> calendar-cli/calendar_cli/import_invite.py:1:1864865CPY001 Missing copyright notice at top of file866--> calendar-cli/calendar_cli/main.py:1:1867868CPY001 Missing copyright notice at top of file869--> calendar-cli/calendar_cli/models.py:1:1870871CPY001 Missing copyright notice at top of file872--> calendar-cli/calendar_cli/parse.py:1:1873874CPY001 Missing copyright notice at top of file875--> calendar-cli/calendar_cli/reply.py:1:1876877CPY001 Missing copyright notice at top of file878--> calendar-cli/calendar_cli/store.py:1:1879880CPY001 Missing copyright notice at top of file881--> calendar-cli/calendar_cli/timeutil.py:1:1882883CPY001 Missing copyright notice at top of file884--> calendar-cli/calendar_cli/util.py:1:1885886CPY001 Missing copyright notice at top of file887--> calendar-cli/tests/__init__.py:1:1888889CPY001 Missing copyright notice at top of file890--> calendar-cli/tests/conftest.py:1:1891892CPY001 Missing copyright notice at top of file893--> calendar-cli/tests/helpers.py:1:1894895CPY001 Missing copyright notice at top of file896--> calendar-cli/tests/test_cache.py:1:1897898CPY001 Missing copyright notice at top of file899--> calendar-cli/tests/test_cli.py:1:1900901CPY001 Missing copyright notice at top of file902--> calendar-cli/tests/test_import.py:1:1903904CPY001 Missing copyright notice at top of file905--> calendar-cli/tests/test_invite.py:1:1906907CPY001 Missing copyright notice at top of file908--> calendar-cli/tests/test_reply.py:1:1909910CPY001 Missing copyright notice at top of file911--> calendar-cli/tests/test_store.py:1:1912913Found 23 errors.914915traversed 363 files916emitted 319 files for processing917formatted 128 files (25 changed) in 3.238s918Error: failed to finalise formatting: formatting failures detected