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

Format comment before parameter default correctly #7870

Merged
merged 1 commit into from
Oct 12, 2023
Merged

Format comment before parameter default correctly #7870

merged 1 commit into from
Oct 12, 2023

Commits on Oct 9, 2023

  1. Format comment before parameter default correctly

    **Handle comment before the default values of function parameters correctly by inserting a line break instead of space after the equals sign where required.
    
    ```python
    def f(
        a = # parameter trailing comment; needs line break (1)
        1,
        b =
        # default leading comment; needs line break (2)
        2,
        c = ( # the default leading can only be end-of-line with parentheses; no line break
            3
        ),
        d = (
            # own line leading comment with parentheses; no line break
            4
        )
    )
    ```
    
    Fixes #7603
    
    **Test Plan** Added the different cases and one more complex case as fixtures.
    konstin committed Oct 9, 2023
    Configuration menu
    Copy the full SHA
    4dadee8 View commit details
    Browse the repository at this point in the history