ruff/crates/ruff_linter/resources/test/fixtures/pydocstyle
GiGaGon 966fd6f57a
[pydoclint] Fix SyntaxError from fixes with line continuations (D201, D202) (#19246)
<!--
Thank you for contributing to Ruff/ty! To help us out with reviewing,
please consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title? (Please prefix
with `[ty]` for ty pull
  requests.)
- Does this pull request include references to any relevant issues?
-->

## Summary

<!-- What's the purpose of the change? What does it do, and why? -->

This PR fixes #7172 by suppressing the fixes for
[docstring-missing-returns
(DOC201)](https://docs.astral.sh/ruff/rules/docstring-missing-returns/#docstring-missing-returns-doc201)
/ [docstring-extraneous-returns
(DOC202)](https://docs.astral.sh/ruff/rules/docstring-extraneous-returns/#docstring-extraneous-returns-doc202)
if there is a surrounding line continuation character `\` that would
make the fix cause a syntax error.

To do this, the lints are changed from `AlwaysFixableViolation` to
`Violation` with `FixAvailability::Sometimes`.

In the case of `DOC201`, the fix is not given if the non-break line ends
in a line continuation character `\`. Note that lines are iterated in
reverse from the docstring to the function definition.

In the case of `DOC202`, the fix is not given if the docstring ends with
a line continuation character `\`.

## Test Plan

<!-- How was it tested? -->

Added a test case.
2025-07-14 13:31:36 -04:00
..
_unrelated Rename ruff crate to ruff_linter (#7529) 2023-09-20 08:38:27 +02:00
D104 Rename ruff crate to ruff_linter (#7529) 2023-09-20 08:38:27 +02:00
all.py Rename ruff crate to ruff_linter (#7529) 2023-09-20 08:38:27 +02:00
bom.py Rename ruff crate to ruff_linter (#7529) 2023-09-20 08:38:27 +02:00
canonical_google_examples.py Rename ruff crate to ruff_linter (#7529) 2023-09-20 08:38:27 +02:00
canonical_numpy_examples.py Rename ruff crate to ruff_linter (#7529) 2023-09-20 08:38:27 +02:00
D.py [pydoclint] Fix SyntaxError from fixes with line continuations (D201, D202) (#19246) 2025-07-14 13:31:36 -04:00
D100.ipynb Avoid D100 for Jupyter Notebooks (#8816) 2023-11-22 15:26:25 +00:00
D200.py Rename ruff crate to ruff_linter (#7529) 2023-09-20 08:38:27 +02:00
D202.py Rename rules currently not conforming to naming convention (#15102) 2024-12-23 15:48:45 -06:00
D208.py Don't raise D208 when last line is non-empty (#13372) 2024-09-26 14:53:21 +02:00
D209_D400.py Rename ruff crate to ruff_linter (#7529) 2023-09-20 08:38:27 +02:00
D214_module.py Rename ruff crate to ruff_linter (#7529) 2023-09-20 08:38:27 +02:00
D215.py Use deletion for D215 full-line removals (#7625) 2023-09-23 22:44:55 +00:00
D300.py D300: prevent autofix when both triples are in body (#8462) 2023-11-03 12:49:50 -04:00
D301.py [pydocstyle] Escaped docstring in docstring (D301 ) (#12192) 2024-07-18 18:36:05 -04:00
D400.py Ignore underlines when determining docstring logical lines (#8929) 2023-11-30 14:27:04 -05:00
D400_415.py [pycodestyle] Fix: Don't autofix if the first line ends in a question mark? (D400) (#13399) 2024-09-20 11:05:26 +00:00
D401.py Rename ruff crate to ruff_linter (#7529) 2023-09-20 08:38:27 +02:00
D402.py Respect word boundaries when detecting function signature in docs (#13388) 2024-09-18 00:01:38 -04:00
D403.py [pydocstyle] Split on first whitespace character (D403) (#15082) 2024-12-20 12:55:50 -06:00
D410.py Rename ruff crate to ruff_linter (#7529) 2023-09-20 08:38:27 +02:00
D413.py [pydocstyle] Fix D413 infinite loop for parenthesized docstring (#18930) 2025-06-30 10:49:13 -04:00
D417.py [pydocstyle] Handle arguments with the same names as sections (D417) (#16011) 2025-02-11 12:05:29 -05:00
sections.py Avoid treating newline-separated sections as sub-sections (#15311) 2025-01-06 22:13:35 -05:00
setter.py Rename ruff crate to ruff_linter (#7529) 2023-09-20 08:38:27 +02:00
sphinx.py Avoid removing newlines between docstring headers and rST blocks (#11609) 2024-05-30 13:29:20 -04:00