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

wraparguments enforcement using a threshold #1697

Open
pafdad opened this issue May 14, 2024 · 0 comments
Open

wraparguments enforcement using a threshold #1697

pafdad opened this issue May 14, 2024 · 0 comments

Comments

@pafdad
Copy link

pafdad commented May 14, 2024

Hello and thank you for SwiftFormat

Using wraparguments, I'd like to be able to enforce a threshold as to the number of arguments that will cause this rule to be enforced.

For instance, in my code-base, if a function takes 1 argument, it's OK for it to be on the same line as the function name itself:

foo("bar") // <--- this should be OK

but if a function has 2 or more arguments, I'd like this rule to be enfoced:

foo("bar", "baz") // <--- this should throw an error

// this should be the correct way of calling the function
foo(
  "bar",
  "baz"
)

What I'm trying to do is to enforce this style throughout the code. Right now even if i have the following rules:

--wraparguments before-first
--wrapparameters before-first
--wrapcollections before-first

A programmer can still write code like this:

foo("bar", "baz")

Any help would be appreciated. Thank you

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

No branches or pull requests

1 participant