diff --git a/resources/test/fixtures/flake8_quotes/docstring_doubles_function.py b/resources/test/fixtures/flake8_quotes/docstring_doubles_function.py index bcd5587978..661017ade2 100644 --- a/resources/test/fixtures/flake8_quotes/docstring_doubles_function.py +++ b/resources/test/fixtures/flake8_quotes/docstring_doubles_function.py @@ -17,6 +17,15 @@ def fun_with_params_no_docstring(a, b=""" """ """docstring"""): pass + def fun_with_params_no_docstring2(a, b=c[foo():], c=\ """ not a docstring """): pass + + +def function_with_single_docstring(a): + "Single line docstring" + + +def double_inside_single(a): + 'Double inside "single "' diff --git a/resources/test/fixtures/flake8_quotes/docstring_singles_function.py b/resources/test/fixtures/flake8_quotes/docstring_singles_function.py index 50c241fa3e..32c2ece47c 100644 --- a/resources/test/fixtures/flake8_quotes/docstring_singles_function.py +++ b/resources/test/fixtures/flake8_quotes/docstring_singles_function.py @@ -13,11 +13,19 @@ def foo2(): def fun_with_params_no_docstring(a, b=''' - not a + not a ''' '''docstring'''): pass + def fun_with_params_no_docstring2(a, b=c[foo():], c=\ ''' not a docstring '''): pass + +def function_with_single_docstring(a): + 'Single line docstring' + + +def double_inside_single(a): + "Double inside 'single '" diff --git a/src/flake8_quotes/rules.rs b/src/flake8_quotes/rules.rs index 34ca9b28f0..6c89913734 100644 --- a/src/flake8_quotes/rules.rs +++ b/src/flake8_quotes/rules.rs @@ -36,8 +36,8 @@ fn good_multiline_ending(quote: &Quote) -> &str { fn good_docstring(quote: &Quote) -> &str { match quote { - Quote::Single => "'''", - Quote::Double => "\"\"\"", + Quote::Single => "'", + Quote::Double => "\"", } } diff --git a/src/flake8_quotes/snapshots/ruff__flake8_quotes__tests__double_docstring_docstring_doubles_function.py.snap b/src/flake8_quotes/snapshots/ruff__flake8_quotes__tests__double_docstring_docstring_doubles_function.py.snap index a9f236bc0a..d2bf8314f9 100644 --- a/src/flake8_quotes/snapshots/ruff__flake8_quotes__tests__double_docstring_docstring_doubles_function.py.snap +++ b/src/flake8_quotes/snapshots/ruff__flake8_quotes__tests__double_docstring_docstring_doubles_function.py.snap @@ -1,6 +1,6 @@ --- source: src/flake8_quotes/mod.rs -expression: checks +expression: diagnostics --- - kind: BadQuotesMultilineString: single @@ -45,10 +45,10 @@ expression: checks - kind: BadQuotesMultilineString: single location: - row: 21 + row: 22 column: 4 end_location: - row: 21 + row: 22 column: 27 fix: ~ parent: ~ diff --git a/src/flake8_quotes/snapshots/ruff__flake8_quotes__tests__double_docstring_docstring_singles_function.py.snap b/src/flake8_quotes/snapshots/ruff__flake8_quotes__tests__double_docstring_docstring_singles_function.py.snap index c2410a07ba..443c35a6f2 100644 --- a/src/flake8_quotes/snapshots/ruff__flake8_quotes__tests__double_docstring_docstring_singles_function.py.snap +++ b/src/flake8_quotes/snapshots/ruff__flake8_quotes__tests__double_docstring_docstring_singles_function.py.snap @@ -1,6 +1,6 @@ --- source: src/flake8_quotes/mod.rs -expression: checks +expression: diagnostics --- - kind: BadQuotesDocstring: double @@ -22,4 +22,14 @@ expression: checks column: 7 fix: ~ parent: ~ +- kind: + BadQuotesDocstring: double + location: + row: 27 + column: 4 + end_location: + row: 27 + column: 27 + fix: ~ + parent: ~ diff --git a/src/flake8_quotes/snapshots/ruff__flake8_quotes__tests__single_docstring_docstring_doubles_function.py.snap b/src/flake8_quotes/snapshots/ruff__flake8_quotes__tests__single_docstring_docstring_doubles_function.py.snap index bebac93144..390eb5725e 100644 --- a/src/flake8_quotes/snapshots/ruff__flake8_quotes__tests__single_docstring_docstring_doubles_function.py.snap +++ b/src/flake8_quotes/snapshots/ruff__flake8_quotes__tests__single_docstring_docstring_doubles_function.py.snap @@ -1,6 +1,6 @@ --- source: src/flake8_quotes/mod.rs -expression: checks +expression: diagnostics --- - kind: BadQuotesDocstring: single @@ -22,4 +22,14 @@ expression: checks column: 7 fix: ~ parent: ~ +- kind: + BadQuotesDocstring: single + location: + row: 27 + column: 4 + end_location: + row: 27 + column: 27 + fix: ~ + parent: ~ diff --git a/src/flake8_quotes/snapshots/ruff__flake8_quotes__tests__single_docstring_docstring_singles_function.py.snap b/src/flake8_quotes/snapshots/ruff__flake8_quotes__tests__single_docstring_docstring_singles_function.py.snap index e3423d34b9..ff00475247 100644 --- a/src/flake8_quotes/snapshots/ruff__flake8_quotes__tests__single_docstring_docstring_singles_function.py.snap +++ b/src/flake8_quotes/snapshots/ruff__flake8_quotes__tests__single_docstring_docstring_singles_function.py.snap @@ -1,6 +1,6 @@ --- source: src/flake8_quotes/mod.rs -expression: checks +expression: diagnostics --- - kind: BadQuotesMultilineString: double @@ -45,10 +45,10 @@ expression: checks - kind: BadQuotesMultilineString: double location: - row: 21 + row: 22 column: 4 end_location: - row: 21 + row: 22 column: 27 fix: ~ parent: ~