treefmt v2.5.0ERRO formatter | ruff-check: failed to apply with options '[check --fix]': exit status 1 CPY001 Missing copyright notice at top of file --> biorefs-cli/biorefs_cli/__init__.py:1:1 CPY001 Missing copyright notice at top of file --> biorefs-cli/biorefs_cli/commands/__init__.py:1:1 CPY001 Missing copyright notice at top of file --> biorefs-cli/biorefs_cli/commands/assay.py:1:1 CPY001 Missing copyright notice at top of file --> biorefs-cli/biorefs_cli/commands/compound.py:1:1 CPY001 Missing copyright notice at top of file --> biorefs-cli/biorefs_cli/commands/gene.py:1:1 CPY001 Missing copyright notice at top of file --> biorefs-cli/biorefs_cli/commands/ncbi.py:1:1 CPY001 Missing copyright notice at top of file --> biorefs-cli/biorefs_cli/commands/nucleotide.py:1:1 CPY001 Missing copyright notice at top of file --> biorefs-cli/biorefs_cli/commands/openalex.py:1:1 CPY001 Missing copyright notice at top of file --> biorefs-cli/biorefs_cli/commands/paper.py:1:1 CPY001 Missing copyright notice at top of file --> biorefs-cli/biorefs_cli/commands/protein.py:1:1 CPY001 Missing copyright notice at top of file --> biorefs-cli/biorefs_cli/commands/setup.py:1:1 CPY001 Missing copyright notice at top of file --> biorefs-cli/biorefs_cli/commands/structure.py:1:1 CPY001 Missing copyright notice at top of file --> biorefs-cli/biorefs_cli/commands/uniprot.py:1:1 CPY001 Missing copyright notice at top of file --> biorefs-cli/biorefs_cli/config.py:1:1 CPY001 Missing copyright notice at top of file --> biorefs-cli/biorefs_cli/errors.py:1:1 CPY001 Missing copyright notice at top of file --> biorefs-cli/biorefs_cli/http.py:1:1 CPY001 Missing copyright notice at top of file --> biorefs-cli/biorefs_cli/identifiers.py:1:1 CPY001 Missing copyright notice at top of file --> biorefs-cli/biorefs_cli/jsonshape.py:1:1 CPY001 Missing copyright notice at top of file --> biorefs-cli/biorefs_cli/main.py:1:1 CPY001 Missing copyright notice at top of file --> biorefs-cli/biorefs_cli/ncbi_client.py:1:1 CPY001 Missing copyright notice at top of file --> biorefs-cli/biorefs_cli/output.py:1:1 CPY001 Missing copyright notice at top of file --> biorefs-cli/biorefs_cli/rate_limit.py:1:1 CPY001 Missing copyright notice at top of file --> biorefs-cli/biorefs_cli/rcsb_graphql.py:1:1 CPY001 Missing copyright notice at top of file --> biorefs-cli/tests/__init__.py:1:1 CPY001 Missing copyright notice at top of file --> biorefs-cli/tests/test_api_specs.py:1:1 CPY001 Missing copyright notice at top of file --> biorefs-cli/tests/test_assay.py:1:1 CPY001 Missing copyright notice at top of file --> biorefs-cli/tests/test_compound.py:1:1 CPY001 Missing copyright notice at top of file --> biorefs-cli/tests/test_core_helpers.py:1:1 CPY001 Missing copyright notice at top of file --> biorefs-cli/tests/test_gene.py:1:1 CPY001 Missing copyright notice at top of file --> biorefs-cli/tests/test_http_post.py:1:1 CPY001 Missing copyright notice at top of file --> biorefs-cli/tests/test_ncbi_command.py:1:1 CPY001 Missing copyright notice at top of file --> biorefs-cli/tests/test_ncbi_extra.py:1:1 CPY001 Missing copyright notice at top of file --> biorefs-cli/tests/test_nucleotide.py:1:1 CPY001 Missing copyright notice at top of file --> biorefs-cli/tests/test_openalex.py:1:1 CPY001 Missing copyright notice at top of file --> biorefs-cli/tests/test_paper.py:1:1 CPY001 Missing copyright notice at top of file --> biorefs-cli/tests/test_paper_extra.py:1:1 CPY001 Missing copyright notice at top of file --> biorefs-cli/tests/test_protein.py:1:1 CPY001 Missing copyright notice at top of file --> biorefs-cli/tests/test_rate_limit.py:1:1 CPY001 Missing copyright notice at top of file --> biorefs-cli/tests/test_rcsb_graphql.py:1:1 CPY001 Missing copyright notice at top of file --> biorefs-cli/tests/test_render_helpers.py:1:1 CPY001 Missing copyright notice at top of file --> biorefs-cli/tests/test_scaffold.py:1:1 CPY001 Missing copyright notice at top of file --> biorefs-cli/tests/test_setup.py:1:1 CPY001 Missing copyright notice at top of file --> biorefs-cli/tests/test_structure_fetch.py:1:1 CPY001 Missing copyright notice at top of file --> biorefs-cli/tests/test_structure_info.py:1:1 CPY001 Missing copyright notice at top of file --> biorefs-cli/tests/test_structure_render.py:1:1 CPY001 Missing copyright notice at top of file --> biorefs-cli/tests/test_structure_search.py:1:1 CPY001 Missing copyright notice at top of file --> biorefs-cli/tests/test_uniprot.py:1:1 EXE001 Shebang is present but file is not executable --> drawio-cli/index-builder/update-baseline.py:1:1 | 1 | #!/usr/bin/env python3 | ^^^^^^^^^^^^^^^^^^^^^^ 2 | from __future__ import annotations | TRY004 Prefer `TypeError` exception for invalid type --> drawio-cli/index-builder/update-baseline.py:20:9 | 18 | value = data.get(key) 19 | if not isinstance(value, dict): 20 | raise ValueError(f"manifest {key!r} must be an object") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 21 | return value | TRY004 Prefer `TypeError` exception for invalid type --> drawio-cli/index-builder/update-baseline.py:27:9 | 25 | value = data.get(key) 26 | if not isinstance(value, int) or isinstance(value, bool): 27 | raise ValueError(f"manifest {key!r} must be an integer") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 28 | if positive and value <= 0: 29 | raise ValueError(f"manifest {key!r} must be positive") | TRY004 Prefer `TypeError` exception for invalid type --> drawio-cli/index-builder/update-baseline.py:88:9 | 86 | value = json.loads(path.read_text(encoding="utf-8")) 87 | if not isinstance(value, dict): 88 | raise ValueError(f"{path} must contain a JSON object") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 89 | return value | TRY004 Prefer `TypeError` exception for invalid type --> drawio-cli/src/drawio_cli/layout.py:83:9 | 81 | data = json.load(handle) 82 | if not isinstance(data, dict): 83 | raise ValueError("graph JSON must be an object") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 84 | graph_direction = direction or str(data.get("direction", "TB")) 85 | if graph_direction not in {"TB", "LR"}: | TRY004 Prefer `TypeError` exception for invalid type --> drawio-cli/src/drawio_cli/layout.py:91:9 | 89 | edges_raw = data.get("edges", []) 90 | if not isinstance(nodes_raw, list) or not isinstance(edges_raw, list): 91 | raise ValueError("nodes and edges must be lists") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 92 | 93 | nodes: list[Node] = [] | TRY004 Prefer `TypeError` exception for invalid type --> drawio-cli/src/drawio_cli/layout.py:97:13 | 95 | for raw in nodes_raw: 96 | if not isinstance(raw, dict): 97 | raise ValueError("node must be an object") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 98 | node_id = str(raw.get("id", "")) 99 | if not node_id or node_id in {"0", "1"}: | TRY004 Prefer `TypeError` exception for invalid type --> drawio-cli/src/drawio_cli/layout.py:129:13 | 127 | for index, raw in enumerate(edges_raw): 128 | if not isinstance(raw, dict): 129 | raise ValueError("edge must be an object") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 130 | source = str(raw.get("source", "")) 131 | target = str(raw.get("target", "")) | UP022 Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` --> drawio-cli/src/drawio_cli/layout.py:243:18 | 241 | dot_path = Path(tmp) / "graph.dot" 242 | dot_path.write_text(source, encoding="utf-8") 243 | result = subprocess.run( | __________________^ 244 | | [dot, "-Tplain", str(dot_path)], 245 | | check=False, 246 | | text=True, 247 | | stdout=subprocess.PIPE, 248 | | stderr=subprocess.PIPE, 249 | | ) | |_________^ 250 | if result.returncode != 0: 251 | raise RuntimeError(f"dot failed: {result.stderr.strip()}") | help: Replace with `capture_output` keyword argument UP022 Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` --> drawio-cli/src/drawio_cli/render.py:63:18 | 61 | transparent=transparent, 62 | ) 63 | result = subprocess.run( | __________________^ 64 | | cmd, 65 | | check=False, 66 | | text=True, 67 | | stdout=subprocess.PIPE, 68 | | stderr=subprocess.PIPE, 69 | | env=_render_env(Path(tmp)), 70 | | ) | |_________^ 71 | if result.returncode != 0: 72 | raise RuntimeError( | help: Replace with `capture_output` keyword argument TRY004 Prefer `TypeError` exception for invalid type --> drawio-cli/src/drawio_cli/shapes.py:113:9 | 111 | rows = raw.get("entries", raw) if isinstance(raw, dict) else raw 112 | if not isinstance(rows, list): 113 | raise ValueError("shape index must contain list or entries list") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 114 | entries: list[ShapeEntry] = [] 115 | for index, row in enumerate(rows): | TRY004 Prefer `TypeError` exception for invalid type --> drawio-cli/src/drawio_cli/shapes.py:117:13 | 115 | for index, row in enumerate(rows): 116 | if not isinstance(row, dict): 117 | raise ValueError(f"shape index entry {index} must be an object") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 118 | entries.append(ShapeEntry.from_json(row)) 119 | return ShapeIndex(tuple(entries)) | RUF007 Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs --> drawio-cli/src/drawio_cli/validate.py:167:23 | 165 | corners = [(x, y), (x + width, y), (x + width, y + height), (x, y + height)] 166 | borders = list(zip(corners, [*corners[1:], corners[0]])) 167 | for start, end in zip(points, points[1:]): | ^^^ 168 | if _point_in_rect(start, box) or _point_in_rect(end, box): 169 | return True | help: Replace `zip()` with `itertools.pairwise()` RUF007 Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs --> drawio-cli/src/drawio_cli/validate.py:181:31 | 179 | return any( 180 | _segments_cross(a_start, a_end, b_start, b_end) 181 | for a_start, a_end in zip(a, a[1:]) | ^^^ 182 | for b_start, b_end in zip(b, b[1:]) 183 | ) | help: Replace `zip()` with `itertools.pairwise()` RUF007 Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs --> drawio-cli/src/drawio_cli/validate.py:182:31 | 180 | _segments_cross(a_start, a_end, b_start, b_end) 181 | for a_start, a_end in zip(a, a[1:]) 182 | for b_start, b_end in zip(b, b[1:]) | ^^^ 183 | ) | help: Replace `zip()` with `itertools.pairwise()` CPY001 Missing copyright notice at top of file --> gmaps-cli/gmaps_cli.py:1:1 CPY001 Missing copyright notice at top of file --> gmaps-cli/test_gmaps_cli_integration.py:1:1 CPY001 Missing copyright notice at top of file --> kmap-cli/kmap_cli.py:1:1 CPY001 Missing copyright notice at top of file --> kmap-cli/tests/test_kmap_cli.py:1:1 RUF012 Mutable default value for class attribute --> linkwarden-cli/tests/test_cli.py:18:38 | 17 | class State: 18 | requests: list[dict[str, Any]] = [] | ^^ help: Consider initializing in `__init__` or annotating with `typing.ClassVar` CPY001 Missing copyright notice at top of file --> nmap-cli/nmap_cli.py:1:1 CPY001 Missing copyright notice at top of file --> nmap-cli/tests/__init__.py:1:1 CPY001 Missing copyright notice at top of file --> nmap-cli/tests/test_nmap_cli.py:1:1 CPY001 Missing copyright notice at top of file --> paperfetch-cli/paperfetch_cli/__init__.py:1:1 CPY001 Missing copyright notice at top of file --> paperfetch-cli/paperfetch_cli/browser.py:1:1 CPY001 Missing copyright notice at top of file --> paperfetch-cli/paperfetch_cli/config.py:1:1 CPY001 Missing copyright notice at top of file --> paperfetch-cli/paperfetch_cli/errors.py:1:1 CPY001 Missing copyright notice at top of file --> paperfetch-cli/paperfetch_cli/main.py:1:1 PLR0917 Too many positional arguments (7 > 5) --> paperfetch-cli/paperfetch_cli/main.py:285:5 | 285 | def _browser_pdf( # noqa: PLR0913 | ^^^^^^^^^^^^ 286 | args: argparse.Namespace, 287 | meta: PaperMeta, | CPY001 Missing copyright notice at top of file --> paperfetch-cli/paperfetch_cli/resolve.py:1:1 CPY001 Missing copyright notice at top of file --> paperfetch-cli/paperfetch_cli/sanitize.py:1:1 CPY001 Missing copyright notice at top of file --> paperfetch-cli/tests/__init__.py:1:1 CPY001 Missing copyright notice at top of file --> paperfetch-cli/tests/test_browser.py:1:1 CPY001 Missing copyright notice at top of file --> paperfetch-cli/tests/test_cli.py:1:1 CPY001 Missing copyright notice at top of file --> paperfetch-cli/tests/test_live_e2e.py:1:1 CPY001 Missing copyright notice at top of file --> paperfetch-cli/tests/test_resolve.py:1:1 UP022 Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE` --> pymol-cli/pymol_cli/main.py:496:20 | 494 | return 495 | if not ns.foreground: 496 | run_proc = subprocess.run( | ____________________^ 497 | | ["pueue", "add", "--print-task-id", "--", *command], 498 | | check=False, 499 | | text=True, 500 | | stdout=subprocess.PIPE, 501 | | stderr=subprocess.PIPE, 502 | | ) | |_________^ 503 | if run_proc.returncode != 0: 504 | raise CLIError(run_proc.stderr.strip() or "pueue launch failed") | help: Replace with `capture_output` keyword argument CPY001 Missing copyright notice at top of file --> shortcuts-cli/shortcuts_cli.py:1:1 CPY001 Missing copyright notice at top of file --> shortcuts-cli/tests/test_shortcuts_cli.py:1:1 RUF012 Mutable default value for class attribute --> vikunja-cli/tests/test_client.py:18:26 | 16 | class Handler(BaseHTTPRequestHandler): 17 | response_status = 200 18 | response_body: Any = {"ok": True} | ^^^^^^^^^^^^ 19 | response_content_type = "application/json" 20 | seen: dict[str, Any] = {} | help: Consider initializing in `__init__` or annotating with `typing.ClassVar` RUF012 Mutable default value for class attribute --> vikunja-cli/tests/test_client.py:20:28 | 18 | response_body: Any = {"ok": True} 19 | response_content_type = "application/json" 20 | seen: dict[str, Any] = {} | ^^ 21 | 22 | def do_GET(self) -> None: | help: Consider initializing in `__init__` or annotating with `typing.ClassVar` CPY001 Missing copyright notice at top of file --> weather-cli/tests/__init__.py:1:1 CPY001 Missing copyright notice at top of file --> weather-cli/tests/test_weather_cli.py:1:1 CPY001 Missing copyright notice at top of file --> weather-cli/weather_cli/__init__.py:1:1 CPY001 Missing copyright notice at top of file --> weather-cli/weather_cli/main.py:1:1 RUF012 Mutable default value for class attribute --> zhost-cli/tests/test_cli.py:19:46 | 17 | class State: 18 | version = 10 19 | collections: dict[str, dict[str, Any]] = {} | ^^ 20 | items: dict[str, dict[str, Any]] = {} 21 | settings: dict[str, dict[str, Any]] = {} | help: Consider initializing in `__init__` or annotating with `typing.ClassVar` RUF012 Mutable default value for class attribute --> zhost-cli/tests/test_cli.py:20:40 | 18 | version = 10 19 | collections: dict[str, dict[str, Any]] = {} 20 | items: dict[str, dict[str, Any]] = {} | ^^ 21 | settings: dict[str, dict[str, Any]] = {} 22 | fulltext: dict[str, dict[str, Any]] = {} | help: Consider initializing in `__init__` or annotating with `typing.ClassVar` RUF012 Mutable default value for class attribute --> zhost-cli/tests/test_cli.py:21:43 | 19 | collections: dict[str, dict[str, Any]] = {} 20 | items: dict[str, dict[str, Any]] = {} 21 | settings: dict[str, dict[str, Any]] = {} | ^^ 22 | fulltext: dict[str, dict[str, Any]] = {} 23 | requests: list[dict[str, Any]] = [] | help: Consider initializing in `__init__` or annotating with `typing.ClassVar` RUF012 Mutable default value for class attribute --> zhost-cli/tests/test_cli.py:22:43 | 20 | items: dict[str, dict[str, Any]] = {} 21 | settings: dict[str, dict[str, Any]] = {} 22 | fulltext: dict[str, dict[str, Any]] = {} | ^^ 23 | requests: list[dict[str, Any]] = [] 24 | counter = 0 | help: Consider initializing in `__init__` or annotating with `typing.ClassVar` RUF012 Mutable default value for class attribute --> zhost-cli/tests/test_cli.py:23:38 | 21 | settings: dict[str, dict[str, Any]] = {} 22 | fulltext: dict[str, dict[str, Any]] = {} 23 | requests: list[dict[str, Any]] = [] | ^^ 24 | counter = 0 | help: Consider initializing in `__init__` or annotating with `typing.ClassVar` RUF015 Prefer `next(...)` over single element slice --> zhost-cli/tests/test_cli.py:325:9 | 323 | main(["-j", "item", "find", "x"]) 324 | assert {i["key"] for i in json.loads(capsys.readouterr().out)} == {"PAPER222"} 325 | q = [r for r in _reqs("GET", "/users/1/items") if "q" in r["query"]][0] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 326 | assert q["query"]["qmode"] == ["everything"] | help: Replace with `next(...)` RUF015 Prefer `next(...)` over single element slice --> zhost-cli/tests/test_cli.py:412:12 | 410 | State.items["PAPER222"] = {"key": "PAPER222", "itemType": "journalArticle"} 411 | main(["note", "add", "PAPER222", "--text", "

hi

"]) 412 | note = [ | ____________^ 413 | | r for r in _reqs("POST", "/users/1/items") if r["body"][0]["itemType"] == "note" 414 | | ][0] | |________^ 415 | assert note["body"][0]["parentItem"] == "PAPER222" 416 | main(["note", "list", "PAPER222"]) | help: Replace with `next(...)` SIM115 Use a context manager for opening files --> zhost-cli/tests/test_cli.py:424:5 | 422 | ) -> None: 423 | pdf = f"{tmp_path}/p.pdf" 424 | open(pdf, "wb").write(b"%PDF-1.7 data") | ^^^^ 425 | State.items["PAPER222"] = {"key": "PAPER222", "itemType": "journalArticle"} 426 | main(["pdf", "attach", "PAPER222", "--pdf", pdf]) | RUF015 Prefer `next(...)` over single element slice --> zhost-cli/tests/test_cli.py:429:11 | 427 | assert any(r["path"].startswith("/uploads/") for r in State.requests) 428 | # the attachment was created under the paper 429 | att = [ | ___________^ 430 | | r 431 | | for r in _reqs("POST", "/users/1/items") 432 | | if r["body"][0]["itemType"] == "attachment" 433 | | ][0] | |________^ 434 | assert att["body"][0]["parentItem"] == "PAPER222" 435 | out_path = f"{tmp_path}/dl.pdf" | help: Replace with `next(...)` SIM115 Use a context manager for opening files --> zhost-cli/tests/test_cli.py:437:12 | 435 | out_path = f"{tmp_path}/dl.pdf" 436 | main(["pdf", "fetch", "PAPER222", "--output", out_path]) 437 | assert open(out_path, "rb").read().startswith(b"%PDF") | ^^^^ RUF015 Prefer `next(...)` over single element slice --> zhost-cli/tests/test_cli.py:458:11 | 456 | } 457 | main(["highlight", "add", "PAPER222", "--pdf", pdf, "--text", "highlight this"]) 458 | ann = [ | ___________^ 459 | | r 460 | | for r in _reqs("POST", "/users/1/items") 461 | | if r["body"][0]["itemType"] == "annotation" 462 | | ][0] | |________^ 463 | assert ann["body"][0]["parentItem"] == "ATTAC222" 464 | assert ann["body"][0]["annotationText"] == "highlight this" | help: Replace with `next(...)` SIM115 Use a context manager for opening files --> zhost-cli/tests/test_cli.py:503:5 | 501 | ) -> None: 502 | pdf = f"{tmp_path}/p.pdf" 503 | open(pdf, "wb").write(b"%PDF-1.7 data") | ^^^^ 504 | main(["-j", "item", "add", "--title", "P", "--pdf", pdf]) 505 | out = json.loads(capsys.readouterr().out) | SIM115 Use a context manager for opening files --> zhost-cli/tests/test_cli.py:546:5 | 544 | ) -> None: 545 | pdf = f"{tmp_path}/p.pdf" 546 | open(pdf, "wb").write(b"%PDF-1.7 new") | ^^^^ 547 | State.items["PAPER222"] = {"key": "PAPER222", "itemType": "journalArticle"} 548 | State.items["ATTAC222"] = { | SIM115 Use a context manager for opening files --> zhost-cli/tests/test_cli.py:656:27 | 654 | main(["library", "export", out]) 655 | 656 | manifest = json.loads(open(f"{out}/manifest.json").read()) | ^^^^ 657 | assert manifest["counts"]["items"] == 1 # one top-level paper | SIM115 Use a context manager for opening files --> zhost-cli/tests/test_cli.py:659:22 | 657 | assert manifest["counts"]["items"] == 1 # one top-level paper 658 | 659 | rec = json.loads(open(f"{out}/items/PAPER222.json").read()) | ^^^^ 660 | assert rec["item"]["data"]["title"] == "P" 661 | assert {c["key"] for c in rec["children"]} == {"ATTAC222", "NOTE2222"} | SIM115 Use a context manager for opening files --> zhost-cli/tests/test_cli.py:664:12 | 662 | assert rec["fulltext"]["ATTAC222"]["content"] == "full body" 663 | 664 | assert open(f"{out}/files/ATTAC222/p.pdf", "rb").read().startswith(b"%PDF") | ^^^^ 665 | colls = json.loads(open(f"{out}/collections.json").read()) 666 | assert any(c["key"] == "FOLDER22" for c in colls) | SIM115 Use a context manager for opening files --> zhost-cli/tests/test_cli.py:665:24 | 664 | assert open(f"{out}/files/ATTAC222/p.pdf", "rb").read().startswith(b"%PDF") 665 | colls = json.loads(open(f"{out}/collections.json").read()) | ^^^^ 666 | assert any(c["key"] == "FOLDER22" for c in colls) | SIM115 Use a context manager for opening files --> zhost-cli/tests/test_cli.py:717:43 | 715 | exported_items = {p[:-5] for p in os.listdir(f"{out}/items")} 716 | assert exported_items == {"PAPER222", "SUBPAP22", "CROSS222"} 717 | colls = {c["key"] for c in json.loads(open(f"{out}/collections.json").read())} | ^^^^ 718 | assert colls == {"ROOT2222", "FOLDER22", "SUBCOL22"} 719 | cross = json.loads(open(f"{out}/items/CROSS222.json").read()) | SIM115 Use a context manager for opening files --> zhost-cli/tests/test_cli.py:719:24 | 717 | colls = {c["key"] for c in json.loads(open(f"{out}/collections.json").read())} 718 | assert colls == {"ROOT2222", "FOLDER22", "SUBCOL22"} 719 | cross = json.loads(open(f"{out}/items/CROSS222.json").read()) | ^^^^ 720 | assert cross["item"]["data"]["collections"] == ["FOLDER22"] | SIM115 Use a context manager for opening files --> zhost-cli/tests/test_cli.py:734:27 | 732 | main(["library", "export", out]) 733 | 734 | settings = json.loads(open(f"{out}/settings.json").read()) | ^^^^ 735 | assert settings["tagColors"]["value"] == [{"name": "read", "color": "#5fb236"}] | SIM115 Use a context manager for opening files --> zhost-cli/zhost_cli/client.py:274:16 | 272 | ) -> Response: 273 | """Run the full authorize -> upload -> register sequence for `path`.""" 274 | data = open(path, "rb").read() | ^^^^ 275 | md5 = hashlib.md5(data).hexdigest() 276 | stat = os.stat(path) | Found 134 errors (21 fixed, 113 remaining). No fixes available (10 hidden fixes can be enabled with the `--unsafe-fixes` option). ERRO formatter | ruff-check: failed to apply with options '[check --fix]': exit status 1 CPY001 Missing copyright notice at top of file --> context7-cli/context7_cli.py:1:1 Found 1 error. ERRO formatter | ruff-check: failed to apply with options '[check --fix]': exit status 1 CPY001 Missing copyright notice at top of file --> crwl-cli/crawl.py:1:1 Found 1 error. ERRO formatter | ruff-check: failed to apply with options '[check --fix]': exit status 1 CPY001 Missing copyright notice at top of file --> crabfit-cli/crabfit_cli.py:1:1 CPY001 Missing copyright notice at top of file --> crabfit-cli/tests/__init__.py:1:1 CPY001 Missing copyright notice at top of file --> crabfit-cli/tests/test_crabfit_cli.py:1:1 Found 3 errors. ERRO formatter | ruff-check: failed to apply with options '[check --fix]': exit status 1 CPY001 Missing copyright notice at top of file --> pexpect-cli/pexpect_cli/__init__.py:1:1 CPY001 Missing copyright notice at top of file --> pexpect-cli/pexpect_cli/client.py:1:1 CPY001 Missing copyright notice at top of file --> pexpect-cli/pexpect_cli/server.py:1:1 CPY001 Missing copyright notice at top of file --> pexpect-cli/tests/__init__.py:1:1 CPY001 Missing copyright notice at top of file --> pexpect-cli/tests/test_integration.py:1:1 Found 5 errors. ERRO formatter | ruff-check: failed to apply with options '[check --fix]': exit status 1 SIM102 Use a single `if` statement instead of nested `if` statements --> n8n-cli/n8n_cli/commands/apply.py:66:13 | 65 | # Filter by IDs if specified 66 | / if ids: 67 | | if not wf_id or wf_id not in ids: | |_________________________________________________^ 68 | continue | help: Combine `if` statements using `and` SIM103 Return the condition `local.get("active") != remote.get("active")` directly --> n8n-cli/n8n_cli/commands/apply.py:185:5 | 183 | return True 184 | # Compare active state 185 | / if local.get("active") != remote.get("active"): 186 | | return True 187 | | return False | |________________^ help: Replace with `return local.get("active") != remote.get("active")` SIM102 Use a single `if` statement instead of nested `if` statements --> n8n-cli/n8n_cli/commands/apply.py:272:9 | 270 | local_updated = data.get("updatedAt") 271 | remote_updated = remote.get("updatedAt") 272 | / if local_updated and remote_updated and remote_updated > local_updated: 273 | | if not ns.force: | |____________________________^ 274 | print( 275 | f" conflict: {basename} (remote is newer: {remote_updated} > {local_updated})" | help: Combine `if` statements using `and` SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements --> n8n-cli/tests/conftest.py:333:5 | 331 | "N8N_API_KEY": "test-key-1234", 332 | } 333 | / with patch.dict("os.environ", env, clear=False): 334 | | with patch("sys.argv", ["n8n-cli", *argv]): | |___________________________________________________^ 335 | try: 336 | main() | help: Combine `with` statements SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements --> n8n-cli/tests/conftest.py:354:5 | 352 | "N8N_API_KEY": "test-key-1234", 353 | } 354 | / with patch.dict("os.environ", env, clear=False): 355 | | with patch("sys.argv", ["n8n-cli", *argv]): | |___________________________________________________^ 356 | with pytest.raises(SystemExit) as exc_info: 357 | main() | help: Combine `with` statements SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements --> n8n-cli/tests/test_errors.py:14:9 | 12 | """Missing API URL/key produces a ConfigError, not a traceback.""" 13 | env = {"N8N_API_URL": "", "N8N_API_KEY": ""} 14 | / with patch.dict("os.environ", env, clear=False): 15 | | with patch("sys.argv", ["n8n-cli", "credential", "list"]): | |______________________________________________________________________^ 16 | with pytest.raises(SystemExit) as exc_info: 17 | main() | help: Combine `with` statements SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements --> n8n-cli/tests/test_errors.py:24:9 | 22 | def test_unknown_command(self, capsys: pytest.CaptureFixture[str]) -> None: 23 | """Unknown top-level command exits with code 2 (argparse error).""" 24 | / with patch.dict("os.environ", {"N8N_API_URL": "x", "N8N_API_KEY": "x"}): 25 | | with patch("sys.argv", ["n8n-cli", "bogus"]): | |_________________________________________________________^ 26 | with pytest.raises(SystemExit) as exc_info: 27 | main() | help: Combine `with` statements Found 18 errors (11 fixed, 7 remaining). No fixes available (2 hidden fixes can be enabled with the `--unsafe-fixes` option). ERRO formatter | ruff-check: failed to apply with options '[check --fix]': exit status 1 CPY001 Missing copyright notice at top of file --> calendar-cli/calendar_cli/__init__.py:1:1 CPY001 Missing copyright notice at top of file --> calendar-cli/calendar_cli/cache.py:1:1 CPY001 Missing copyright notice at top of file --> calendar-cli/calendar_cli/config.py:1:1 CPY001 Missing copyright notice at top of file --> calendar-cli/calendar_cli/create.py:1:1 CPY001 Missing copyright notice at top of file --> calendar-cli/calendar_cli/email_invite.py:1:1 CPY001 Missing copyright notice at top of file --> calendar-cli/calendar_cli/errors.py:1:1 CPY001 Missing copyright notice at top of file --> calendar-cli/calendar_cli/import_invite.py:1:1 CPY001 Missing copyright notice at top of file --> calendar-cli/calendar_cli/main.py:1:1 CPY001 Missing copyright notice at top of file --> calendar-cli/calendar_cli/models.py:1:1 CPY001 Missing copyright notice at top of file --> calendar-cli/calendar_cli/parse.py:1:1 CPY001 Missing copyright notice at top of file --> calendar-cli/calendar_cli/reply.py:1:1 CPY001 Missing copyright notice at top of file --> calendar-cli/calendar_cli/store.py:1:1 CPY001 Missing copyright notice at top of file --> calendar-cli/calendar_cli/timeutil.py:1:1 CPY001 Missing copyright notice at top of file --> calendar-cli/calendar_cli/util.py:1:1 CPY001 Missing copyright notice at top of file --> calendar-cli/tests/__init__.py:1:1 CPY001 Missing copyright notice at top of file --> calendar-cli/tests/conftest.py:1:1 CPY001 Missing copyright notice at top of file --> calendar-cli/tests/helpers.py:1:1 CPY001 Missing copyright notice at top of file --> calendar-cli/tests/test_cache.py:1:1 CPY001 Missing copyright notice at top of file --> calendar-cli/tests/test_cli.py:1:1 CPY001 Missing copyright notice at top of file --> calendar-cli/tests/test_import.py:1:1 CPY001 Missing copyright notice at top of file --> calendar-cli/tests/test_invite.py:1:1 CPY001 Missing copyright notice at top of file --> calendar-cli/tests/test_reply.py:1:1 CPY001 Missing copyright notice at top of file --> calendar-cli/tests/test_store.py:1:1 Found 23 errors. traversed 363 files emitted 319 files for processing formatted 128 files (25 changed) in 3.238s Error: failed to finalise formatting: formatting failures detected