From abf31bc7a09d7208a96fd7b769f72d262184d781 Mon Sep 17 00:00:00 2001 From: Adam Kuhn Date: Sat, 17 Feb 2024 07:37:38 -0500 Subject: [PATCH] docs: Formatter compatibility warning for D207 and D300 (#10007) - Update docs to mention formatter compatibility interactions for under-indentation (D207) and triple-single-quotes (D300) - Changes verified locally with mkdocs - Closes: https://github.com/astral-sh/ruff/issues/9675 --- crates/ruff_linter/src/rules/pydocstyle/rules/indent.rs | 5 +++++ .../ruff_linter/src/rules/pydocstyle/rules/triple_quotes.rs | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/crates/ruff_linter/src/rules/pydocstyle/rules/indent.rs b/crates/ruff_linter/src/rules/pydocstyle/rules/indent.rs index c91565837f9ad..aaec3c4e83e2d 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/rules/indent.rs +++ b/crates/ruff_linter/src/rules/pydocstyle/rules/indent.rs @@ -87,12 +87,17 @@ impl Violation for IndentWithSpaces { /// """ /// ``` /// +/// ## Formatter compatibility +/// We recommend against using this rule alongside the [formatter]. The +/// formatter enforces consistent indentation, making the rule redundant. +/// /// ## References /// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/) /// - [NumPy Style Guide](https://numpydoc.readthedocs.io/en/latest/format.html) /// - [Google Python Style Guide - Docstrings](https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings) /// /// [PEP 257]: https://peps.python.org/pep-0257/ +/// [formatter]: https://docs.astral.sh/ruff/formatter/ #[violation] pub struct UnderIndentation; diff --git a/crates/ruff_linter/src/rules/pydocstyle/rules/triple_quotes.rs b/crates/ruff_linter/src/rules/pydocstyle/rules/triple_quotes.rs index 1eed5a928c570..5e28786cf6521 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/rules/triple_quotes.rs +++ b/crates/ruff_linter/src/rules/pydocstyle/rules/triple_quotes.rs @@ -27,10 +27,16 @@ use crate::docstrings::Docstring; /// """Return the pathname of the KOS root directory.""" /// ``` /// +/// ## Formatter compatibility +/// We recommend against using this rule alongside the [formatter]. The +/// formatter enforces consistent quotes, making the rule redundant. +/// /// ## References /// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/) /// - [NumPy Style Guide](https://numpydoc.readthedocs.io/en/latest/format.html) /// - [Google Python Style Guide - Docstrings](https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings) +/// +/// [formatter]: https://docs.astral.sh/ruff/formatter/ #[violation] pub struct TripleSingleQuotes { expected_quote: Quote,