-
Notifications
You must be signed in to change notification settings - Fork 2k
0.7.3 introduces false positives for invalid # noqa directives with RUF100 #14228
Copy link
Copy link
Closed
Closed
Copy link
Labels
bugSomething isn't workingSomething isn't working
Description
I'm working on upgrading our codebase to use ruff=0.7.3, but there are some RUF100 changes that start flagging
some comments as being "Unused noqa directive"s.
I'm not sure if this is intentional (perhaps there's a sanctioned way of adding a comment we're not using?), but this feels like a regression to me.
This doesn't happen in 0.7.2.
I'm assuming this is related to #12809
Examples:
--- blah.py
+++ blah.py
@@ -118,7 +118,7 @@
if res is not None:
res.release()
- if 200 <= res.status < 300: # noqa: PLR2004 Use raise_for_status
+ if 200 <= res.status < 300: # noqa: PLR2004 raise_for_status
return
if (
res.status not in self._retry_status_codes
Would fix 1 error.--- foobar.py
+++ foobar.py
@@ -43,7 +43,7 @@
@inject
def download(self) -> Any:
- temp_file = tempfile.NamedTemporaryFile(suffix=".tar.gz", delete=False) # noqa: SIM115 Closing right below
+ temp_file = tempfile.NamedTemporaryFile(suffix=".tar.gz", delete=False) # noqa: SIM115 right below
temp_file.close()
key = f"{self.base_commit}.tar.gz"
Would fix 1 error.--- fake_name.py
+++ fake_name.py
@@ -47,7 +47,7 @@
applied_manifests
)
- manifest_yaml_file = tempfile.NamedTemporaryFile( # noqa: SIM115 We're closing the file below
+ manifest_yaml_file = tempfile.NamedTemporaryFile( # noqa: SIM115're closing the file below
prefix="manifest_yaml_", delete=False
)
manifest_yaml_file.close()blah.py:121:46: RUF100 [*] Unused `noqa` directive (unknown: `Use`)
foobar.py:46:82: RUF100 [*] Unused `noqa` directive (unknown: `Closing`)
fake_name:50:56: RUF100 [*] Unused `noqa` directive (unknown: `We`)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working