Skip to content

Commit

Permalink
Make D410/D411 autofixes mutually exclusive
Browse files Browse the repository at this point in the history
  • Loading branch information
evanrittenhouse committed Apr 26, 2023
1 parent 4df7bc0 commit 5fa866e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions crates/ruff/src/rules/pydocstyle/rules/sections.rs
Original file line number Diff line number Diff line change
Expand Up @@ -751,8 +751,11 @@ fn common_section(checker: &mut Checker, docstring: &Docstring, context: &Sectio
},
Range::from(docstring.expr),
);
if checker.patch(diagnostic.kind.rule()) {
// Add a newline after the section.
if checker.patch(diagnostic.kind.rule())
&& !checker.patch(Rule::NoBlankLineBeforeSection)
{
// Add a newline after the section if we haven't already added one from
// `NoBlankLineBeforeSection`.
let line = context.following_lines.last().unwrap_or(&context.line);
diagnostic.set_fix(Edit::insertion(
line_end.to_string(),
Expand Down

0 comments on commit 5fa866e

Please sign in to comment.