Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formatter: no_blank_line_before_class_docstring preview style #8888

Closed
Tracked by #8678
MichaReiser opened this issue Nov 29, 2023 · 0 comments · Fixed by #9154
Closed
Tracked by #8678

Formatter: no_blank_line_before_class_docstring preview style #8888

MichaReiser opened this issue Nov 29, 2023 · 0 comments · Fixed by #9154
Assignees
Labels
formatter Related to the formatter help wanted Contributions especially welcome preview Related to preview mode features

Comments

@MichaReiser
Copy link
Member

MichaReiser commented Nov 29, 2023

Implement the no_blank_lines_before_class_docstring as a preview style.

The new style aligns the docstring formatting between functions and classes.

class C:

    """The line above stays."""

Gets reformatted to

class C:
    """The line above stays."""

as it is already the case for functions.

Task: Copy over the test files, implement the new style behind a preview flag.

@MichaReiser MichaReiser changed the title no_blank_line_before_class_docstring: Aligns the docstring formatting between functions and classes. Seems reasonable. Formatter: no_blank_line_before_class_docstring Nov 29, 2023
@MichaReiser MichaReiser added formatter Related to the formatter preview Related to preview mode features labels Nov 29, 2023
@MichaReiser MichaReiser added this to the Formatter: Stable milestone Nov 29, 2023
@MichaReiser MichaReiser added the help wanted Contributions especially welcome label Nov 29, 2023
@MichaReiser MichaReiser changed the title Formatter: no_blank_line_before_class_docstring Formatter: no_blank_line_before_class_docstring preview style Nov 29, 2023
@dhruvmanila dhruvmanila self-assigned this Dec 15, 2023
dhruvmanila added a commit that referenced this issue Dec 19, 2023
## Summary

This PR implements the `no_blank_line_before_class_docstring` preview
style.

## Test Plan

Update existing snapshots.

### Formatter ecosystem

`main`

| project | similarity index | total files | changed files |
|----------------|------------------:|------------------:|------------------:|
| cpython | 0.75804 | 1799 | 1648 |
| django | 0.99984 | 2772 | 34 |
| home-assistant | 0.99955 | 10596 | 213 |
| poetry | 0.99905 | 321 | 15 |
| transformers | 0.99967 | 2657 | 324 |
| twine | 1.00000 | 33 | 0 |
| typeshed | 0.99980 | 3669 | 18 |
| warehouse | 0.99976 | 654 | 14 |
| zulip | 0.99958 | 1459 | 36 |

`dhruv/no-blank-line-docstring`

| project | similarity index | total files | changed files |
|----------------|------------------:|------------------:|------------------:|
| cpython | 0.75804 | 1799 | 1648 |
| django | 0.99984 | 2772 | 34 |
| home-assistant | 0.99955 | 10596 | 213 |
| poetry | 0.99905 | 321 | 15 |
| transformers | 0.99967 | 2657 | 324 |
| twine | 1.00000 | 33 | 0 |
| typeshed | 0.99980 | 3669 | 18 |
| warehouse | 0.99976 | 654 | 14 |
| zulip | 0.99958 | 1459 | 36 |

fixes: #8888
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
formatter Related to the formatter help wanted Contributions especially welcome preview Related to preview mode features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants