Skip to content

Commit

Permalink
Add cross-references between parameter-list-wrapping and `function-…
Browse files Browse the repository at this point in the history
…signature` rules as both deal with wrapping parameters.

Closes #2424
  • Loading branch information
paul-dingemans committed Dec 11, 2023
1 parent 8b51fb9 commit b8edd5c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion documentation/release-latest/docs/rules/standard.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ Rewrites the function signature to a single line when possible (e.g. when not ex

In `ktlint-official` code style, a function signature is always rewritten to a multiline signature in case the function has 2 or more parameters. This number of parameters can be set via `.editorconfig` property `ktlint_function_signature_rule_force_multiline_when_parameter_count_greater_or_equal_than`.

!!! note
Wrapping of parameters is also influenced by the `parameter-list-wrapping` rule.

=== "[:material-heart:](#) Ktlint"

```kotlin
Expand Down Expand Up @@ -2276,7 +2279,10 @@ Rule id: `multiline-expression-wrapping` (`standard` rule set)

### Parameter list wrapping

When class/function signature doesn't fit on a single line, each parameter must be on a separate line
When class/function signature doesn't fit on a single line, each parameter must be on a separate line.

!!! Note
Wrapping of parameters is also influenced by the `function-signature` rule.

=== "[:material-heart:](#) Ktlint"

Expand Down
8 changes: 7 additions & 1 deletion documentation/snapshot/docs/rules/standard.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ Rewrites the function signature to a single line when possible (e.g. when not ex

In `ktlint-official` code style, a function signature is always rewritten to a multiline signature in case the function has 2 or more parameters. This number of parameters can be set via `.editorconfig` property `ktlint_function_signature_rule_force_multiline_when_parameter_count_greater_or_equal_than`.

!!! note
Wrapping of parameters is also influenced by the `parameter-list-wrapping` rule.

=== "[:material-heart:](#) Ktlint"

```kotlin
Expand Down Expand Up @@ -2434,7 +2437,10 @@ Rule id: `multiline-expression-wrapping` (`standard` rule set)

### Parameter list wrapping

When class/function signature doesn't fit on a single line, each parameter must be on a separate line
When class/function signature doesn't fit on a single line, each parameter must be on a separate line.

!!! Note
Wrapping of parameters is also influenced by the `function-signature` rule.

=== "[:material-heart:](#) Ktlint"

Expand Down

0 comments on commit b8edd5c

Please sign in to comment.