-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Summary Historically, given: ```python __all__ = [ # noqa: F822 "Bernoulli", "Beta", "Binomial", ] ``` The F822 violations would be attached to the `__all__`, so this `# noqa` would be enforced for _all_ definitions in the list. This changed in #10525 for the better, in that we now use the range of each string. But these `# noqa` directives stopped working. This PR sets the `__all__` as a parent range in the diagnostic, so that these directives are respected once again. Closes #10795. ## Test Plan `cargo test`
- Loading branch information
1 parent
83db62b
commit 7fb5f47
Showing
6 changed files
with
102 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
crates/ruff_linter/resources/test/fixtures/pyflakes/F822_3.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
"""Respect `# noqa` directives on `__all__` definitions.""" | ||
|
||
__all__ = [ # noqa: F822 | ||
"Bernoulli", | ||
"Beta", | ||
"Binomial", | ||
] | ||
|
||
|
||
__all__ += [ | ||
"ContinuousBernoulli", # noqa: F822 | ||
"ExponentialFamily", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
...ter/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F822_F822_3.py.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/pyflakes/mod.rs | ||
--- | ||
F822_3.py:12:5: F822 Undefined name `ExponentialFamily` in `__all__` | ||
| | ||
10 | __all__ += [ | ||
11 | "ContinuousBernoulli", # noqa: F822 | ||
12 | "ExponentialFamily", | ||
| ^^^^^^^^^^^^^^^^^^^ F822 | ||
13 | ] | ||
| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters