this derivation will be built: /nix/store/cix8gxwwlzlzh8f0zxvw1yscbmin83w7-treefmt-check.drv building '/nix/store/cix8gxwwlzlzh8f0zxvw1yscbmin83w7-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> S107 Possible hardcoded password assigned to function default: "token" treefmt-check> --> checks/hermes-desktop-connections/test.py:21:30 treefmt-check> | treefmt-check> 21 | def run(script, *args, token="tok-1"): treefmt-check> | ^^^^^^^ treefmt-check> 22 | return subprocess.run( treefmt-check> 23 | [script, "--url", URL, *args], treefmt-check> | treefmt-check> treefmt-check> SIM112 Use capitalized environment variable `WITHREMOTES` instead of `withRemotes` treefmt-check> --> checks/hermes-desktop-connections/test.py:49:27 treefmt-check> | treefmt-check> 49 | with_remotes = os.environ["withRemotes"] treefmt-check> | ^^^^^^^^^^^^^ treefmt-check> 50 | office_only = os.environ["officeOnly"] treefmt-check> 51 | enforcing = os.environ["enforcing"] treefmt-check> | treefmt-check> help: Replace `withRemotes` with `WITHREMOTES` treefmt-check> treefmt-check> SIM112 Use capitalized environment variable `OFFICEONLY` instead of `officeOnly` treefmt-check> --> checks/hermes-desktop-connections/test.py:50:26 treefmt-check> | treefmt-check> 49 | with_remotes = os.environ["withRemotes"] treefmt-check> 50 | office_only = os.environ["officeOnly"] treefmt-check> | ^^^^^^^^^^^^ treefmt-check> 51 | enforcing = os.environ["enforcing"] treefmt-check> | treefmt-check> help: Replace `officeOnly` with `OFFICEONLY` treefmt-check> treefmt-check> SIM112 Use capitalized environment variable `ENFORCING` instead of `enforcing` treefmt-check> --> checks/hermes-desktop-connections/test.py:51:24 treefmt-check> | treefmt-check> 49 | with_remotes = os.environ["withRemotes"] treefmt-check> 50 | office_only = os.environ["officeOnly"] treefmt-check> 51 | enforcing = os.environ["enforcing"] treefmt-check> | ^^^^^^^^^^^ treefmt-check> 52 | treefmt-check> 53 | # Fresh render. treefmt-check> | treefmt-check> help: Replace `enforcing` with `ENFORCING` treefmt-check> treefmt-check> S106 Possible hardcoded password assigned to argument: "token" treefmt-check> --> checks/hermes-desktop-connections/test.py:108:18 treefmt-check> | treefmt-check> 107 | # A token change reaches both files on the next launch. treefmt-check> 108 | run(office_only, token="tok-2") treefmt-check> | ^^^^^^^^^^^^^ treefmt-check> 109 | check(load(CONNECTION)["remote"]["token"]["value"] == "tok-2", "connection.json follows the token") treefmt-check> 110 | check(load(REGISTRY)["connections"][1]["token"]["value"] == "tok-2", "registry follows the token") treefmt-check> | treefmt-check> treefmt-check> S106 Possible hardcoded password assigned to argument: "token" treefmt-check> --> checks/hermes-desktop-connections/test.py:114:22 treefmt-check> | treefmt-check> 112 | # connection.json saved in the app stays, and the launcher says so. treefmt-check> 113 | CONNECTION.write_text(json.dumps({"mode": "local", "profiles": {}})) treefmt-check> 114 | r = run(office_only, token="tok-2") treefmt-check> | ^^^^^^^^^^^^^ treefmt-check> 115 | check(load(CONNECTION)["mode"] == "local", "user gateway left alone") treefmt-check> 116 | check(str(CONNECTION) in r.stderr and "--reset-connections" in r.stderr, f"stderr names the file: {r.stderr!r}") treefmt-check> | treefmt-check> treefmt-check> S106 Possible hardcoded password assigned to argument: "token" treefmt-check> --> checks/hermes-desktop-connections/test.py:120:29 treefmt-check> | treefmt-check> 119 | # --reset restores it; the user's registry entry survives the reset. treefmt-check> 120 | run(office_only, "--reset", token="tok-2") treefmt-check> | ^^^^^^^^^^^^^ treefmt-check> 121 | check(load(CONNECTION)["mode"] == "remote", "reset restores the managed gateway") treefmt-check> 122 | check("mine" in ids(load(REGISTRY)), "user entry survives reset") treefmt-check> | treefmt-check> treefmt-check> S106 Possible hardcoded password assigned to argument: "token" treefmt-check> --> checks/hermes-desktop-connections/test.py:126:20 treefmt-check> | treefmt-check> 124 | # enforcePrimary overwrites a user gateway without a reset. treefmt-check> 125 | CONNECTION.write_text(json.dumps({"mode": "local", "profiles": {}})) treefmt-check> 126 | r = run(enforcing, token="tok-2") treefmt-check> | ^^^^^^^^^^^^^ treefmt-check> 127 | check(load(CONNECTION)["remote"]["url"] == URL and r.stderr == "", "enforcePrimary overwrites") treefmt-check> | treefmt-check> treefmt-check> S106 Possible hardcoded password assigned to argument: "token" treefmt-check> --> checks/hermes-desktop-connections/test.py:132:18 treefmt-check> | treefmt-check> 130 | SIDECAR.unlink() treefmt-check> 131 | CONNECTION.write_text(json.dumps({"mode": "local", "profiles": {}})) treefmt-check> 132 | run(office_only, token="tok-2") treefmt-check> | ^^^^^^^^^^^^^ treefmt-check> 133 | check(load(CONNECTION)["mode"] == "remote", "first adoption takes over a stray connection.json") treefmt-check> | treefmt-check> treefmt-check> S106 Possible hardcoded password assigned to argument: "token" treefmt-check> --> checks/hermes-desktop-connections/test.py:140:18 treefmt-check> | treefmt-check> 138 | REGISTRY.unlink() treefmt-check> 139 | REGISTRY.symlink_to(target) treefmt-check> 140 | run(office_only, token="tok-2") treefmt-check> | ^^^^^^^^^^^^^ treefmt-check> 141 | check(not REGISTRY.is_symlink() and REGISTRY.is_file() and mode(REGISTRY) == 0o600, "symlink replaced by a regular file") treefmt-check> 142 | check(load(target)["connections"] == [], "symlink target untouched") treefmt-check> | treefmt-check> treefmt-check> S106 Possible hardcoded password assigned to argument: "token" treefmt-check> --> checks/hermes-desktop-connections/test.py:146:18 treefmt-check> | treefmt-check> 144 | # Garbage in the registry is not fatal. treefmt-check> 145 | REGISTRY.write_text("{not json") treefmt-check> 146 | run(office_only, token="tok-2") treefmt-check> | ^^^^^^^^^^^^^ treefmt-check> 147 | check(ids(load(REGISTRY)) == ["local", "nix-this-machine", "nix-office"], "unparsable registry is rebuilt") treefmt-check> | treefmt-check> treefmt-check> ANN201 Missing return type annotation for public function `warn` treefmt-check> --> modules/nixos/hermes/desktop-connections.py:48:5 treefmt-check> | treefmt-check> 48 | def warn(msg): treefmt-check> | ^^^^ treefmt-check> 49 | print(f"hermes-desktop-connections: {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> --> modules/nixos/hermes/desktop-connections.py:48:10 treefmt-check> | treefmt-check> 48 | def warn(msg): treefmt-check> | ^^^ treefmt-check> 49 | print(f"hermes-desktop-connections: {msg}", file=sys.stderr) treefmt-check> | treefmt-check> treefmt-check> ANN201 Missing return type annotation for public function `load_json` treefmt-check> --> modules/nixos/hermes/desktop-connections.py:52:5 treefmt-check> | treefmt-check> 52 | def load_json(path): treefmt-check> | ^^^^^^^^^ treefmt-check> 53 | try: treefmt-check> 54 | with open(path, encoding="utf-8") as f: treefmt-check> | treefmt-check> help: Add return type annotation treefmt-check> treefmt-check> ANN001 Missing type annotation for function argument `path` treefmt-check> --> modules/nixos/hermes/desktop-connections.py:52:15 treefmt-check> | treefmt-check> 52 | def load_json(path): treefmt-check> | ^^^^ treefmt-check> 53 | try: treefmt-check> 54 | with open(path, encoding="utf-8") as f: treefmt-check> | treefmt-check> treefmt-check> PTH123 `open()` should be replaced by `Path.open()` treefmt-check> --> modules/nixos/hermes/desktop-connections.py:54:14 treefmt-check> | treefmt-check> 52 | def load_json(path): treefmt-check> 53 | try: treefmt-check> 54 | with open(path, encoding="utf-8") as f: treefmt-check> | ^^^^ treefmt-check> 55 | return json.load(f) treefmt-check> 56 | except (OSError, ValueError): treefmt-check> | treefmt-check> help: Replace with `Path.open()` treefmt-check> treefmt-check> ANN201 Missing return type annotation for public function `read_bytes` treefmt-check> --> modules/nixos/hermes/desktop-connections.py:60:5 treefmt-check> | treefmt-check> 60 | def read_bytes(path): treefmt-check> | ^^^^^^^^^^ treefmt-check> 61 | try: treefmt-check> 62 | with open(path, "rb") as f: treefmt-check> | treefmt-check> help: Add return type annotation treefmt-check> treefmt-check> ANN001 Missing type annotation for function argument `path` treefmt-check> --> modules/nixos/hermes/desktop-connections.py:60:16 treefmt-check> | treefmt-check> 60 | def read_bytes(path): treefmt-check> | ^^^^ treefmt-check> 61 | try: treefmt-check> 62 | with open(path, "rb") as f: treefmt-check> | treefmt-check> treefmt-check> PTH123 `open()` should be replaced by `Path.open()` treefmt-check> --> modules/nixos/hermes/desktop-connections.py:62:14 treefmt-check> | treefmt-check> 60 | def read_bytes(path): treefmt-check> 61 | try: treefmt-check> 62 | with open(path, "rb") as f: treefmt-check> | ^^^^ treefmt-check> 63 | return f.read() treefmt-check> 64 | except OSError: treefmt-check> | treefmt-check> help: Replace with `Path.open()` treefmt-check> treefmt-check> ANN201 Missing return type annotation for public function `render` treefmt-check> --> modules/nixos/hermes/desktop-connections.py:68:5 treefmt-check> | treefmt-check> 68 | def render(value): treefmt-check> | ^^^^^^ treefmt-check> 69 | return (json.dumps(value, indent=2) + "\n").encode("utf-8") treefmt-check> | treefmt-check> help: Add return type annotation treefmt-check> treefmt-check> ANN001 Missing type annotation for function argument `value` treefmt-check> --> modules/nixos/hermes/desktop-connections.py:68:12 treefmt-check> | treefmt-check> 68 | def render(value): treefmt-check> | ^^^^^ treefmt-check> 69 | return (json.dumps(value, indent=2) + "\n").encode("utf-8") treefmt-check> | treefmt-check> treefmt-check> ANN201 Missing return type annotation for public function `sha256` treefmt-check> --> modules/nixos/hermes/desktop-connections.py:72:5 treefmt-check> | treefmt-check> 72 | def sha256(data): treefmt-check> | ^^^^^^ treefmt-check> 73 | return hashlib.sha256(data).hexdigest() treefmt-check> | treefmt-check> help: Add return type annotation treefmt-check> treefmt-check> ANN001 Missing type annotation for function argument `data` treefmt-check> --> modules/nixos/hermes/desktop-connections.py:72:12 treefmt-check> | treefmt-check> 72 | def sha256(data): treefmt-check> | ^^^^ treefmt-check> 73 | return hashlib.sha256(data).hexdigest() treefmt-check> | treefmt-check> treefmt-check> ANN201 Missing return type annotation for public function `write_private` treefmt-check> --> modules/nixos/hermes/desktop-connections.py:76:5 treefmt-check> | treefmt-check> 76 | def write_private(path, data): treefmt-check> | ^^^^^^^^^^^^^ treefmt-check> 77 | """Regular file, 0600, replaced atomically. Skips a byte-identical file.""" treefmt-check> 78 | if not os.path.islink(path) and read_bytes(path) == data: treefmt-check> | treefmt-check> help: Add return type annotation: `None` treefmt-check> treefmt-check> ANN001 Missing type annotation for function argument `path` treefmt-check> --> modules/nixos/hermes/desktop-connections.py:76:19 treefmt-check> | treefmt-check> 76 | def write_private(path, data): treefmt-check> | ^^^^ treefmt-check> 77 | """Regular file, 0600, replaced atomically. Skips a byte-identical file.""" treefmt-check> 78 | if not os.path.islink(path) and read_bytes(path) == data: treefmt-check> | treefmt-check> treefmt-check> ANN001 Missing type annotation for function argument `data` treefmt-check> --> modules/nixos/hermes/desktop-connections.py:76:25 treefmt-check> | treefmt-check> 76 | def write_private(path, data): treefmt-check> | ^^^^ treefmt-check> 77 | """Regular file, 0600, replaced atomically. Skips a byte-identical file.""" treefmt-check> 78 | if not os.path.islink(path) and read_bytes(path) == data: treefmt-check> | treefmt-check> treefmt-check> PTH114 `os.path.islink()` should be replaced by `Path.is_symlink()` treefmt-check> --> modules/nixos/hermes/desktop-connections.py:78:12 treefmt-check> | treefmt-check> 76 | def write_private(path, data): treefmt-check> 77 | """Regular file, 0600, replaced atomically. Skips a byte-identical file.""" treefmt-check> 78 | if not os.path.islink(path) and read_bytes(path) == data: treefmt-check> | ^^^^^^^^^^^^^^ treefmt-check> 79 | return treefmt-check> 80 | directory = os.path.dirname(path) treefmt-check> | treefmt-check> help: Replace with `Path(...).is_symlink()` treefmt-check> treefmt-check> PTH120 `os.path.dirname()` should be replaced by `Path.parent` treefmt-check> --> modules/nixos/hermes/desktop-connections.py:80:17 treefmt-check> | treefmt-check> 78 | if not os.path.islink(path) and read_bytes(path) == data: treefmt-check> 79 | return treefmt-check> 80 | directory = os.path.dirname(path) treefmt-check> | ^^^^^^^^^^^^^^^ treefmt-check> 81 | os.makedirs(directory, mode=0o700, exist_ok=True) treefmt-check> 82 | if os.path.islink(path): treefmt-check> | treefmt-check> help: Replace with `Path(...).parent` treefmt-check> treefmt-check> PTH103 `os.makedirs()` should be replaced by `Path.mkdir(parents=True)` treefmt-check> --> modules/nixos/hermes/desktop-connections.py:81:5 treefmt-check> | treefmt-check> 79 | return treefmt-check> 80 | directory = os.path.dirname(path) treefmt-check> 81 | os.makedirs(directory, mode=0o700, exist_ok=True) treefmt-check> | ^^^^^^^^^^^ treefmt-check> 82 | if os.path.islink(path): treefmt-check> 83 | os.unlink(path) treefmt-check> | treefmt-check> help: Replace with `Path(...).mkdir(parents=True)` treefmt-check> treefmt-check> PTH114 `os.path.islink()` should be replaced by `Path.is_symlink()` treefmt-check> --> modules/nixos/hermes/desktop-connections.py:82:8 treefmt-check> | treefmt-check> 80 | directory = os.path.dirname(path) treefmt-check> 81 | os.makedirs(directory, mode=0o700, exist_ok=True) treefmt-check> 82 | if os.path.islink(path): treefmt-check> | ^^^^^^^^^^^^^^ treefmt-check> 83 | os.unlink(path) treefmt-check> 84 | fd, tmp = tempfile.mkstemp(dir=directory, prefix=".", suffix=".tmp") treefmt-check> | treefmt-check> help: Replace with `Path(...).is_symlink()` treefmt-check> treefmt-check> PTH108 `os.unlink()` should be replaced by `Path.unlink()` treefmt-check> --> modules/nixos/hermes/desktop-connections.py:83:9 treefmt-check> | treefmt-check> 81 | os.makedirs(directory, mode=0o700, exist_ok=True) treefmt-check> 82 | if os.path.islink(path): treefmt-check> 83 | os.unlink(path) treefmt-check> | ^^^^^^^^^ treefmt-check> 84 | fd, tmp = tempfile.mkstemp(dir=directory, prefix=".", suffix=".tmp") treefmt-check> 85 | try: treefmt-check> | treefmt-check> help: Replace with `Path(...).unlink()` treefmt-check> treefmt-check> PTH101 `os.chmod()` should be replaced by `Path.chmod()` treefmt-check> --> modules/nixos/hermes/desktop-connections.py:88:9 treefmt-check> | treefmt-check> 86 | with os.fdopen(fd, "wb") as f: treefmt-check> 87 | f.write(data) treefmt-check> 88 | os.chmod(tmp, 0o600) treefmt-check> | ^^^^^^^^ treefmt-check> 89 | os.replace(tmp, path) treefmt-check> 90 | except BaseException: treefmt-check> | treefmt-check> help: Replace with `Path(...).chmod(...)` treefmt-check> treefmt-check> PTH105 `os.replace()` should be replaced by `Path.replace()` treefmt-check> --> modules/nixos/hermes/desktop-connections.py:89:9 treefmt-check> | treefmt-check> 87 | f.write(data) treefmt-check> 88 | os.chmod(tmp, 0o600) treefmt-check> 89 | os.replace(tmp, path) treefmt-check> | ^^^^^^^^^^ treefmt-check> 90 | except BaseException: treefmt-check> 91 | os.unlink(tmp) treefmt-check> | treefmt-check> help: Replace with `Path(...).replace(...)` treefmt-check> treefmt-check> PTH108 `os.unlink()` should be replaced by `Path.unlink()` treefmt-check> --> modules/nixos/hermes/desktop-connections.py:91:9 treefmt-check> | treefmt-check> 89 | os.replace(tmp, path) treefmt-check> 90 | except BaseException: treefmt-check> 91 | os.unlink(tmp) treefmt-check> | ^^^^^^^^^ treefmt-check> 92 | raise treefmt-check> | treefmt-check> help: Replace with `Path(...).unlink()` treefmt-check> treefmt-check> ANN201 Missing return type annotation for public function `remove` treefmt-check> --> modules/nixos/hermes/desktop-connections.py:95:5 treefmt-check> | treefmt-check> 95 | def remove(path): treefmt-check> | ^^^^^^ treefmt-check> 96 | try: treefmt-check> 97 | os.unlink(path) treefmt-check> | treefmt-check> help: Add return type annotation: `None` treefmt-check> treefmt-check> ANN001 Missing type annotation for function argument `path` treefmt-check> --> modules/nixos/hermes/desktop-connections.py:95:12 treefmt-check> | treefmt-check> 95 | def remove(path): treefmt-check> | ^^^^ treefmt-check> 96 | try: treefmt-check> 97 | os.unlink(path) treefmt-check> | treefmt-check> treefmt-check> SIM105 Use `contextlib.suppress(FileNotFoundError)` instead of `try`-`except`-`pass` treefmt-check> --> modules/nixos/hermes/desktop-connections.py:96:5 treefmt-check> | treefmt-check> 95 | def remove(path): treefmt-check> 96 | / try: treefmt-check> 97 | | os.unlink(path) treefmt-check> 98 | | except FileNotFoundError: treefmt-check> 99 | | pass treefmt-check> | |____________^ treefmt-check> help: Replace `try`-`except`-`pass` with `with contextlib.suppress(FileNotFoundError): ...` treefmt-check> treefmt-check> PTH108 `os.unlink()` should be replaced by `Path.unlink()` treefmt-check> --> modules/nixos/hermes/desktop-connections.py:97:9 treefmt-check> | treefmt-check> 95 | def remove(path): treefmt-check> 96 | try: treefmt-check> 97 | os.unlink(path) treefmt-check> | ^^^^^^^^^ treefmt-check> 98 | except FileNotFoundError: treefmt-check> 99 | pass treefmt-check> | treefmt-check> help: Replace with `Path(...).unlink()` treefmt-check> treefmt-check> ANN201 Missing return type annotation for public function `plain_token` treefmt-check> --> modules/nixos/hermes/desktop-connections.py:102:5 treefmt-check> | treefmt-check> 102 | def plain_token(value): treefmt-check> | ^^^^^^^^^^^ treefmt-check> 103 | return {"encoding": "plain", "value": value} treefmt-check> | treefmt-check> help: Add return type annotation treefmt-check> treefmt-check> ANN001 Missing type annotation for function argument `value` treefmt-check> --> modules/nixos/hermes/desktop-connections.py:102:17 treefmt-check> | treefmt-check> 102 | def plain_token(value): treefmt-check> | ^^^^^ treefmt-check> 103 | return {"encoding": "plain", "value": value} treefmt-check> | treefmt-check> treefmt-check> ANN201 Missing return type annotation for public function `managed_entries` treefmt-check> --> modules/nixos/hermes/desktop-connections.py:106:5 treefmt-check> | treefmt-check> 106 | def managed_entries(spec, url, token): treefmt-check> | ^^^^^^^^^^^^^^^ treefmt-check> 107 | entries = [ treefmt-check> 108 | dict(LOCAL_ENTRY), treefmt-check> | treefmt-check> help: Add return type annotation treefmt-check> treefmt-check> ANN001 Missing type annotation for function argument `spec` treefmt-check> --> modules/nixos/hermes/desktop-connections.py:106:21 treefmt-check> | treefmt-check> 106 | def managed_entries(spec, url, token): treefmt-check> | ^^^^ treefmt-check> 107 | entries = [ treefmt-check> 108 | dict(LOCAL_ENTRY), treefmt-check> | treefmt-check> treefmt-check> ANN001 Missing type annotation for function argument `url` treefmt-check> --> modules/nixos/hermes/desktop-connections.py:106:27 treefmt-check> | treefmt-check> 106 | def managed_entries(spec, url, token): treefmt-check> | ^^^ treefmt-check> 107 | entries = [ treefmt-check> 108 | dict(LOCAL_ENTRY), treefmt-check> | treefmt-check> treefmt-check> ANN001 Missing type annotation for function argument `token` treefmt-check> --> modules/nixos/hermes/desktop-connections.py:106:32 treefmt-check> | treefmt-check> 106 | def managed_entries(spec, url, token): treefmt-check> | ^^^^^ treefmt-check> 107 | entries = [ treefmt-check> 108 | dict(LOCAL_ENTRY), treefmt-check> | treefmt-check> treefmt-check> PTH123 `open()` should be replaced by `Path.open()` treefmt-check> --> modules/nixos/hermes/desktop-connections.py:128:26 treefmt-check> | treefmt-check> 126 | token_file = remote["tokenFile"] treefmt-check> 127 | try: treefmt-check> 128 | with open(token_file, encoding="utf-8") as f: treefmt-check> | ^^^^ treefmt-check> 129 | value = f.read().strip() treefmt-check> 130 | except OSError as e: treefmt-check> | treefmt-check> help: Replace with `Path.open()` treefmt-check> treefmt-check> ANN201 Missing return type annotation for public function `merge_registry` treefmt-check> --> modules/nixos/hermes/desktop-connections.py:138:5 treefmt-check> | treefmt-check> 138 | def merge_registry(existing, managed, stale_ids): treefmt-check> | ^^^^^^^^^^^^^^ treefmt-check> 139 | if not isinstance(existing, dict) or existing.get("version") != 2: treefmt-check> 140 | existing = {} treefmt-check> | treefmt-check> help: Add return type annotation treefmt-check> treefmt-check> ANN001 Missing type annotation for function argument `existing` treefmt-check> --> modules/nixos/hermes/desktop-connections.py:138:20 treefmt-check> | treefmt-check> 138 | def merge_registry(existing, managed, stale_ids): treefmt-check> | ^^^^^^^^ treefmt-check> 139 | if not isinstance(existing, dict) or existing.get("version") != 2: treefmt-check> 140 | existing = {} treefmt-check> | treefmt-check> treefmt-check> ANN001 Missing type annotation for function argument `managed` treefmt-check> --> modules/nixos/hermes/desktop-connections.py:138:30 treefmt-check> | treefmt-check> 138 | def merge_registry(existing, managed, stale_ids): treefmt-check> | ^^^^^^^ treefmt-check> 139 | if not isinstance(existing, dict) or existing.get("version") != 2: treefmt-check> 140 | existing = {} treefmt-check> | treefmt-check> treefmt-check> ANN001 Missing type annotation for function argument `stale_ids` treefmt-check> --> modules/nixos/hermes/desktop-connections.py:138:39 treefmt-check> | treefmt-check> 138 | def merge_registry(existing, managed, stale_ids): treefmt-check> | ^^^^^^^^^ treefmt-check> 139 | if not isinstance(existing, dict) or existing.get("version") != 2: treefmt-check> 140 | existing = {} treefmt-check> | treefmt-check> treefmt-check> PLR2004 Magic value used in comparison, consider replacing `2` with a constant variable treefmt-check> --> modules/nixos/hermes/desktop-connections.py:139:69 treefmt-check> | treefmt-check> 138 | def merge_registry(existing, managed, stale_ids): treefmt-check> 139 | if not isinstance(existing, dict) or existing.get("version") != 2: treefmt-check> | ^ treefmt-check> 140 | existing = {} treefmt-check> 141 | old = existing.get("connections") treefmt-check> | treefmt-check> treefmt-check> ANN201 Missing return type annotation for public function `main` treefmt-check> --> modules/nixos/hermes/desktop-connections.py:163:5 treefmt-check> | treefmt-check> 163 | def main(): treefmt-check> | ^^^^ treefmt-check> 164 | parser = argparse.ArgumentParser() treefmt-check> 165 | parser.add_argument("--spec", required=True) treefmt-check> | treefmt-check> help: Add return type annotation: `int` treefmt-check> treefmt-check> PTH123 `open()` should be replaced by `Path.open()` treefmt-check> --> modules/nixos/hermes/desktop-connections.py:170:10 treefmt-check> | treefmt-check> 168 | args = parser.parse_args() treefmt-check> 169 | treefmt-check> 170 | with open(args.spec, encoding="utf-8") as f: treefmt-check> | ^^^^ treefmt-check> 171 | spec = json.load(f) treefmt-check> 172 | token = sys.stdin.read().strip() treefmt-check> | treefmt-check> help: Replace with `Path.open()` treefmt-check> treefmt-check> PTH118 `os.path.join()` should be replaced by `Path` with `/` operator treefmt-check> --> modules/nixos/hermes/desktop-connections.py:177:56 treefmt-check> | treefmt-check> 175 | return 1 treefmt-check> 176 | treefmt-check> 177 | config_home = os.environ.get("XDG_CONFIG_HOME") or os.path.join(os.environ["HOME"], ".config") treefmt-check> | ^^^^^^^^^^^^ treefmt-check> 178 | hermes_dir = os.path.join(config_home, "Hermes") treefmt-check> 179 | registry_path = os.path.join(hermes_dir, "connections.json") treefmt-check> | treefmt-check> treefmt-check> PTH118 `os.path.join()` should be replaced by `Path` with `/` operator treefmt-check> --> modules/nixos/hermes/desktop-connections.py:178:18 treefmt-check> | treefmt-check> 177 | config_home = os.environ.get("XDG_CONFIG_HOME") or os.path.join(os.environ["HOME"], ".config") treefmt-check> 178 | hermes_dir = os.path.join(config_home, "Hermes") treefmt-check> | ^^^^^^^^^^^^ treefmt-check> 179 | registry_path = os.path.join(hermes_dir, "connections.json") treefmt-check> 180 | connection_path = os.path.join(hermes_dir, "connection.json") treefmt-check> | treefmt-check> treefmt-check> PTH118 `os.path.join()` should be replaced by `Path` with `/` operator treefmt-check> --> modules/nixos/hermes/desktop-connections.py:179:21 treefmt-check> | treefmt-check> 177 | config_home = os.environ.get("XDG_CONFIG_HOME") or os.path.join(os.environ["HOME"], ".config") treefmt-check> 178 | hermes_dir = os.path.join(config_home, "Hermes") treefmt-check> 179 | registry_path = os.path.join(hermes_dir, "connections.json") treefmt-check> | ^^^^^^^^^^^^ treefmt-check> 180 | connection_path = os.path.join(hermes_dir, "connection.json") treefmt-check> 181 | sidecar_path = os.path.join(hermes_dir, "nix-managed-connections.json") treefmt-check> | treefmt-check> treefmt-check> PTH118 `os.path.join()` should be replaced by `Path` with `/` operator treefmt-check> --> modules/nixos/hermes/desktop-connections.py:180:23 treefmt-check> | treefmt-check> 178 | hermes_dir = os.path.join(config_home, "Hermes") treefmt-check> 179 | registry_path = os.path.join(hermes_dir, "connections.json") treefmt-check> 180 | connection_path = os.path.join(hermes_dir, "connection.json") treefmt-check> | ^^^^^^^^^^^^ treefmt-check> 181 | sidecar_path = os.path.join(hermes_dir, "nix-managed-connections.json") treefmt-check> | treefmt-check> treefmt-check> PTH118 `os.path.join()` should be replaced by `Path` with `/` operator treefmt-check> --> modules/nixos/hermes/desktop-connections.py:181:20 treefmt-check> | treefmt-check> 179 | registry_path = os.path.join(hermes_dir, "connections.json") treefmt-check> 180 | connection_path = os.path.join(hermes_dir, "connection.json") treefmt-check> 181 | sidecar_path = os.path.join(hermes_dir, "nix-managed-connections.json") treefmt-check> | ^^^^^^^^^^^^ treefmt-check> 182 | treefmt-check> 183 | if args.reset: treefmt-check> | treefmt-check> treefmt-check> Found 57 errors. treefmt-check> No fixes available (8 hidden fixes can be enabled with the `--unsafe-fixes` option). treefmt-check> treefmt-check> traversed 612 files treefmt-check> emitted 399 files for processing treefmt-check> formatted 248 files (5 changed) in 906ms treefmt-check> Error: failed to finalise formatting: formatting failures detected error: Cannot build '/nix/store/cix8gxwwlzlzh8f0zxvw1yscbmin83w7-treefmt-check.drv'. Reason: builder failed with exit code 1. Output paths: /nix/store/x49prdbm8hff2fypy1igszlf48fnskch-treefmt-check Last 25 log lines: > 178 | hermes_dir = os.path.join(config_home, "Hermes") > 179 | registry_path = os.path.join(hermes_dir, "connections.json") > 180 | connection_path = os.path.join(hermes_dir, "connection.json") > | ^^^^^^^^^^^^ > 181 | sidecar_path = os.path.join(hermes_dir, "nix-managed-connections.json") > | > > PTH118 `os.path.join()` should be replaced by `Path` with `/` operator > --> modules/nixos/hermes/desktop-connections.py:181:20 > | > 179 | registry_path = os.path.join(hermes_dir, "connections.json") > 180 | connection_path = os.path.join(hermes_dir, "connection.json") > 181 | sidecar_path = os.path.join(hermes_dir, "nix-managed-connections.json") > | ^^^^^^^^^^^^ > 182 | > 183 | if args.reset: > | > > Found 57 errors. > No fixes available (8 hidden fixes can be enabled with the `--unsafe-fixes` option). > > traversed 612 files > emitted 399 files for processing > formatted 248 files (5 changed) in 906ms > Error: failed to finalise formatting: formatting failures detected For full logs, run: nix log /nix/store/cix8gxwwlzlzh8f0zxvw1yscbmin83w7-treefmt-check.drv