After I read this proposal I tought it would be nice to have a rule like "if there is more than x parameters in a function/tuple/array/dictionary there must be a newline between".
This rule can also be implemented without this proposal implemented.
The reason for this is makes it easier to review code. So the rule should be opt-in.
There could also be a configuration to state how many parameters there must be before newline is required.
It could also say that the trailing ) should be on a newline.
We could also have a configuration that require the ( to have a trailing newline
Examples:
// Not OK
func foo(bar: Bar, baz: Baz)
func foo(
bar: Bar,
baz: Baz)
// OK
func foo(bar: Bar)
func foo(
bar: Bar,
baz: Baz
)
Not sure if it should be the same rule, but when calling a function we could also require newline.
Examples:
// Not OK
someClass.foo(bar: "bar", baz: "baz")
someClass.foo(
bar: "bar",
baz: "baz")
// OK
someClass.foo(bar: "bar")
someClass.foo(
bar: "bar",
baz: "baz"
)
New Issue Checklist
New rule request
After I read this proposal I tought it would be nice to have a rule like "if there is more than x parameters in a function/tuple/array/dictionary there must be a newline between".
This rule can also be implemented without this proposal implemented.
The reason for this is makes it easier to review code. So the rule should be opt-in. There could also be a configuration to state how many parameters there must be before newline is required.
It could also say that the trailing
)
should be on a newline. We could also have a configuration that require the(
to have a trailing newlineExamples:
Not sure if it should be the same rule, but when calling a function we could also require newline.
Examples: