this derivation will be built: /nix/store/fkxj1mpwbwa31cwqsvqfx8zx4z8jyyc8-treefmt-check.drv building '/nix/store/fkxj1mpwbwa31cwqsvqfx8zx4z8jyyc8-treefmt-check.drv' treefmt-check> treefmt v2.5.0ERRO formatter | ruff-check: failed to apply with options '[check --fix]': exit status 1 treefmt-check> treefmt-check> D301 Use `r"""` if any backslashes in a docstring treefmt-check> --> lib/spaces_install_lib.py:400:5 treefmt-check> | treefmt-check> 399 | def nix_string(value: str) -> str: treefmt-check> 400 | / """`value` as a Nix double-quoted string literal. The three sequences treefmt-check> 401 | | that Nix reads inside `"…"` are escaped: `\\`, `"` and `${`. treefmt-check> 402 | | """ treefmt-check> | |_______^ treefmt-check> 403 | escaped = value.replace("\\", "\\\\").replace('"', '\\"').replace("${", "\\${") treefmt-check> 404 | return f'"{escaped}"' treefmt-check> | treefmt-check> help: Add `r` prefix treefmt-check> treefmt-check> RUF005 Consider iterable unpacking instead of concatenation treefmt-check> --> packages/spaces-install-backend/backend.py:728:22 treefmt-check> | treefmt-check> 726 | host = plan["hostname"] treefmt-check> 727 | live_modules = [m.format(host=host) for m in LIVE_FLAKE_MODULES] if live else [] treefmt-check> 728 | config_modules = live_modules + [ treefmt-check> | ______________________^ treefmt-check> 729 | | f"./machines/{host}/generated.nix", treefmt-check> 730 | | f"./machines/{host}/configuration.nix", treefmt-check> 731 | | f"./machines/{host}/hardware-configuration.nix", treefmt-check> 732 | | f"./machines/{host}/hermes.nix", treefmt-check> 733 | | ] treefmt-check> | |_____^ treefmt-check> 734 | extra = [] treefmt-check> 735 | if Path("/etc/spaces-test-support").exists(): treefmt-check> | treefmt-check> help: Replace with iterable unpacking treefmt-check> treefmt-check> PLR2004 Magic value used in comparison, consider replacing `127` with a constant variable treefmt-check> --> packages/spaces-install-backend/backend.py:954:53 treefmt-check> | treefmt-check> 952 | # merge-file exits with the conflict count, 0 for a clean merge, treefmt-check> 953 | # and negative (255 here) on an error. treefmt-check> 954 | if proc.returncode < 0 or proc.returncode > 127: treefmt-check> | ^^^ treefmt-check> 955 | msg = f"git merge-file failed on {dest}: {proc.stderr.strip()}" treefmt-check> 956 | raise InstallError(msg) treefmt-check> | treefmt-check> treefmt-check> TRY301 Abstract `raise` to an inner function treefmt-check> --> packages/spaces-install-backend/backend.py:1804:17 treefmt-check> | treefmt-check> 1802 | run_checked(["systemctl", "reboot"]) treefmt-check> 1803 | else: # pragma: no cover treefmt-check> 1804 | raise AssertionError(action) treefmt-check> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ treefmt-check> 1805 | except Exception: treefmt-check> 1806 | # Past the stop the user has no agent. Whatever failed (the stop treefmt-check> | treefmt-check> treefmt-check> PT008 Use `return_value=` instead of patching with `lambda` treefmt-check> --> packages/spaces-install-backend/test_backend.py:832:13 treefmt-check> | treefmt-check> 830 | with ( treefmt-check> 831 | tempfile.TemporaryDirectory() as tmp, treefmt-check> 832 | mock.patch.object(backend.os, "uname", lambda: uname), treefmt-check> | ^^^^^^^^^^^^^^^^^ treefmt-check> 833 | ): treefmt-check> 834 | repo = Path(tmp) / "dotfiles" treefmt-check> | treefmt-check> treefmt-check> RUF012 Mutable default value for class attribute treefmt-check> --> packages/spaces-install-backend/test_backend.py:856:17 treefmt-check> | treefmt-check> 854 | HARDWARE = LiveRepoTest.HARDWARE treefmt-check> 855 | SPACES_FLAKE = "/nix/store/aaaa-spaces-src" treefmt-check> 856 | OVERRIDES = {"nixpkgs": "/nix/store/bbbb-nixpkgs"} treefmt-check> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ treefmt-check> 857 | treefmt-check> 858 | def seed(self): treefmt-check> | treefmt-check> help: Consider initializing in `__init__` or annotating with `typing.ClassVar` treefmt-check> treefmt-check> RUF012 Mutable default value for class attribute treefmt-check> --> packages/spaces-install-backend/test_backend.py:941:17 treefmt-check> | treefmt-check> 939 | HARDWARE_TARGET = '{ ... }:\n{ boot.initrd.availableKernelModules = [ "nvme" ]; }\n' treefmt-check> 940 | SPACES_FLAKE = "/nix/store/aaaa-spaces-src" treefmt-check> 941 | OVERRIDES = {"nixpkgs": "/nix/store/bbbb-nixpkgs"} treefmt-check> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ treefmt-check> 942 | DRV = "/nix/store/cccc-nixos-system-testhost.drv" treefmt-check> 943 | TOPLEVEL = "/nix/store/dddd-nixos-system-testhost" treefmt-check> | treefmt-check> help: Consider initializing in `__init__` or annotating with `typing.ClassVar` treefmt-check> treefmt-check> SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements treefmt-check> --> packages/spaces-install-backend/test_backend.py:1162:13 treefmt-check> | treefmt-check> 1160 | stale = run_dir / "configuration.nix.rej" treefmt-check> 1161 | stale.write_text("<<<<<<< stale\n") treefmt-check> 1162 | / with mock.patch.object(backend, "RUN_DIR", run_dir): treefmt-check> 1163 | | with self.assertRaises(backend.InstallError): treefmt-check> | |_____________________________________________________________^ treefmt-check> 1164 | backend.install_to( treefmt-check> 1165 | tmp / "mnt", plan(password_file=str(tmp / "missing")), "efi" treefmt-check> | treefmt-check> help: Combine `with` statements treefmt-check> treefmt-check> SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements treefmt-check> --> packages/spaces-install-backend/test_backend.py:1178:13 treefmt-check> | treefmt-check> 1176 | stale = run_dir / "installed.json" treefmt-check> 1177 | stale.write_text("{}\n") treefmt-check> 1178 | / with mock.patch.object(backend, "RUN_DIR", run_dir): treefmt-check> 1179 | | with self.assertRaises(backend.InstallError): treefmt-check> | |_____________________________________________________________^ treefmt-check> 1180 | backend.install_to( treefmt-check> 1181 | tmp / "mnt", plan(password_file=str(tmp / "missing")), "efi" treefmt-check> | treefmt-check> help: Combine `with` statements treefmt-check> treefmt-check> EM102 Exception must not use an f-string literal, assign to variable first treefmt-check> --> packages/spaces-install-backend/test_backend.py:1501:44 treefmt-check> | treefmt-check> 1499 | mode_at_reboot.append(unplug.stat().st_mode & 0o777 if unplug.exists() else None) treefmt-check> 1500 | if armed and argv[0] == fail_at: treefmt-check> 1501 | raise backend.InstallError(f"{argv[0]} failed") treefmt-check> | ^^^^^^^^^^^^^^^^^^^ treefmt-check> 1502 | if argv[0] == "ssh-keygen": treefmt-check> 1503 | return real_run(argv, **kwargs) treefmt-check> | treefmt-check> help: Assign to variable; remove f-string literal treefmt-check> treefmt-check> ARG001 Unused function argument: `unit` treefmt-check> --> packages/spaces-install-backend/test_backend.py:1524:29 treefmt-check> | treefmt-check> 1522 | return "" treefmt-check> 1523 | treefmt-check> 1524 | def fake_unit_state(unit): treefmt-check> | ^^^^ treefmt-check> 1525 | return "inactive" treefmt-check> | treefmt-check> treefmt-check> S105 Possible hardcoded password assigned to: "TOKEN_HEADER" treefmt-check> --> packages/spaces-installer-session/bootstrap.py:51:16 treefmt-check> | treefmt-check> 49 | from websockets.exceptions import WebSocketException treefmt-check> 50 | treefmt-check> 51 | TOKEN_HEADER = "X-Hermes-Session-Token" treefmt-check> | ^^^^^^^^^^^^^^^^^^^^^^^^ treefmt-check> 52 | treefmt-check> 53 | # The first user turn. It names the situation and the skill, nothing treefmt-check> | treefmt-check> treefmt-check> ANN201 Missing return type annotation for public function `log` treefmt-check> --> packages/spaces-installer-session/bootstrap.py:60:5 treefmt-check> | treefmt-check> 60 | def log(msg): treefmt-check> | ^^^ treefmt-check> 61 | print(f"spaces-installer-session: {msg}", file=sys.stderr) treefmt-check> | treefmt-check> help: Add return type annotation: `None` treefmt-check> treefmt-check> ANN001 Missing type annotation for function argument `msg` treefmt-check> --> packages/spaces-installer-session/bootstrap.py:60:9 treefmt-check> | treefmt-check> 60 | def log(msg): treefmt-check> | ^^^ treefmt-check> 61 | print(f"spaces-installer-session: {msg}", file=sys.stderr) treefmt-check> | treefmt-check> treefmt-check> ANN204 Missing return type annotation for special method `__init__` treefmt-check> --> packages/spaces-installer-session/bootstrap.py:65:9 treefmt-check> | treefmt-check> 64 | class Dashboard: treefmt-check> 65 | def __init__(self, base_url, ws_url, token): treefmt-check> | ^^^^^^^^ treefmt-check> 66 | self.base_url = base_url.rstrip("/") treefmt-check> 67 | self.ws_url = ws_url treefmt-check> | treefmt-check> help: Add return type annotation: `None` treefmt-check> treefmt-check> ANN001 Missing type annotation for function argument `base_url` treefmt-check> --> packages/spaces-installer-session/bootstrap.py:65:24 treefmt-check> | treefmt-check> 64 | class Dashboard: treefmt-check> 65 | def __init__(self, base_url, ws_url, token): treefmt-check> | ^^^^^^^^ treefmt-check> 66 | self.base_url = base_url.rstrip("/") treefmt-check> 67 | self.ws_url = ws_url treefmt-check> | treefmt-check> treefmt-check> ANN001 Missing type annotation for function argument `ws_url` treefmt-check> --> packages/spaces-installer-session/bootstrap.py:65:34 treefmt-check> | treefmt-check> 64 | class Dashboard: treefmt-check> 65 | def __init__(self, base_url, ws_url, token): treefmt-check> | ^^^^^^ treefmt-check> 66 | self.base_url = base_url.rstrip("/") treefmt-check> 67 | self.ws_url = ws_url treefmt-check> | treefmt-check> treefmt-check> ANN001 Missing type annotation for function argument `token` treefmt-check> --> packages/spaces-installer-session/bootstrap.py:65:42 treefmt-check> | treefmt-check> 64 | class Dashboard: treefmt-check> 65 | def __init__(self, base_url, ws_url, token): treefmt-check> | ^^^^^ treefmt-check> 66 | self.base_url = base_url.rstrip("/") treefmt-check> 67 | self.ws_url = ws_url treefmt-check> | treefmt-check> treefmt-check> ANN202 Missing return type annotation for private function `_request` treefmt-check> --> packages/spaces-installer-session/bootstrap.py:70:9 treefmt-check> | treefmt-check> 68 | self.token = token treefmt-check> 69 | treefmt-check> 70 | def _request(self, method, path, body=None): treefmt-check> | ^^^^^^^^ treefmt-check> 71 | data = None treefmt-check> 72 | headers = {TOKEN_HEADER: self.token} treefmt-check> | treefmt-check> help: Add return type annotation treefmt-check> treefmt-check> ANN001 Missing type annotation for function argument `method` treefmt-check> --> packages/spaces-installer-session/bootstrap.py:70:24 treefmt-check> | treefmt-check> 68 | self.token = token treefmt-check> 69 | treefmt-check> 70 | def _request(self, method, path, body=None): treefmt-check> | ^^^^^^ treefmt-check> 71 | data = None treefmt-check> 72 | headers = {TOKEN_HEADER: self.token} treefmt-check> | treefmt-check> treefmt-check> ANN001 Missing type annotation for function argument `path` treefmt-check> --> packages/spaces-installer-session/bootstrap.py:70:32 treefmt-check> | treefmt-check> 68 | self.token = token treefmt-check> 69 | treefmt-check> 70 | def _request(self, method, path, body=None): treefmt-check> | ^^^^ treefmt-check> 71 | data = None treefmt-check> 72 | headers = {TOKEN_HEADER: self.token} treefmt-check> | treefmt-check> treefmt-check> ANN001 Missing type annotation for function argument `body` treefmt-check> --> packages/spaces-installer-session/bootstrap.py:70:38 treefmt-check> | treefmt-check> 68 | self.token = token treefmt-check> 69 | treefmt-check> 70 | def _request(self, method, path, body=None): treefmt-check> | ^^^^ treefmt-check> 71 | data = None treefmt-check> 72 | headers = {TOKEN_HEADER: self.token} treefmt-check> | treefmt-check> treefmt-check> ANN201 Missing return type annotation for public function `ready` treefmt-check> --> packages/spaces-installer-session/bootstrap.py:84:9 treefmt-check> | treefmt-check> 82 | return err.code, err.read() treefmt-check> 83 | treefmt-check> 84 | def ready(self): treefmt-check> | ^^^^^ treefmt-check> 85 | try: treefmt-check> 86 | with urllib.request.urlopen(self.base_url + "/api/status", timeout=5) as resp: treefmt-check> | treefmt-check> help: Add return type annotation treefmt-check> treefmt-check> PLR2004 Magic value used in comparison, consider replacing `200` with a constant variable treefmt-check> --> packages/spaces-installer-session/bootstrap.py:87:39 treefmt-check> | treefmt-check> 85 | try: treefmt-check> 86 | with urllib.request.urlopen(self.base_url + "/api/status", timeout=5) as resp: treefmt-check> 87 | return resp.status == 200 treefmt-check> | ^^^ treefmt-check> 88 | except urllib.error.HTTPError as err: treefmt-check> 89 | err.close() treefmt-check> | treefmt-check> treefmt-check> ANN201 Missing return type annotation for public function `session_exists` treefmt-check> --> packages/spaces-installer-session/bootstrap.py:94:9 treefmt-check> | treefmt-check> 92 | return False treefmt-check> 93 | treefmt-check> 94 | def session_exists(self, sid): treefmt-check> | ^^^^^^^^^^^^^^ treefmt-check> 95 | status, _ = self._request("GET", f"/api/sessions/{sid}") treefmt-check> 96 | return status == 200 treefmt-check> | treefmt-check> help: Add return type annotation treefmt-check> treefmt-check> ANN001 Missing type annotation for function argument `sid` treefmt-check> --> packages/spaces-installer-session/bootstrap.py:94:30 treefmt-check> | treefmt-check> 92 | return False treefmt-check> 93 | treefmt-check> 94 | def session_exists(self, sid): treefmt-check> | ^^^ treefmt-check> 95 | status, _ = self._request("GET", f"/api/sessions/{sid}") treefmt-check> 96 | return status == 200 treefmt-check> | treefmt-check> treefmt-check> PLR2004 Magic value used in comparison, consider replacing `200` with a constant variable treefmt-check> --> packages/spaces-installer-session/bootstrap.py:96:26 treefmt-check> | treefmt-check> 94 | def session_exists(self, sid): treefmt-check> 95 | status, _ = self._request("GET", f"/api/sessions/{sid}") treefmt-check> 96 | return status == 200 treefmt-check> | ^^^ treefmt-check> 97 | treefmt-check> 98 | def find_by_title(self, title): treefmt-check> | treefmt-check> treefmt-check> ANN201 Missing return type annotation for public function `find_by_title` treefmt-check> --> packages/spaces-installer-session/bootstrap.py:98:9 treefmt-check> | treefmt-check> 96 | return status == 200 treefmt-check> 97 | treefmt-check> 98 | def find_by_title(self, title): treefmt-check> | ^^^^^^^^^^^^^ treefmt-check> 99 | # `order=recent` puts the newest activity first, so the session treefmt-check> 100 | # the user last talked to wins when several carry the title. treefmt-check> | treefmt-check> help: Add return type annotation treefmt-check> treefmt-check> ANN001 Missing type annotation for function argument `title` treefmt-check> --> packages/spaces-installer-session/bootstrap.py:98:29 treefmt-check> | treefmt-check> 96 | return status == 200 treefmt-check> 97 | treefmt-check> 98 | def find_by_title(self, title): treefmt-check> | ^^^^^ treefmt-check> 99 | # `order=recent` puts the newest activity first, so the session treefmt-check> 100 | # the user last talked to wins when several carry the title. treefmt-check> | treefmt-check> treefmt-check> PLR2004 Magic value used in comparison, consider replacing `200` with a constant variable treefmt-check> --> packages/spaces-installer-session/bootstrap.py:106:26 treefmt-check> | treefmt-check> 104 | "GET", f"/api/sessions?limit=100&offset={offset}&archived=include&order=recent" treefmt-check> 105 | ) treefmt-check> 106 | if status != 200: treefmt-check> | ^^^ treefmt-check> 107 | raise RuntimeError(f"GET /api/sessions answered {status}: {body!r}") treefmt-check> 108 | rows = body.get("sessions") or [] treefmt-check> | treefmt-check> treefmt-check> EM102 Exception must not use an f-string literal, assign to variable first treefmt-check> --> packages/spaces-installer-session/bootstrap.py:107:36 treefmt-check> | treefmt-check> 105 | ) treefmt-check> 106 | if status != 200: treefmt-check> 107 | raise RuntimeError(f"GET /api/sessions answered {status}: {body!r}") treefmt-check> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ treefmt-check> 108 | rows = body.get("sessions") or [] treefmt-check> 109 | for row in rows: treefmt-check> | treefmt-check> help: Assign to variable; remove f-string literal treefmt-check> treefmt-check> ANN201 Missing return type annotation for public function `set_title` treefmt-check> --> packages/spaces-installer-session/bootstrap.py:116:9 treefmt-check> | treefmt-check> 114 | return None treefmt-check> 115 | treefmt-check> 116 | def set_title(self, sid, title): treefmt-check> | ^^^^^^^^^ treefmt-check> 117 | status, body = self._request("PATCH", f"/api/sessions/{sid}", {"title": title}) treefmt-check> 118 | if status != 200: treefmt-check> | treefmt-check> help: Add return type annotation: `None` treefmt-check> treefmt-check> ANN001 Missing type annotation for function argument `sid` treefmt-check> --> packages/spaces-installer-session/bootstrap.py:116:25 treefmt-check> | treefmt-check> 114 | return None treefmt-check> 115 | treefmt-check> 116 | def set_title(self, sid, title): treefmt-check> | ^^^ treefmt-check> 117 | status, body = self._request("PATCH", f"/api/sessions/{sid}", {"title": title}) treefmt-check> 118 | if status != 200: treefmt-check> | treefmt-check> treefmt-check> ANN001 Missing type annotation for function argument `title` treefmt-check> --> packages/spaces-installer-session/bootstrap.py:116:30 treefmt-check> | treefmt-check> 114 | return None treefmt-check> 115 | treefmt-check> 116 | def set_title(self, sid, title): treefmt-check> | ^^^^^ treefmt-check> 117 | status, body = self._request("PATCH", f"/api/sessions/{sid}", {"title": title}) treefmt-check> 118 | if status != 200: treefmt-check> | treefmt-check> treefmt-check> PLR2004 Magic value used in comparison, consider replacing `200` with a constant variable treefmt-check> --> packages/spaces-installer-session/bootstrap.py:118:22 treefmt-check> | treefmt-check> 116 | def set_title(self, sid, title): treefmt-check> 117 | status, body = self._request("PATCH", f"/api/sessions/{sid}", {"title": title}) treefmt-check> 118 | if status != 200: treefmt-check> | ^^^ treefmt-check> 119 | raise RuntimeError(f"PATCH /api/sessions/{sid} answered {status}: {body!r}") treefmt-check> | treefmt-check> treefmt-check> EM102 Exception must not use an f-string literal, assign to variable first treefmt-check> --> packages/spaces-installer-session/bootstrap.py:119:32 treefmt-check> | treefmt-check> 117 | status, body = self._request("PATCH", f"/api/sessions/{sid}", {"title": title}) treefmt-check> 118 | if status != 200: treefmt-check> 119 | raise RuntimeError(f"PATCH /api/sessions/{sid} answered {status}: {body!r}") treefmt-check> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ treefmt-check> 120 | treefmt-check> 121 | async def _rpc(self, ws, rid, method, params): treefmt-check> | treefmt-check> help: Assign to variable; remove f-string literal treefmt-check> treefmt-check> ANN202 Missing return type annotation for private function `_rpc` treefmt-check> --> packages/spaces-installer-session/bootstrap.py:121:15 treefmt-check> | treefmt-check> 119 | raise RuntimeError(f"PATCH /api/sessions/{sid} answered {status}: {body!r}") treefmt-check> 120 | treefmt-check> 121 | async def _rpc(self, ws, rid, method, params): treefmt-check> | ^^^^ treefmt-check> 122 | await ws.send(json.dumps({"jsonrpc": "2.0", "id": rid, "method": method, "params": params})) treefmt-check> 123 | # Events (gateway.ready, message.start, ...) interleave with replies. treefmt-check> | treefmt-check> help: Add return type annotation treefmt-check> treefmt-check> ANN001 Missing type annotation for function argument `ws` treefmt-check> --> packages/spaces-installer-session/bootstrap.py:121:26 treefmt-check> | treefmt-check> 119 | raise RuntimeError(f"PATCH /api/sessions/{sid} answered {status}: {body!r}") treefmt-check> 120 | treefmt-check> 121 | async def _rpc(self, ws, rid, method, params): treefmt-check> | ^^ treefmt-check> 122 | await ws.send(json.dumps({"jsonrpc": "2.0", "id": rid, "method": method, "params": params})) treefmt-check> 123 | # Events (gateway.ready, message.start, ...) interleave with replies. treefmt-check> | treefmt-check> treefmt-check> ANN001 Missing type annotation for function argument `rid` treefmt-check> --> packages/spaces-installer-session/bootstrap.py:121:30 treefmt-check> | treefmt-check> 119 | raise RuntimeError(f"PATCH /api/sessions/{sid} answered {status}: {body!r}") treefmt-check> 120 | treefmt-check> 121 | async def _rpc(self, ws, rid, method, params): treefmt-check> | ^^^ treefmt-check> 122 | await ws.send(json.dumps({"jsonrpc": "2.0", "id": rid, "method": method, "params": params})) treefmt-check> 123 | # Events (gateway.ready, message.start, ...) interleave with replies. treefmt-check> | treefmt-check> treefmt-check> ANN001 Missing type annotation for function argument `method` treefmt-check> --> packages/spaces-installer-session/bootstrap.py:121:35 treefmt-check> | treefmt-check> 119 | raise RuntimeError(f"PATCH /api/sessions/{sid} answered {status}: {body!r}") treefmt-check> 120 | treefmt-check> 121 | async def _rpc(self, ws, rid, method, params): treefmt-check> | ^^^^^^ treefmt-check> 122 | await ws.send(json.dumps({"jsonrpc": "2.0", "id": rid, "method": method, "params": params})) treefmt-check> 123 | # Events (gateway.ready, message.start, ...) interleave with replies. treefmt-check> | treefmt-check> treefmt-check> ANN001 Missing type annotation for function argument `params` treefmt-check> --> packages/spaces-installer-session/bootstrap.py:121:43 treefmt-check> | treefmt-check> 119 | raise RuntimeError(f"PATCH /api/sessions/{sid} answered {status}: {body!r}") treefmt-check> 120 | treefmt-check> 121 | async def _rpc(self, ws, rid, method, params): treefmt-check> | ^^^^^^ treefmt-check> 122 | await ws.send(json.dumps({"jsonrpc": "2.0", "id": rid, "method": method, "params": params})) treefmt-check> 123 | # Events (gateway.ready, message.start, ...) interleave with replies. treefmt-check> | treefmt-check> treefmt-check> EM102 Exception must not use an f-string literal, assign to variable first treefmt-check> --> packages/spaces-installer-session/bootstrap.py:129:36 treefmt-check> | treefmt-check> 127 | continue treefmt-check> 128 | if "error" in frame: treefmt-check> 129 | raise RuntimeError(f"{method}: {frame['error']}") treefmt-check> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ treefmt-check> 130 | return frame.get("result") or {} treefmt-check> 131 | raise RuntimeError(f"{method}: the gateway closed the socket before it answered") treefmt-check> | treefmt-check> help: Assign to variable; remove f-string literal treefmt-check> treefmt-check> EM102 Exception must not use an f-string literal, assign to variable first treefmt-check> --> packages/spaces-installer-session/bootstrap.py:131:28 treefmt-check> | treefmt-check> 129 | raise RuntimeError(f"{method}: {frame['error']}") treefmt-check> 130 | return frame.get("result") or {} treefmt-check> 131 | raise RuntimeError(f"{method}: the gateway closed the socket before it answered") treefmt-check> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ treefmt-check> 132 | treefmt-check> 133 | async def _create_and_prompt(self, title, text): treefmt-check> | treefmt-check> help: Assign to variable; remove f-string literal treefmt-check> treefmt-check> ANN202 Missing return type annotation for private function `_create_and_prompt` treefmt-check> --> packages/spaces-installer-session/bootstrap.py:133:15 treefmt-check> | treefmt-check> 131 | raise RuntimeError(f"{method}: the gateway closed the socket before it answered") treefmt-check> 132 | treefmt-check> 133 | async def _create_and_prompt(self, title, text): treefmt-check> | ^^^^^^^^^^^^^^^^^^ treefmt-check> 134 | url = f"{self.ws_url}?token={self.token}" treefmt-check> 135 | async with connect(url, open_timeout=30) as ws: treefmt-check> | treefmt-check> help: Add return type annotation treefmt-check> treefmt-check> ANN001 Missing type annotation for function argument `title` treefmt-check> --> packages/spaces-installer-session/bootstrap.py:133:40 treefmt-check> | treefmt-check> 131 | raise RuntimeError(f"{method}: the gateway closed the socket before it answered") treefmt-check> 132 | treefmt-check> 133 | async def _create_and_prompt(self, title, text): treefmt-check> | ^^^^^ treefmt-check> 134 | url = f"{self.ws_url}?token={self.token}" treefmt-check> 135 | async with connect(url, open_timeout=30) as ws: treefmt-check> | treefmt-check> treefmt-check> ANN001 Missing type annotation for function argument `text` treefmt-check> --> packages/spaces-installer-session/bootstrap.py:133:47 treefmt-check> | treefmt-check> 131 | raise RuntimeError(f"{method}: the gateway closed the socket before it answered") treefmt-check> 132 | treefmt-check> 133 | async def _create_and_prompt(self, title, text): treefmt-check> | ^^^^ treefmt-check> 134 | url = f"{self.ws_url}?token={self.token}" treefmt-check> 135 | async with connect(url, open_timeout=30) as ws: treefmt-check> | treefmt-check> treefmt-check> EM102 Exception must not use an f-string literal, assign to variable first treefmt-check> --> packages/spaces-installer-session/bootstrap.py:140:36 treefmt-check> | treefmt-check> 138 | stored_id = created.get("stored_session_id") treefmt-check> 139 | if not runtime_id or not stored_id: treefmt-check> 140 | raise RuntimeError(f"session.create returned no ids: {created!r}") treefmt-check> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ treefmt-check> 141 | await self._rpc(ws, 2, "prompt.submit", {"session_id": runtime_id, "text": text}) treefmt-check> 142 | return stored_id treefmt-check> | treefmt-check> help: Assign to variable; remove f-string literal treefmt-check> treefmt-check> ANN201 Missing return type annotation for public function `create_and_prompt` treefmt-check> --> packages/spaces-installer-session/bootstrap.py:144:9 treefmt-check> | treefmt-check> 142 | return stored_id treefmt-check> 143 | treefmt-check> 144 | def create_and_prompt(self, title, text): treefmt-check> | ^^^^^^^^^^^^^^^^^ treefmt-check> 145 | return asyncio.run(self._create_and_prompt(title, text)) treefmt-check> | treefmt-check> help: Add return type annotation treefmt-check> treefmt-check> ANN001 Missing type annotation for function argument `title` treefmt-check> --> packages/spaces-installer-session/bootstrap.py:144:33 treefmt-check> | treefmt-check> 142 | return stored_id treefmt-check> 143 | treefmt-check> 144 | def create_and_prompt(self, title, text): treefmt-check> | ^^^^^ treefmt-check> 145 | return asyncio.run(self._create_and_prompt(title, text)) treefmt-check> | treefmt-check> treefmt-check> ANN001 Missing type annotation for function argument `text` treefmt-check> --> packages/spaces-installer-session/bootstrap.py:144:40 treefmt-check> | treefmt-check> 142 | return stored_id treefmt-check> 143 | treefmt-check> 144 | def create_and_prompt(self, title, text): treefmt-check> | ^^^^ treefmt-check> 145 | return asyncio.run(self._create_and_prompt(title, text)) treefmt-check> | treefmt-check> treefmt-check> ANN201 Missing return type annotation for public function `parse_args` treefmt-check> --> packages/spaces-installer-session/bootstrap.py:148:5 treefmt-check> | treefmt-check> 148 | def parse_args(argv): treefmt-check> | ^^^^^^^^^^ treefmt-check> 149 | p = argparse.ArgumentParser(description="open the install conversation once per boot") treefmt-check> 150 | p.add_argument("--base-url", required=True, help="dashboard URL, http://127.0.0.1:") treefmt-check> | treefmt-check> help: Add return type annotation treefmt-check> treefmt-check> ANN001 Missing type annotation for function argument `argv` treefmt-check> --> packages/spaces-installer-session/bootstrap.py:148:16 treefmt-check> | treefmt-check> 148 | def parse_args(argv): treefmt-check> | ^^^^ treefmt-check> 149 | p = argparse.ArgumentParser(description="open the install conversation once per boot") treefmt-check> 150 | p.add_argument("--base-url", required=True, help="dashboard URL, http://127.0.0.1:") treefmt-check> | treefmt-check> treefmt-check> PTH118 `os.path.join()` should be replaced by `Path` with `/` operator treefmt-check> --> packages/spaces-installer-session/bootstrap.py:154:17 treefmt-check> | treefmt-check> 152 | p.add_argument( treefmt-check> 153 | "--state-file", treefmt-check> 154 | default=os.path.join(os.environ.get("XDG_RUNTIME_DIR", "/run/user/%d" % os.getuid()), "spaces-installer", "session"), treefmt-check> | ^^^^^^^^^^^^ treefmt-check> 155 | help="where the stored session id is recorded", treefmt-check> 156 | ) treefmt-check> | treefmt-check> treefmt-check> UP031 Use format specifiers instead of percent format treefmt-check> --> packages/spaces-installer-session/bootstrap.py:154:64 treefmt-check> | treefmt-check> 152 | p.add_argument( treefmt-check> 153 | "--state-file", treefmt-check> 154 | default=os.path.join(os.environ.get("XDG_RUNTIME_DIR", "/run/user/%d" % os.getuid()), "spaces-installer", "session"), treefmt-check> | ^^^^^^^^^^^^^^ treefmt-check> 155 | help="where the stored session id is recorded", treefmt-check> 156 | ) treefmt-check> | treefmt-check> help: Replace with format specifiers treefmt-check> treefmt-check> ANN201 Missing return type annotation for public function `record` treefmt-check> --> packages/spaces-installer-session/bootstrap.py:165:5 treefmt-check> | treefmt-check> 165 | def record(state_file, sid): treefmt-check> | ^^^^^^ treefmt-check> 166 | path = Path(state_file) treefmt-check> 167 | path.parent.mkdir(parents=True, exist_ok=True) treefmt-check> | treefmt-check> help: Add return type annotation: `None` treefmt-check> treefmt-check> ANN001 Missing type annotation for function argument `state_file` treefmt-check> --> packages/spaces-installer-session/bootstrap.py:165:12 treefmt-check> | treefmt-check> 165 | def record(state_file, sid): treefmt-check> | ^^^^^^^^^^ treefmt-check> 166 | path = Path(state_file) treefmt-check> 167 | path.parent.mkdir(parents=True, exist_ok=True) treefmt-check> | treefmt-check> treefmt-check> ANN001 Missing type annotation for function argument `sid` treefmt-check> --> packages/spaces-installer-session/bootstrap.py:165:24 treefmt-check> | treefmt-check> 165 | def record(state_file, sid): treefmt-check> | ^^^ treefmt-check> 166 | path = Path(state_file) treefmt-check> 167 | path.parent.mkdir(parents=True, exist_ok=True) treefmt-check> | treefmt-check> treefmt-check> PTH105 `os.replace()` should be replaced by `Path.replace()` treefmt-check> --> packages/spaces-installer-session/bootstrap.py:170:5 treefmt-check> | treefmt-check> 168 | tmp = path.with_name(path.name + ".tmp") treefmt-check> 169 | tmp.write_text(sid) treefmt-check> 170 | os.replace(tmp, path) treefmt-check> | ^^^^^^^^^^ treefmt-check> help: Replace with `Path(...).replace(...)` treefmt-check> treefmt-check> ANN201 Missing return type annotation for public function `main` treefmt-check> --> packages/spaces-installer-session/bootstrap.py:173:5 treefmt-check> | treefmt-check> 173 | def main(argv=None): treefmt-check> | ^^^^ treefmt-check> 174 | args = parse_args(argv) treefmt-check> 175 | try: treefmt-check> | treefmt-check> help: Add return type annotation: `int | None` treefmt-check> treefmt-check> ANN001 Missing type annotation for function argument `argv` treefmt-check> --> packages/spaces-installer-session/bootstrap.py:173:10 treefmt-check> | treefmt-check> 173 | def main(argv=None): treefmt-check> | ^^^^ treefmt-check> 174 | args = parse_args(argv) treefmt-check> 175 | try: treefmt-check> | treefmt-check> treefmt-check> TRY300 Consider moving this statement to an `else` block treefmt-check> --> packages/spaces-installer-session/bootstrap.py:209:9 treefmt-check> | treefmt-check> 207 | log(f"created session {sid} titled {args.title!r}") treefmt-check> 208 | record(args.state_file, sid) treefmt-check> 209 | return 0 treefmt-check> | ^^^^^^^^ treefmt-check> 210 | except (RuntimeError, OSError, WebSocketException, ValueError) as err: treefmt-check> 211 | log(str(err)) treefmt-check> | treefmt-check> treefmt-check> Found 80 errors (19 fixed, 61 remaining). treefmt-check> No fixes available (13 hidden fixes can be enabled with the `--unsafe-fixes` option). treefmt-check> treefmt-check> ERRO formatter | shellcheck: failed to apply with options '[]': exit status 1 treefmt-check> treefmt-check> treefmt-check> In packages/spaces-install-secret/spaces-install-secret.sh line 1: treefmt-check> # Usage: spaces-install-secret password|luks-passphrase treefmt-check> ^-- SC2148 (error): Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive. treefmt-check> treefmt-check> For more information: treefmt-check> https://www.shellcheck.net/wiki/SC2148 -- Tips depend on target shell and y... treefmt-check> treefmt-check> traversed 596 files treefmt-check> emitted 398 files for processing treefmt-check> formatted 239 files (14 changed) in 910ms treefmt-check> Error: failed to finalise formatting: formatting failures detected error: Cannot build '/nix/store/fkxj1mpwbwa31cwqsvqfx8zx4z8jyyc8-treefmt-check.drv'. Reason: builder failed with exit code 1. Output paths: /nix/store/j6qv2p64razribv3kdnbprf8q714y9z5-treefmt-check Last 25 log lines: > 207 | log(f"created session {sid} titled {args.title!r}") > 208 | record(args.state_file, sid) > 209 | return 0 > | ^^^^^^^^ > 210 | except (RuntimeError, OSError, WebSocketException, ValueError) as err: > 211 | log(str(err)) > | > > Found 80 errors (19 fixed, 61 remaining). > No fixes available (13 hidden fixes can be enabled with the `--unsafe-fixes` option). > > ERRO formatter | shellcheck: failed to apply with options '[]': exit status 1 > > > In packages/spaces-install-secret/spaces-install-secret.sh line 1: > # Usage: spaces-install-secret password|luks-passphrase > ^-- SC2148 (error): Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive. > > For more information: > https://www.shellcheck.net/wiki/SC2148 -- Tips depend on target shell and y... > > traversed 596 files > emitted 398 files for processing > formatted 239 files (14 changed) in 910ms > Error: failed to finalise formatting: formatting failures detected For full logs, run: nix log /nix/store/fkxj1mpwbwa31cwqsvqfx8zx4z8jyyc8-treefmt-check.drv