-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disable D203, D212 and D213 by default
D203 from pydocstyle conflicts with PEP 257[1] since its wording has been changed[2] and thus shouldn't be enabled by `--select D` or `--select ALL` D212 and D213 conflict with each other which can lead to ruff performing an infinite autofix iteration loop (Ruff goes back-and-forth, adding and removing a newline between the docstring and the class definition, until you hit 100 iterations). We display a warning, but it's just a bad experience, and it comes up way too often. Rules that have been disabled by default can still be explicitly enabled. `ruff explain` now mentions when rules have been disabled by default as well as the reason and the README table generation has also been updated accordingly. [1]: https://peps.python.org/pep-0257/ [2]: python/peps@eba2eac
- Loading branch information
1 parent
b3b65bf
commit 57d1e13
Showing
6 changed files
with
98 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
use crate::registry::Rule; | ||
|
||
/// Rules for which a reason is returned here are disabled by default unless they are explicitly selected. | ||
/// So for example `one-blank-line-before-class` (D203) will not be selected by "D" or "ALL" since it's listed here. | ||
/// The returned reason is documented in the autogenerated README as well as reported by the explain command. | ||
pub fn nursery_reason(rule: &Rule) -> Option<&'static str> { | ||
match rule { | ||
Rule::OneBlankLineBeforeClass => Some("Conflicts with PEP 257."), | ||
Rule::MultiLineSummaryFirstLine => Some("Not part of PEP 257 and conflicts with D213."), | ||
Rule::MultiLineSummarySecondLine => Some("Not part of PEP 257 and conflicts with D212."), | ||
_ => None, | ||
} | ||
} |