Running phase: unpackPhase unpacking source archive /nix/store/nm39xalnhg923wqngvn5xvz7gv8hplqg-drawio-cli source root is drawio-cli Running phase: patchPhase Running phase: updateAutotoolsGnuConfigScriptsPhase Running phase: configurePhase no configure script, doing nothing Running phase: buildPhase no Makefile or custom buildPhase, doing nothing Running phase: checkPhase 21 files already formatted EXE001 Shebang is present but file is not executable --> index-builder/update-baseline.py:1:1 | 1 | #!/usr/bin/env python3 | ^^^^^^^^^^^^^^^^^^^^^^ 2 | from __future__ import annotations | TRY004 Prefer `TypeError` exception for invalid type --> 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 --> 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 --> 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 | RUF100 [*] Unused `noqa` directive (non-enabled: `S603`) --> src/drawio_cli/desktop.py:24:28 | 22 | drawio_bin = drawio or os.environ.get("DRAWIO_CLI_DRAWIO", "drawio") 23 | try: 24 | subprocess.Popen( # noqa: S603 | ^^^^^^^^^^^^ 25 | [drawio_bin, str(source)], 26 | stdin=subprocess.DEVNULL, | help: Remove unused `noqa` directive | 23 | try: - subprocess.Popen( # noqa: S603 24 + subprocess.Popen( 25 | [drawio_bin, str(source)], | TRY004 Prefer `TypeError` exception for invalid type --> 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 --> 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 --> 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 --> 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` --> 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` --> 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 --> 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 --> 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 --> 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 --> 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 --> 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()` I001 [*] Import block is un-sorted or un-formatted --> tests/test_cli.py:1:1 | 1 | / from __future__ import annotations 2 | | 3 | | import json 4 | | from pathlib import Path 5 | | 6 | | import pytest 7 | | from drawio_cli.cli import build_parser, main 8 | | from drawio_cli.document import DrawioDocument, element_to_text | |_______________________________________________________________^ 9 | 10 | FIXTURES = Path(__file__).parent / "fixtures" | help: Organize imports | 6 | import pytest 7 + 8 | from drawio_cli.cli import build_parser, main | I001 [*] Import block is un-sorted or un-formatted --> tests/test_desktop.py:1:1 | 1 | / from __future__ import annotations 2 | | 3 | | import subprocess 4 | | from pathlib import Path 5 | | from unittest.mock import Mock, patch 6 | | 7 | | import pytest 8 | | from drawio_cli.desktop import _has_gui_session, handoff_to_desktop | |___________________________________________________________________^ help: Organize imports | 7 | import pytest 8 + 9 | from drawio_cli.desktop import _has_gui_session, handoff_to_desktop | I001 [*] Import block is un-sorted or un-formatted --> tests/test_document.py:1:1 | 1 | / from __future__ import annotations 2 | | 3 | | import base64 4 | | import urllib.parse 5 | | import xml.etree.ElementTree as ET 6 | | import zlib 7 | | from pathlib import Path 8 | | 9 | | import pytest 10 | | from drawio_cli import xmlsafe 11 | | from drawio_cli.cli import main 12 | | from drawio_cli.document import DrawioDocument, sha256_file | |___________________________________________________________^ 13 | 14 | FIXTURES = Path(__file__).parent / "fixtures" | help: Organize imports | 9 | import pytest 10 + 11 | from drawio_cli import xmlsafe | I001 [*] Import block is un-sorted or un-formatted --> tests/test_layout.py:1:1 | 1 | / from __future__ import annotations 2 | | 3 | | import json 4 | | from pathlib import Path 5 | | 6 | | import pytest 7 | | from drawio_cli.document import DrawioDocument 8 | | from drawio_cli.layout import layout_graph 9 | | from drawio_cli.validate import validate_document | |_________________________________________________^ help: Organize imports | 6 | import pytest 7 + 8 | from drawio_cli.document import DrawioDocument | I001 [*] Import block is un-sorted or un-formatted --> tests/test_render.py:1:1 | 1 | / from __future__ import annotations 2 | | 3 | | import struct 4 | | import zlib 5 | | from pathlib import Path 6 | | from unittest.mock import patch 7 | | 8 | | import pytest 9 | | from drawio_cli.png import PNG_MAGIC, assert_png, repair_png_iend 10 | | from drawio_cli.render import ( 11 | | _render_command, 12 | | _render_env, 13 | | _validate_render_output, 14 | | render_diagram, 15 | | ) | |_^ 16 | 17 | FIXTURES = Path(__file__).parent / "fixtures" | help: Organize imports | 8 | import pytest 9 + 10 | from drawio_cli.png import PNG_MAGIC, assert_png, repair_png_iend | I001 [*] Import block is un-sorted or un-formatted --> tests/test_shapes.py:1:1 | 1 | / from __future__ import annotations 2 | | 3 | | import gzip 4 | | import json 5 | | from pathlib import Path 6 | | 7 | | import pytest 8 | | from drawio_cli.shapes import ShapeIndex, load_index, search_shapes, soundex | |____________________________________________________________________________^ help: Organize imports | 7 | import pytest 8 + 9 | from drawio_cli.shapes import ShapeIndex, load_index, search_shapes, soundex | I001 [*] Import block is un-sorted or un-formatted --> tests/test_validate.py:1:1 | 1 | / from __future__ import annotations 2 | | 3 | | from pathlib import Path 4 | | 5 | | import pytest 6 | | from drawio_cli.document import DrawioDocument 7 | | from drawio_cli.validate import validate_document | |_________________________________________________^ 8 | 9 | FIXTURES = Path(__file__).parent / "fixtures" | help: Organize imports | 5 | import pytest 6 + 7 | from drawio_cli.document import DrawioDocument | Found 23 errors. [*] 8 fixable with the `--fix` option (5 hidden fixes can be enabled with the `--unsafe-fixes` option).