From c88be667a1d9dd561f0b44426345b1b70e3ae2c8 Mon Sep 17 00:00:00 2001 From: Steve C Date: Sun, 15 Oct 2023 19:10:37 -0400 Subject: [PATCH 1/3] add fix for D300 --- .../rules/pydocstyle/rules/triple_quotes.rs | 39 ++++-- ...__rules__pydocstyle__tests__D300_D.py.snap | 131 ++++++++++++++++-- ...linter__rules__pydocstyle__tests__bom.snap | 7 +- 3 files changed, 158 insertions(+), 19 deletions(-) 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 c8b7d6208a80c..a277e8461e770 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/rules/triple_quotes.rs +++ b/crates/ruff_linter/src/rules/pydocstyle/rules/triple_quotes.rs @@ -1,4 +1,4 @@ -use ruff_diagnostics::{Diagnostic, Violation}; +use ruff_diagnostics::{AlwaysFixableViolation, Diagnostic, Edit, Fix}; use ruff_macros::{derive_message_formats, violation}; use ruff_python_codegen::Quote; use ruff_text_size::Ranged; @@ -36,7 +36,7 @@ pub struct TripleSingleQuotes { expected_quote: Quote, } -impl Violation for TripleSingleQuotes { +impl AlwaysFixableViolation for TripleSingleQuotes { #[derive_message_formats] fn message(&self) -> String { let TripleSingleQuotes { expected_quote } = self; @@ -45,12 +45,25 @@ impl Violation for TripleSingleQuotes { Quote::Single => format!(r#"Use triple single quotes `'''`"#), } } + + fn fix_title(&self) -> String { + let TripleSingleQuotes { expected_quote } = self; + match expected_quote { + Quote::Double => format!(r#"Use triple double quotes `"""`"#), + Quote::Single => format!(r#"Use triple single quotes `'''`"#), + } + } } /// D300 pub(crate) fn triple_quotes(checker: &mut Checker, docstring: &Docstring) { let leading_quote = docstring.leading_quote(); + let prefixes = docstring + .leading_quote() + .trim_end_matches(|c| c == '\'' || c == '"') + .to_owned(); + let expected_quote = if docstring.body().contains("\"\"\"") { Quote::Single } else { @@ -60,18 +73,28 @@ pub(crate) fn triple_quotes(checker: &mut Checker, docstring: &Docstring) { match expected_quote { Quote::Single => { if !leading_quote.ends_with("'''") { - checker.diagnostics.push(Diagnostic::new( - TripleSingleQuotes { expected_quote }, + let mut diagnostic = + Diagnostic::new(TripleSingleQuotes { expected_quote }, docstring.range()); + + diagnostic.set_fix(Fix::safe_edit(Edit::range_replacement( + prefixes + &format!("'''{}'''", docstring.body().as_str()), docstring.range(), - )); + ))); + + checker.diagnostics.push(diagnostic); } } Quote::Double => { if !leading_quote.ends_with("\"\"\"") { - checker.diagnostics.push(Diagnostic::new( - TripleSingleQuotes { expected_quote }, + let mut diagnostic = + Diagnostic::new(TripleSingleQuotes { expected_quote }, docstring.range()); + + diagnostic.set_fix(Fix::safe_edit(Edit::range_replacement( + prefixes + &format!("\"\"\"{}\"\"\"", docstring.body().as_str()), docstring.range(), - )); + ))); + + checker.diagnostics.push(diagnostic); } } } diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D.py.snap index dbf703c165317..dacf8ca5e17bf 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D.py.snap @@ -1,47 +1,102 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -D.py:307:5: D300 Use triple double quotes `"""` +D.py:307:5: D300 [*] Use triple double quotes `"""` | 305 | @expect('D300: Use """triple double quotes""" (found \'\'\'-quotes)') 306 | def triple_single_quotes_raw(): 307 | r'''Summary.''' | ^^^^^^^^^^^^^^^ D300 | + = help: Use triple double quotes `"""` -D.py:312:5: D300 Use triple double quotes `"""` +ℹ Fix +304 304 | +305 305 | @expect('D300: Use """triple double quotes""" (found \'\'\'-quotes)') +306 306 | def triple_single_quotes_raw(): +307 |- r'''Summary.''' + 307 |+ r"""Summary.""" +308 308 | +309 309 | +310 310 | @expect('D300: Use """triple double quotes""" (found \'\'\'-quotes)') + +D.py:312:5: D300 [*] Use triple double quotes `"""` | 310 | @expect('D300: Use """triple double quotes""" (found \'\'\'-quotes)') 311 | def triple_single_quotes_raw_uppercase(): 312 | R'''Summary.''' | ^^^^^^^^^^^^^^^ D300 | + = help: Use triple double quotes `"""` + +ℹ Fix +309 309 | +310 310 | @expect('D300: Use """triple double quotes""" (found \'\'\'-quotes)') +311 311 | def triple_single_quotes_raw_uppercase(): +312 |- R'''Summary.''' + 312 |+ R"""Summary.""" +313 313 | +314 314 | +315 315 | @expect('D300: Use """triple double quotes""" (found \'-quotes)') -D.py:317:5: D300 Use triple double quotes `"""` +D.py:317:5: D300 [*] Use triple double quotes `"""` | 315 | @expect('D300: Use """triple double quotes""" (found \'-quotes)') 316 | def single_quotes_raw(): 317 | r'Summary.' | ^^^^^^^^^^^ D300 | + = help: Use triple double quotes `"""` + +ℹ Fix +314 314 | +315 315 | @expect('D300: Use """triple double quotes""" (found \'-quotes)') +316 316 | def single_quotes_raw(): +317 |- r'Summary.' + 317 |+ r"""Summary.""" +318 318 | +319 319 | +320 320 | @expect('D300: Use """triple double quotes""" (found \'-quotes)') -D.py:322:5: D300 Use triple double quotes `"""` +D.py:322:5: D300 [*] Use triple double quotes `"""` | 320 | @expect('D300: Use """triple double quotes""" (found \'-quotes)') 321 | def single_quotes_raw_uppercase(): 322 | R'Summary.' | ^^^^^^^^^^^ D300 | + = help: Use triple double quotes `"""` -D.py:328:5: D300 Use triple double quotes `"""` +ℹ Fix +319 319 | +320 320 | @expect('D300: Use """triple double quotes""" (found \'-quotes)') +321 321 | def single_quotes_raw_uppercase(): +322 |- R'Summary.' + 322 |+ R"""Summary.""" +323 323 | +324 324 | +325 325 | @expect('D300: Use """triple double quotes""" (found \'-quotes)') + +D.py:328:5: D300 [*] Use triple double quotes `"""` | 326 | @expect('D301: Use r""" if any backslashes in a docstring') 327 | def single_quotes_raw_uppercase_backslash(): 328 | R'Sum\mary.' | ^^^^^^^^^^^^ D300 | + = help: Use triple double quotes `"""` + +ℹ Fix +325 325 | @expect('D300: Use """triple double quotes""" (found \'-quotes)') +326 326 | @expect('D301: Use r""" if any backslashes in a docstring') +327 327 | def single_quotes_raw_uppercase_backslash(): +328 |- R'Sum\mary.' + 328 |+ R"""Sum\mary.""" +329 329 | +330 330 | +331 331 | @expect('D301: Use r""" if any backslashes in a docstring') -D.py:645:5: D300 Use triple double quotes `"""` +D.py:645:5: D300 [*] Use triple double quotes `"""` | 644 | def single_line_docstring_with_an_escaped_backslash(): 645 | "\ @@ -51,8 +106,21 @@ D.py:645:5: D300 Use triple double quotes `"""` 647 | 648 | class StatementOnSameLineAsDocstring: | + = help: Use triple double quotes `"""` -D.py:649:5: D300 Use triple double quotes `"""` +ℹ Fix +642 642 | +643 643 | +644 644 | def single_line_docstring_with_an_escaped_backslash(): +645 |- "\ +646 |- " + 645 |+ """\ + 646 |+ """ +647 647 | +648 648 | class StatementOnSameLineAsDocstring: +649 649 | "After this docstring there's another statement on the same line separated by a semicolon." ; priorities=1 + +D.py:649:5: D300 [*] Use triple double quotes `"""` | 648 | class StatementOnSameLineAsDocstring: 649 | "After this docstring there's another statement on the same line separated by a semicolon." ; priorities=1 @@ -60,15 +128,37 @@ D.py:649:5: D300 Use triple double quotes `"""` 650 | def sort_services(self): 651 | pass | + = help: Use triple double quotes `"""` + +ℹ Fix +646 646 | " +647 647 | +648 648 | class StatementOnSameLineAsDocstring: +649 |- "After this docstring there's another statement on the same line separated by a semicolon." ; priorities=1 + 649 |+ """After this docstring there's another statement on the same line separated by a semicolon.""" ; priorities=1 +650 650 | def sort_services(self): +651 651 | pass +652 652 | -D.py:654:5: D300 Use triple double quotes `"""` +D.py:654:5: D300 [*] Use triple double quotes `"""` | 653 | class StatementOnSameLineAsDocstring: 654 | "After this docstring there's another statement on the same line separated by a semicolon."; priorities=1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ D300 | + = help: Use triple double quotes `"""` + +ℹ Fix +651 651 | pass +652 652 | +653 653 | class StatementOnSameLineAsDocstring: +654 |- "After this docstring there's another statement on the same line separated by a semicolon."; priorities=1 + 654 |+ """After this docstring there's another statement on the same line separated by a semicolon."""; priorities=1 +655 655 | +656 656 | +657 657 | class CommentAfterDocstring: -D.py:658:5: D300 Use triple double quotes `"""` +D.py:658:5: D300 [*] Use triple double quotes `"""` | 657 | class CommentAfterDocstring: 658 | "After this docstring there's a comment." # priorities=1 @@ -76,8 +166,19 @@ D.py:658:5: D300 Use triple double quotes `"""` 659 | def sort_services(self): 660 | pass | + = help: Use triple double quotes `"""` -D.py:664:5: D300 Use triple double quotes `"""` +ℹ Fix +655 655 | +656 656 | +657 657 | class CommentAfterDocstring: +658 |- "After this docstring there's a comment." # priorities=1 + 658 |+ """After this docstring there's a comment.""" # priorities=1 +659 659 | def sort_services(self): +660 660 | pass +661 661 | + +D.py:664:5: D300 [*] Use triple double quotes `"""` | 663 | def newline_after_closing_quote(self): 664 | "We enforce a newline after the closing quote for a multi-line docstring \ @@ -85,5 +186,15 @@ D.py:664:5: D300 Use triple double quotes `"""` 665 | | but continuations shouldn't be considered multi-line" | |_________________________________________________________^ D300 | + = help: Use triple double quotes `"""` + +ℹ Fix +661 661 | +662 662 | +663 663 | def newline_after_closing_quote(self): +664 |- "We enforce a newline after the closing quote for a multi-line docstring \ +665 |- but continuations shouldn't be considered multi-line" + 664 |+ """We enforce a newline after the closing quote for a multi-line docstring \ + 665 |+ but continuations shouldn't be considered multi-line""" diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__bom.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__bom.snap index 1c7757d4b4b3e..3d8c9c725ce1c 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__bom.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__bom.snap @@ -1,10 +1,15 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -bom.py:1:1: D300 Use triple double quotes `"""` +bom.py:1:1: D300 [*] Use triple double quotes `"""` | 1 | ''' SAM macro definitions ''' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ D300 | + = help: Use triple double quotes `"""` + +ℹ Fix +1 |-''' SAM macro definitions ''' + 1 |+""" SAM macro definitions """ From 22f5583160f380d7031a5b2767bc5fb47ada24f3 Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Tue, 17 Oct 2023 00:49:17 -0400 Subject: [PATCH 2/3] Make sometimes --- .../test/fixtures/pydocstyle/D300.py | 10 +++++ .../ruff_linter/src/rules/pydocstyle/mod.rs | 1 + .../rules/pydocstyle/rules/triple_quotes.rs | 38 +++++++++++-------- ...__rules__pydocstyle__tests__D300_D.py.snap | 20 +++++----- ...ules__pydocstyle__tests__D300_D300.py.snap | 29 ++++++++++++++ ...linter__rules__pydocstyle__tests__bom.snap | 2 +- 6 files changed, 74 insertions(+), 26 deletions(-) create mode 100644 crates/ruff_linter/resources/test/fixtures/pydocstyle/D300.py create mode 100644 crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D300.py.snap diff --git a/crates/ruff_linter/resources/test/fixtures/pydocstyle/D300.py b/crates/ruff_linter/resources/test/fixtures/pydocstyle/D300.py new file mode 100644 index 0000000000000..eb9b4c57307da --- /dev/null +++ b/crates/ruff_linter/resources/test/fixtures/pydocstyle/D300.py @@ -0,0 +1,10 @@ +def with_backslash(): + """Sum\\mary.""" + + +def ends_in_quote(): + 'Sum\\mary."' + + +def contains_quote(): + 'Sum"\\mary.' diff --git a/crates/ruff_linter/src/rules/pydocstyle/mod.rs b/crates/ruff_linter/src/rules/pydocstyle/mod.rs index e3e51c00c6387..59931647d9e9b 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/mod.rs +++ b/crates/ruff_linter/src/rules/pydocstyle/mod.rs @@ -87,6 +87,7 @@ mod tests { #[test_case(Rule::EscapeSequenceInDocstring, Path::new("D.py"))] #[test_case(Rule::EscapeSequenceInDocstring, Path::new("D301.py"))] #[test_case(Rule::TripleSingleQuotes, Path::new("D.py"))] + #[test_case(Rule::TripleSingleQuotes, Path::new("D300.py"))] fn rules(rule_code: Rule, path: &Path) -> Result<()> { let snapshot = format!("{}_{}", rule_code.noqa_code(), path.to_string_lossy()); let diagnostics = test_path( 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 a277e8461e770..9ec1dd66d9ebc 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/rules/triple_quotes.rs +++ b/crates/ruff_linter/src/rules/pydocstyle/rules/triple_quotes.rs @@ -1,4 +1,4 @@ -use ruff_diagnostics::{AlwaysFixableViolation, Diagnostic, Edit, Fix}; +use ruff_diagnostics::{Diagnostic, Edit, Fix, FixAvailability, Violation}; use ruff_macros::{derive_message_formats, violation}; use ruff_python_codegen::Quote; use ruff_text_size::Ranged; @@ -36,7 +36,9 @@ pub struct TripleSingleQuotes { expected_quote: Quote, } -impl AlwaysFixableViolation for TripleSingleQuotes { +impl Violation for TripleSingleQuotes { + const FIX_AVAILABILITY: FixAvailability = FixAvailability::Sometimes; + #[derive_message_formats] fn message(&self) -> String { let TripleSingleQuotes { expected_quote } = self; @@ -46,12 +48,12 @@ impl AlwaysFixableViolation for TripleSingleQuotes { } } - fn fix_title(&self) -> String { + fn fix_title(&self) -> Option { let TripleSingleQuotes { expected_quote } = self; - match expected_quote { - Quote::Double => format!(r#"Use triple double quotes `"""`"#), - Quote::Single => format!(r#"Use triple single quotes `'''`"#), - } + Some(match expected_quote { + Quote::Double => format!("Convert to triple double quotes"), + Quote::Single => format!("Convert to triple single quotes"), + }) } } @@ -76,10 +78,13 @@ pub(crate) fn triple_quotes(checker: &mut Checker, docstring: &Docstring) { let mut diagnostic = Diagnostic::new(TripleSingleQuotes { expected_quote }, docstring.range()); - diagnostic.set_fix(Fix::safe_edit(Edit::range_replacement( - prefixes + &format!("'''{}'''", docstring.body().as_str()), - docstring.range(), - ))); + let body = docstring.body().as_str(); + if !body.ends_with('\'') { + diagnostic.set_fix(Fix::safe_edit(Edit::range_replacement( + format!("{prefixes}'''{body}'''"), + docstring.range(), + ))); + } checker.diagnostics.push(diagnostic); } @@ -89,10 +94,13 @@ pub(crate) fn triple_quotes(checker: &mut Checker, docstring: &Docstring) { let mut diagnostic = Diagnostic::new(TripleSingleQuotes { expected_quote }, docstring.range()); - diagnostic.set_fix(Fix::safe_edit(Edit::range_replacement( - prefixes + &format!("\"\"\"{}\"\"\"", docstring.body().as_str()), - docstring.range(), - ))); + let body = docstring.body().as_str(); + if !body.ends_with('"') { + diagnostic.set_fix(Fix::safe_edit(Edit::range_replacement( + format!("{prefixes}\"\"\"{body}\"\"\""), + docstring.range(), + ))); + } checker.diagnostics.push(diagnostic); } diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D.py.snap index dacf8ca5e17bf..419c4e237ae64 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D.py.snap @@ -8,7 +8,7 @@ D.py:307:5: D300 [*] Use triple double quotes `"""` 307 | r'''Summary.''' | ^^^^^^^^^^^^^^^ D300 | - = help: Use triple double quotes `"""` + = help: Convert to triple double quotes ℹ Fix 304 304 | @@ -27,7 +27,7 @@ D.py:312:5: D300 [*] Use triple double quotes `"""` 312 | R'''Summary.''' | ^^^^^^^^^^^^^^^ D300 | - = help: Use triple double quotes `"""` + = help: Convert to triple double quotes ℹ Fix 309 309 | @@ -46,7 +46,7 @@ D.py:317:5: D300 [*] Use triple double quotes `"""` 317 | r'Summary.' | ^^^^^^^^^^^ D300 | - = help: Use triple double quotes `"""` + = help: Convert to triple double quotes ℹ Fix 314 314 | @@ -65,7 +65,7 @@ D.py:322:5: D300 [*] Use triple double quotes `"""` 322 | R'Summary.' | ^^^^^^^^^^^ D300 | - = help: Use triple double quotes `"""` + = help: Convert to triple double quotes ℹ Fix 319 319 | @@ -84,7 +84,7 @@ D.py:328:5: D300 [*] Use triple double quotes `"""` 328 | R'Sum\mary.' | ^^^^^^^^^^^^ D300 | - = help: Use triple double quotes `"""` + = help: Convert to triple double quotes ℹ Fix 325 325 | @expect('D300: Use """triple double quotes""" (found \'-quotes)') @@ -106,7 +106,7 @@ D.py:645:5: D300 [*] Use triple double quotes `"""` 647 | 648 | class StatementOnSameLineAsDocstring: | - = help: Use triple double quotes `"""` + = help: Convert to triple double quotes ℹ Fix 642 642 | @@ -128,7 +128,7 @@ D.py:649:5: D300 [*] Use triple double quotes `"""` 650 | def sort_services(self): 651 | pass | - = help: Use triple double quotes `"""` + = help: Convert to triple double quotes ℹ Fix 646 646 | " @@ -146,7 +146,7 @@ D.py:654:5: D300 [*] Use triple double quotes `"""` 654 | "After this docstring there's another statement on the same line separated by a semicolon."; priorities=1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ D300 | - = help: Use triple double quotes `"""` + = help: Convert to triple double quotes ℹ Fix 651 651 | pass @@ -166,7 +166,7 @@ D.py:658:5: D300 [*] Use triple double quotes `"""` 659 | def sort_services(self): 660 | pass | - = help: Use triple double quotes `"""` + = help: Convert to triple double quotes ℹ Fix 655 655 | @@ -186,7 +186,7 @@ D.py:664:5: D300 [*] Use triple double quotes `"""` 665 | | but continuations shouldn't be considered multi-line" | |_________________________________________________________^ D300 | - = help: Use triple double quotes `"""` + = help: Convert to triple double quotes ℹ Fix 661 661 | diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D300.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D300.py.snap new file mode 100644 index 0000000000000..ae690c13ab8d6 --- /dev/null +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D300.py.snap @@ -0,0 +1,29 @@ +--- +source: crates/ruff_linter/src/rules/pydocstyle/mod.rs +--- +D300.py:5:5: D300 Use triple double quotes `"""` + | +4 | def ends_in_quote(): +5 | 'Sum\\mary."' + | ^^^^^^^^^^^^^ D300 +6 | +7 | def contains_quote(): + | + = help: Convert to triple double quotes + +D300.py:8:5: D300 [*] Use triple double quotes `"""` + | +7 | def contains_quote(): +8 | 'Sum"\\mary.' + | ^^^^^^^^^^^^^ D300 + | + = help: Convert to triple double quotes + +ℹ Fix +5 5 | 'Sum\\mary."' +6 6 | +7 7 | def contains_quote(): +8 |- 'Sum"\\mary.' + 8 |+ """Sum"\\mary.""" + + diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__bom.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__bom.snap index 3d8c9c725ce1c..53d779dfaf713 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__bom.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__bom.snap @@ -6,7 +6,7 @@ bom.py:1:1: D300 [*] Use triple double quotes `"""` 1 | ''' SAM macro definitions ''' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ D300 | - = help: Use triple double quotes `"""` + = help: Convert to triple double quotes ℹ Fix 1 |-''' SAM macro definitions ''' From ef3d0df6b939f838edb8454971641adeb186b32e Mon Sep 17 00:00:00 2001 From: Steve C Date: Tue, 17 Oct 2023 01:22:19 -0400 Subject: [PATCH 3/3] fix fixture --- ...ules__pydocstyle__tests__D300_D300.py.snap | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D300.py.snap b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D300.py.snap index ae690c13ab8d6..3b1b637e90a4c 100644 --- a/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D300.py.snap +++ b/crates/ruff_linter/src/rules/pydocstyle/snapshots/ruff_linter__rules__pydocstyle__tests__D300_D300.py.snap @@ -1,29 +1,27 @@ --- source: crates/ruff_linter/src/rules/pydocstyle/mod.rs --- -D300.py:5:5: D300 Use triple double quotes `"""` +D300.py:6:5: D300 Use triple double quotes `"""` | -4 | def ends_in_quote(): -5 | 'Sum\\mary."' +5 | def ends_in_quote(): +6 | 'Sum\\mary."' | ^^^^^^^^^^^^^ D300 -6 | -7 | def contains_quote(): | = help: Convert to triple double quotes -D300.py:8:5: D300 [*] Use triple double quotes `"""` - | -7 | def contains_quote(): -8 | 'Sum"\\mary.' - | ^^^^^^^^^^^^^ D300 - | - = help: Convert to triple double quotes +D300.py:10:5: D300 [*] Use triple double quotes `"""` + | + 9 | def contains_quote(): +10 | 'Sum"\\mary.' + | ^^^^^^^^^^^^^ D300 + | + = help: Convert to triple double quotes ℹ Fix -5 5 | 'Sum\\mary."' -6 6 | -7 7 | def contains_quote(): -8 |- 'Sum"\\mary.' - 8 |+ """Sum"\\mary.""" +7 7 | +8 8 | +9 9 | def contains_quote(): +10 |- 'Sum"\\mary.' + 10 |+ """Sum"\\mary."""