Skip to content

Commit

Permalink
Move module docstring test to preview
Browse files Browse the repository at this point in the history
  • Loading branch information
Glyphack committed Feb 2, 2024
1 parent 2cbafd2 commit 82f1d08
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 1,389 deletions.
Expand Up @@ -50,11 +50,5 @@
"docstring_code_line_width": "dynamic",
"indent_style": "space",
"indent_width": 4
},
{
"docstring_code": "enabled",
"preview": "enabled",
"indent_style": "space",
"indent_width": 4
}
]
@@ -1,5 +1,19 @@
"""
Black's `Preview.module_docstring_newlines`
A code black to format
.. code-block:: python
from bokeh.events import ButtonClick
from bokeh.models import Button
button = Button()
def callback(event ):
print('Python:Click')
button.on_event(ButtonClick, callback)
"""
first_stmt_after_module_level_docstring = 1

Expand Down
@@ -1,4 +1,4 @@
'single'
'single' # this string is treated as a docstring
"double"
r'r single'
r"r double"
Expand Down
2 changes: 1 addition & 1 deletion crates/ruff_python_formatter/src/preview.rs
Expand Up @@ -76,7 +76,7 @@ pub(crate) const fn is_multiline_string_handling_enabled(context: &PyFormatConte
}

/// Returns `true` if the [`multiline_string_handling`](https://github.com/astral-sh/ruff/pull/9725) preview style is enabled.
/// Black does not format docstrings https://github.com/psf/black/issues/3493 so we keep this
/// Black does not [`format docstrings`](https://github.com/psf/black/issues/3493) so we keep this
/// preview for compatibility with Black.
pub(crate) const fn is_format_module_docstring_enabled(context: &PyFormatContext) -> bool {
context.is_preview()
Expand Down

0 comments on commit 82f1d08

Please sign in to comment.