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 undocumented deviation: wrapping with annotation only and comment #7322

Closed
JonathanPlasse opened this issue Sep 12, 2023 · 2 comments
Labels
formatter Related to the formatter wontfix This will not be worked on

Comments

@JonathanPlasse
Copy link
Contributor

Black formatting

class Animatable(Protocol):
    """Protocol for objects that can be animated."""

    animation_data: bpy.types.AnimData  # TODO(jonathan): Change to Optional when fake-bpy-module is updated

Ruff formatting

class Animatable(Protocol):
    """Protocol for objects that can be animated."""

    animation_data: (
        bpy.types.AnimData
    )  # TODO(jonathan): Change to Optional when fake-bpy-module is updated

Ruff 0.0.289 with line-length 100

I prefer Black formatting

@MichaReiser MichaReiser added the formatter Related to the formatter label Sep 13, 2023
@MichaReiser MichaReiser added this to the Formatter: Beta milestone Sep 13, 2023
@MichaReiser MichaReiser added the wontfix This will not be worked on label Sep 13, 2023
@MichaReiser
Copy link
Member

MichaReiser commented Sep 13, 2023

I can see how Black's formatting may seem better but Black's code exceeds the configured line width of 100, whereas Ruff's formatting stays in the limit.

Black is also a bit inconsistent here because it uses the same formatting as ruff if you change this to an assignment:

animation_data = (
    bpy.types.AnimData
)  # TODO(jonathan): Change to Optional when fake-bpy-module is updated

I propose that we stick to Ruff's layout because:

  • It is more consistent with other syntax
  • It stays within the configured line length

I'll leave this open for now to let other people chime in.

@MichaReiser
Copy link
Member

MichaReiser commented Sep 13, 2023

Closing as duplicate of 7315

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
formatter Related to the formatter wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants