mirror of https://github.com/astral-sh/ruff
## Summary
If a function has no parameters (and no comments within the parameters'
`()`), we're supposed to wrap the return annotation _whenever_ it
breaks. However, our `empty_parameters` test didn't properly account for
the case in which the parameters include a newline (but no other
content), like:
```python
def get_dashboards_hierarchy(
) -> Dict[Type['BaseDashboard'], List[Type['BaseDashboard']]]:
"""Get hierarchy of dashboards classes.
Returns:
Dict of dashboards classes.
"""
dashboards_hierarchy = {}
```
This PR fixes that detection. Instead of lexing, it now checks if the
parameters itself is empty (or if it contains comments).
Closes https://github.com/astral-sh/ruff/issues/7457.
|
||
|---|---|---|
| .. | ||
| visitor | ||
| all.rs | ||
| call_path.rs | ||
| comparable.rs | ||
| docstrings.rs | ||
| expression.rs | ||
| hashable.rs | ||
| helpers.rs | ||
| identifier.rs | ||
| imports.rs | ||
| lib.rs | ||
| node.rs | ||
| nodes.rs | ||
| parenthesize.rs | ||
| relocate.rs | ||
| statement_visitor.rs | ||
| stmt_if.rs | ||
| str.rs | ||
| traversal.rs | ||
| types.rs | ||
| visitor.rs | ||
| whitespace.rs | ||