ruff/crates/ruff_linter
Charlie Marsh 04afdf177b
Disambiguate argument descriptors from section headers (#9427)
## Summary

Given a docstring like:

```python
def func(x: int, args: tuple[int]):
    """Toggle the gizmo.

    Args:
        x: Some argument.
        args: Some other arguments.
    """
```

We were considering the `args:` descriptor to be an indented docstring
section header (since `Args:`) is a valid header name. This led to very
confusing diagnostics.

This PR makes the parsing a bit more lax in this case, such that if we
see a nested header that's more deeply indented than the preceding
header, and the preceding section allows sub-items (like `Args:`), we
avoid treating the nested item as a section header.

Closes https://github.com/astral-sh/ruff/issues/9426.
2024-01-07 22:41:00 -05:00
..
resources/test Disambiguate argument descriptors from section headers (#9427) 2024-01-07 22:41:00 -05:00
src Disambiguate argument descriptors from section headers (#9427) 2024-01-07 22:41:00 -05:00
Cargo.toml Bump version to 0.1.11 (#9370) 2024-01-02 17:46:06 -05:00