drawio-cli-0.1.0
default.checks.x86_64-linux.package-drawio-cli
· build #37
· raw
unpackPhase
1unpacking source archive /nix/store/nm39xalnhg923wqngvn5xvz7gv8hplqg-drawio-cli2source root is drawio-cliconfigurePhase
3no configure script, doing nothingbuildPhase
4no Makefile or custom buildPhase, doing nothingcheckPhase
521 files already formatted6EXE001 Shebang is present but file is not executable7 --> index-builder/update-baseline.py:1:18 |91 | #!/usr/bin/env python310 | ^^^^^^^^^^^^^^^^^^^^^^112 | from __future__ import annotations12 |1314TRY004 Prefer `TypeError` exception for invalid type15 --> index-builder/update-baseline.py:20:916 |1718 | value = data.get(key)1819 | if not isinstance(value, dict):1920 | raise ValueError(f"manifest {key!r} must be an object")20 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^2121 | return value22 |2324TRY004 Prefer `TypeError` exception for invalid type25 --> index-builder/update-baseline.py:27:926 |2725 | value = data.get(key)2826 | if not isinstance(value, int) or isinstance(value, bool):2927 | raise ValueError(f"manifest {key!r} must be an integer")30 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^3128 | if positive and value <= 0:3229 | raise ValueError(f"manifest {key!r} must be positive")33 |3435TRY004 Prefer `TypeError` exception for invalid type36 --> index-builder/update-baseline.py:88:937 |3886 | value = json.loads(path.read_text(encoding="utf-8"))3987 | if not isinstance(value, dict):4088 | raise ValueError(f"{path} must contain a JSON object")41 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^4289 | return value43 |4445RUF100 [*] Unused `noqa` directive (non-enabled: `S603`)46 --> src/drawio_cli/desktop.py:24:2847 |4822 | drawio_bin = drawio or os.environ.get("DRAWIO_CLI_DRAWIO", "drawio")4923 | try:5024 | subprocess.Popen( # noqa: S60351 | ^^^^^^^^^^^^5225 | [drawio_bin, str(source)],5326 | stdin=subprocess.DEVNULL,54 |55help: Remove unused `noqa` directive56 |5723 | try:58 - subprocess.Popen( # noqa: S6035924 + subprocess.Popen(6025 | [drawio_bin, str(source)],61 |6263TRY004 Prefer `TypeError` exception for invalid type64 --> src/drawio_cli/layout.py:83:965 |6681 | data = json.load(handle)6782 | if not isinstance(data, dict):6883 | raise ValueError("graph JSON must be an object")69 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^7084 | graph_direction = direction or str(data.get("direction", "TB"))7185 | if graph_direction not in {"TB", "LR"}:72 |7374TRY004 Prefer `TypeError` exception for invalid type75 --> src/drawio_cli/layout.py:91:976 |7789 | edges_raw = data.get("edges", [])7890 | if not isinstance(nodes_raw, list) or not isinstance(edges_raw, list):7991 | raise ValueError("nodes and edges must be lists")80 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^8192 |8293 | nodes: list[Node] = []83 |8485TRY004 Prefer `TypeError` exception for invalid type86 --> src/drawio_cli/layout.py:97:1387 |8895 | for raw in nodes_raw:8996 | if not isinstance(raw, dict):9097 | raise ValueError("node must be an object")91 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^9298 | node_id = str(raw.get("id", ""))9399 | if not node_id or node_id in {"0", "1"}:94 |9596TRY004 Prefer `TypeError` exception for invalid type97 --> src/drawio_cli/layout.py:129:1398 |99127 | for index, raw in enumerate(edges_raw):100128 | if not isinstance(raw, dict):101129 | raise ValueError("edge must be an object")102 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^103130 | source = str(raw.get("source", ""))104131 | target = str(raw.get("target", ""))105 |106107UP022 Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE`108 --> src/drawio_cli/layout.py:243:18109 |110241 | dot_path = Path(tmp) / "graph.dot"111242 | dot_path.write_text(source, encoding="utf-8")112243 | result = subprocess.run(113 | __________________^114244 | | [dot, "-Tplain", str(dot_path)],115245 | | check=False,116246 | | text=True,117247 | | stdout=subprocess.PIPE,118248 | | stderr=subprocess.PIPE,119249 | | )120 | |_________^121250 | if result.returncode != 0:122251 | raise RuntimeError(f"dot failed: {result.stderr.strip()}")123 |124help: Replace with `capture_output` keyword argument125126UP022 Prefer `capture_output` over sending `stdout` and `stderr` to `PIPE`127 --> src/drawio_cli/render.py:63:18128 |12961 | transparent=transparent,13062 | )13163 | result = subprocess.run(132 | __________________^13364 | | cmd,13465 | | check=False,13566 | | text=True,13667 | | stdout=subprocess.PIPE,13768 | | stderr=subprocess.PIPE,13869 | | env=_render_env(Path(tmp)),13970 | | )140 | |_________^14171 | if result.returncode != 0:14272 | raise RuntimeError(143 |144help: Replace with `capture_output` keyword argument145146TRY004 Prefer `TypeError` exception for invalid type147 --> src/drawio_cli/shapes.py:113:9148 |149111 | rows = raw.get("entries", raw) if isinstance(raw, dict) else raw150112 | if not isinstance(rows, list):151113 | raise ValueError("shape index must contain list or entries list")152 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^153114 | entries: list[ShapeEntry] = []154115 | for index, row in enumerate(rows):155 |156157TRY004 Prefer `TypeError` exception for invalid type158 --> src/drawio_cli/shapes.py:117:13159 |160115 | for index, row in enumerate(rows):161116 | if not isinstance(row, dict):162117 | raise ValueError(f"shape index entry {index} must be an object")163 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^164118 | entries.append(ShapeEntry.from_json(row))165119 | return ShapeIndex(tuple(entries))166 |167168RUF007 Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs169 --> src/drawio_cli/validate.py:167:23170 |171165 | corners = [(x, y), (x + width, y), (x + width, y + height), (x, y + height)]172166 | borders = list(zip(corners, [*corners[1:], corners[0]]))173167 | for start, end in zip(points, points[1:]):174 | ^^^175168 | if _point_in_rect(start, box) or _point_in_rect(end, box):176169 | return True177 |178help: Replace `zip()` with `itertools.pairwise()`179180RUF007 Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs181 --> src/drawio_cli/validate.py:181:31182 |183179 | return any(184180 | _segments_cross(a_start, a_end, b_start, b_end)185181 | for a_start, a_end in zip(a, a[1:])186 | ^^^187182 | for b_start, b_end in zip(b, b[1:])188183 | )189 |190help: Replace `zip()` with `itertools.pairwise()`191192RUF007 Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs193 --> src/drawio_cli/validate.py:182:31194 |195180 | _segments_cross(a_start, a_end, b_start, b_end)196181 | for a_start, a_end in zip(a, a[1:])197182 | for b_start, b_end in zip(b, b[1:])198 | ^^^199183 | )200 |201help: Replace `zip()` with `itertools.pairwise()`202203I001 [*] Import block is un-sorted or un-formatted204 --> tests/test_cli.py:1:1205 |206 1 | / from __future__ import annotations207 2 | |208 3 | | import json209 4 | | from pathlib import Path210 5 | |211 6 | | import pytest212 7 | | from drawio_cli.cli import build_parser, main213 8 | | from drawio_cli.document import DrawioDocument, element_to_text214 | |_______________________________________________________________^215 9 |21610 | FIXTURES = Path(__file__).parent / "fixtures"217 |218help: Organize imports219 |2206 | import pytest2217 +2228 | from drawio_cli.cli import build_parser, main223 |224225I001 [*] Import block is un-sorted or un-formatted226 --> tests/test_desktop.py:1:1227 |2281 | / from __future__ import annotations2292 | |2303 | | import subprocess2314 | | from pathlib import Path2325 | | from unittest.mock import Mock, patch2336 | |2347 | | import pytest2358 | | from drawio_cli.desktop import _has_gui_session, handoff_to_desktop236 | |___________________________________________________________________^237help: Organize imports238 |2397 | import pytest2408 +2419 | from drawio_cli.desktop import _has_gui_session, handoff_to_desktop242 |243244I001 [*] Import block is un-sorted or un-formatted245 --> tests/test_document.py:1:1246 |247 1 | / from __future__ import annotations248 2 | |249 3 | | import base64250 4 | | import urllib.parse251 5 | | import xml.etree.ElementTree as ET252 6 | | import zlib253 7 | | from pathlib import Path254 8 | |255 9 | | import pytest25610 | | from drawio_cli import xmlsafe25711 | | from drawio_cli.cli import main25812 | | from drawio_cli.document import DrawioDocument, sha256_file259 | |___________________________________________________________^26013 |26114 | FIXTURES = Path(__file__).parent / "fixtures"262 |263help: Organize imports264 |2659 | import pytest26610 +26711 | from drawio_cli import xmlsafe268 |269270I001 [*] Import block is un-sorted or un-formatted271 --> tests/test_layout.py:1:1272 |2731 | / from __future__ import annotations2742 | |2753 | | import json2764 | | from pathlib import Path2775 | |2786 | | import pytest2797 | | from drawio_cli.document import DrawioDocument2808 | | from drawio_cli.layout import layout_graph2819 | | from drawio_cli.validate import validate_document282 | |_________________________________________________^283help: Organize imports284 |2856 | import pytest2867 +2878 | from drawio_cli.document import DrawioDocument288 |289290I001 [*] Import block is un-sorted or un-formatted291 --> tests/test_render.py:1:1292 |293 1 | / from __future__ import annotations294 2 | |295 3 | | import struct296 4 | | import zlib297 5 | | from pathlib import Path298 6 | | from unittest.mock import patch299 7 | |300 8 | | import pytest301 9 | | from drawio_cli.png import PNG_MAGIC, assert_png, repair_png_iend30210 | | from drawio_cli.render import (30311 | | _render_command,30412 | | _render_env,30513 | | _validate_render_output,30614 | | render_diagram,30715 | | )308 | |_^30916 |31017 | FIXTURES = Path(__file__).parent / "fixtures"311 |312help: Organize imports313 |3148 | import pytest3159 +31610 | from drawio_cli.png import PNG_MAGIC, assert_png, repair_png_iend317 |318319I001 [*] Import block is un-sorted or un-formatted320 --> tests/test_shapes.py:1:1321 |3221 | / from __future__ import annotations3232 | |3243 | | import gzip3254 | | import json3265 | | from pathlib import Path3276 | |3287 | | import pytest3298 | | from drawio_cli.shapes import ShapeIndex, load_index, search_shapes, soundex330 | |____________________________________________________________________________^331help: Organize imports332 |3337 | import pytest3348 +3359 | from drawio_cli.shapes import ShapeIndex, load_index, search_shapes, soundex336 |337338I001 [*] Import block is un-sorted or un-formatted339 --> tests/test_validate.py:1:1340 |3411 | / from __future__ import annotations3422 | |3433 | | from pathlib import Path3444 | |3455 | | import pytest3466 | | from drawio_cli.document import DrawioDocument3477 | | from drawio_cli.validate import validate_document348 | |_________________________________________________^3498 |3509 | FIXTURES = Path(__file__).parent / "fixtures"351 |352help: Organize imports353 |3545 | import pytest3556 +3567 | from drawio_cli.document import DrawioDocument357 |358359Found 23 errors.360[*] 8 fixable with the `--fix` option (5 hidden fixes can be enabled with the `--unsafe-fixes` option).