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

Add fixer to split multiple attributes in one opening attribute tag #7673

Open
mvorisek opened this issue Jan 4, 2024 · 4 comments
Open

Comments

@mvorisek
Copy link
Contributor

mvorisek commented Jan 4, 2024

Feature request

-#[A, B]
+#[A]
+#[B]
@Wirone
Copy link
Member

Wirone commented Jan 4, 2024

I think such a fixer should support both strategies and depending on the config it should group or ungroup attributes.

@julienfalque
Copy link
Member

PER allows both separate and grouped attributes but:

  1. grouped attributes must be on the same line
  2. attributes with multiline arguments must not be grouped

I think it would be nice if such fixer would support there rules.

I wonder what should be done for (1) though. Should we force grouped attributes to be on the same line when they can be and separate them otherwise? Always separate?

@Wirone
Copy link
Member

Wirone commented Jan 5, 2024

I wonder what should be done for (1) though. Should we force grouped attributes to be on the same line when they can be and separate them otherwise? Always separate?

The best would be a configurable strategy (single line vs. multi line). PER ruleset could use the former, while people could reconfigure it to use the latter. For multiline I would use this by default:

#[
    Foo(),
    Bar(),
]

but probably we could just enforce new line after comma and let separate fixer do the reformatting 🤔?

This comment was marked as outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants