treefmt-check
default.checks.aarch64-linux.treefmt
· build #44
· raw
1tribuchet: building on eliza2treefmt v2.5.0ERRO formatter | ruff-check: failed to apply with options '[check --fix]': exit status 134warning: #ruff:ignore comment found but not active, enable preview mode5SIM115 Use a context manager for opening files6 --> nixpkgs_review/buildenv.py:24:317 |822 | raise RuntimeError(msg)923 |1024 | self.nixpkgs_config = NamedTemporaryFile(suffix=".nix") # ruff:ignore[open-file-with-context-handler]11 | ^^^^^^^^^^^^^^^^^^1225 | self.old_cwd: Path | None = None1326 | self.environ: dict[str, str] | None = None14 |1516DTZ007 Naive datetime constructed using `datetime.datetime.strptime()` without %z17 --> nixpkgs_review/cli/comments.py:165:1218 |19163 | def parse_time(string: str) -> datetime:20164 | # Should we care about timezone here? %z21165 | return datetime.strptime(string, "%Y-%m-%dT%H:%M:%SZ") # ruff:ignore[call-datetime-strptime-without-zone]22 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^23 |24help: Call `.replace(tzinfo=<timezone>)` or `.astimezone()` to convert to an aware datetime2526S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.27 --> nixpkgs_review/github.py:114:1528 |29112 | body = json.dumps(data).encode("ascii")30113 |31114 | req = urllib.request.Request( # ruff:ignore[suspicious-url-open-usage]32 | _______________^33115 | | url,34116 | | headers=self.headers,35117 | | method=method,36118 | | data=body,37119 | | )38 | |_________^39120 | with http_requests.urlopen(req) as resp:40121 | result: JSONType = json.loads(resp.read())41 |4243S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.44 --> nixpkgs_review/github.py:251:1545 |46249 | raise RuntimeError(msg)47250 |48251 | req = urllib.request.Request(new_url) # ruff:ignore[suspicious-url-open-usage]49 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^50252 | with (51253 | http_requests.urlopen(req) as new_resp,52 |5354S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.55 --> nixpkgs_review/http_requests.py:32:3356 |5730 | raise ValueError(msg)5831 |5932 | return cast("HTTPResponse", urllib.request.urlopen(url, timeout=timeout)) # ruff:ignore[suspicious-url-open-usage]60 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^61 |6263S108 Probable insecure usage of temporary file or directory: "/tmp"64 --> nixpkgs_review/nix.py:216:1665 |66214 | *bind("/"),67215 | *bind("/dev", dev=True),68216 | *tmpfs("/tmp"), # ruff:ignore[hardcoded-temp-file]69 | ^^^^^^70217 | # Required for evaluation71218 | *bind(config.nixpkgs_config),72 |7374S108 Probable insecure usage of temporary file or directory: "/tmp/.X11-unix"75 --> nixpkgs_review/nix.py:228:1576 |77226 | *bind(nixpkgs_config_dir, try_=True),78227 | # For X11 applications79228 | *bind("/tmp/.X11-unix", try_=True), # ruff:ignore[hardcoded-temp-file]80 | ^^^^^^^^^^^^^^^^81229 | *bind(xauthority, try_=True),82230 | # GitHub83 |8485SIM115 Use a context manager for opening files86 --> nixpkgs_review/nix.py:314:1787 |88312 | build_config: BuildConfig,89313 | ) -> dict[System, list[Attr]]:90314 | attr_json = NamedTemporaryFile(mode="w+", delete=False) # ruff:ignore[open-file-with-context-handler]91 | ^^^^^^^^^^^^^^^^^^92315 | delete = True93316 | try:94 |9596S314 Using `xml` to parse untrusted data is known to be vulnerable to XML attacks; use `defusedxml` equivalents97 --> nixpkgs_review/review.py:723:1598 |99721 | current_pkg: Package | None = None100722 |101723 | context = ET.iterparse(stdout, events=("start", "end")) # ruff:ignore[suspicious-xml-element-tree-usage]102 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^103724 | for event, elem in context:104725 | if elem.tag == "item" and event == "start":105 |106107S105 Possible hardcoded password assigned to: "GITHUB_TOKEN"108 --> tests/test_github_actions.py:19:38109 |11018 | os.environ["PR"] = "1"11119 | os.environ["GITHUB_TOKEN"] = "foo" # ruff:ignore[hardcoded-password-string]112 | ^^^^^11320 | os.environ["NIXPKGS_REVIEW_ROOT"] = str(root)11421 | mock_urlopen.side_effect = [mock_open(read_data="{}")()]115 |116117S105 Possible hardcoded password assigned to: "GITHUB_TOKEN"118 --> tests/test_github_actions.py:32:38119 |12030 | root = nixpkgs.path.parent12131 | os.environ["PR"] = "1"12232 | os.environ["GITHUB_TOKEN"] = "foo" # ruff:ignore[hardcoded-password-string]123 | ^^^^^12433 | os.environ["NIXPKGS_REVIEW_ROOT"] = str(root)12534 | mock_urlopen.side_effect = [126 |127128S105 Possible hardcoded password assigned to: "GITHUB_TOKEN"129 --> tests/test_github_actions.py:50:38130 |13148 | with helpers.save_environ():13249 | os.environ["PR"] = "1"13350 | os.environ["GITHUB_TOKEN"] = "foo" # ruff:ignore[hardcoded-password-string]134 | ^^^^^13551 | mock_urlopen.side_effect = [mock_open(read_data="{}")()]13652 | main("nixpkgs-review", ["approve"])137 |138139Found 12 errors.140141traversed 62 files142emitted 46 files for processing143formatted 13 files (0 changed) in 112ms144Error: failed to finalise formatting: formatting failures detected