mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-29 03:02:27 +00:00
## 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
https://github.com/astral-sh/ruff/pull/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 https://github.com/astral-sh/ruff/issues/10795.
## Test Plan
`cargo test`
13 lines
217 B
Python
13 lines
217 B
Python
"""Respect `# noqa` directives on `__all__` definitions."""
|
|
|
|
__all__ = [ # noqa: F822
|
|
"Bernoulli",
|
|
"Beta",
|
|
"Binomial",
|
|
]
|
|
|
|
|
|
__all__ += [
|
|
"ContinuousBernoulli", # noqa: F822
|
|
"ExponentialFamily",
|
|
]
|