Skip to content

Commit

Permalink
Add missing reference in documentation for each rule to suppress or a…
Browse files Browse the repository at this point in the history
…djust `.editorconfig` (#2734)

Closes #2732
  • Loading branch information
paul-dingemans authored Jul 4, 2024
1 parent a694fc8 commit 6555f5d
Show file tree
Hide file tree
Showing 2 changed files with 262 additions and 6 deletions.
134 changes: 131 additions & 3 deletions documentation/release-latest/docs/rules/standard.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,15 @@ Suppress or disable rule (1)

1. Suppress rule in code with annotation below:
```kotlin
@Suppress("ktlint:standard:xxx")
@Suppress("ktlint:standard:blank-line-before-declaration")
```
Enable rule via `.editorconfig`
```editorconfig
ktlint_standard_xxx = enabled
ktlint_standard_blank-line-before-declaration = enabled
```
Disable rule via `.editorconfig`
```editorconfig
ktlint_standard_xxx = disabled
ktlint_standard_blank-line-before-declaration = disabled
```

!!! Note
Expand Down Expand Up @@ -3724,6 +3724,22 @@ Enforce consistent string template indentation for multiline string templates wh
Rule id: `standard:string-template-indent`
Suppress or disable rule (1)
{ .annotate }
1. Suppress rule in code with annotation below:
```kotlin
@Suppress("ktlint:string-template-indent")
```
Enable rule via `.editorconfig`
```editorconfig
ktlint_standard_string-template-indent = enabled
```
Disable rule via `.editorconfig`
```editorconfig
ktlint_standard_string-template-indent = disabled
```
!!! Note
This rule is only run when `ktlint_code_style` is set to `ktlint_official` or when the rule is enabled explicitly.
Expand Down Expand Up @@ -3929,6 +3945,22 @@ Disallows comments to be placed at certain locations inside a type parameter.

Rule id: `standard:type-parameter-comment`

Suppress or disable rule (1)
{ .annotate }

1. Suppress rule in code with annotation below:
```kotlin
@Suppress("ktlint:type-parameter-comment")
```
Enable rule via `.editorconfig`
```editorconfig
ktlint_standard_type-parameter-comment = enabled
```
Disable rule via `.editorconfig`
```editorconfig
ktlint_standard_type-parameter-comment = disabled
```

## Unnecessary parenthesis before trailing lambda

An empty parentheses block before a lambda is redundant.
Expand Down Expand Up @@ -3995,6 +4027,22 @@ Disallows comments to be placed at certain locations inside a value argument.

Rule id: `standard:value-argument-comment`

Suppress or disable rule (1)
{ .annotate }

1. Suppress rule in code with annotation below:
```kotlin
@Suppress("ktlint:value-argument-comment")
```
Enable rule via `.editorconfig`
```editorconfig
ktlint_standard_value-argument-comment = enabled
```
Disable rule via `.editorconfig`
```editorconfig
ktlint_standard_value-argument-comment = disabled
```

## Value parameter comment

Disallows comments to be placed at certain locations inside a value argument.
Expand Down Expand Up @@ -4129,6 +4177,22 @@ When wrapping chained calls `.`, `?.` and `?:` should be placed on the next line

Rule id: `standard:chain-wrapping`

Suppress or disable rule (1)
{ .annotate }

1. Suppress rule in code with annotation below:
```kotlin
@Suppress("ktlint:chain-wrapping")
```
Enable rule via `.editorconfig`
```editorconfig
ktlint_standard_chain-wrapping = enabled
```
Disable rule via `.editorconfig`
```editorconfig
ktlint_standard_chain-wrapping = disabled
```

### Comment wrapping

A block comment should start and end on a line that does not contain any other element.
Expand Down Expand Up @@ -4202,6 +4266,22 @@ Wraps each operand in a multiline condition to a separate line.

Rule id: `standard:condition-wrapping`

Suppress or disable rule (1)
{ .annotate }

1. Suppress rule in code with annotation below:
```kotlin
@Suppress("ktlint:condition-wrapping")
```
Enable rule via `.editorconfig`
```editorconfig
ktlint_standard_condition-wrapping = enabled
```
Disable rule via `.editorconfig`
```editorconfig
ktlint_standard_condition-wrapping = disabled
```

### Content receiver wrapping

Wraps the content receiver list to a separate line regardless of maximum line length. If the maximum line length is configured and is exceeded, wrap the context receivers and if needed its projection types to separate lines.
Expand Down Expand Up @@ -4309,6 +4389,22 @@ An enum should be a single line, or each enum entry has to be placed on a separa

Rule id: `standard:enum-wrapping`

Suppress or disable rule (1)
{ .annotate }

1. Suppress rule in code with annotation below:
```kotlin
@Suppress("ktlint:enum-wrapping")
```
Enable rule via `.editorconfig`
```editorconfig
ktlint_standard_enum-wrapping = enabled
```
Disable rule via `.editorconfig`
```editorconfig
ktlint_standard_enum-wrapping = disabled
```

### If else wrapping

A single line if-statement should be kept simple. It may contain no more than one else-branch. The branches may not be wrapped in a block.
Expand Down Expand Up @@ -4466,6 +4562,22 @@ When class/function signature doesn't fit on a single line, each parameter must
Rule id: `standard:parameter-list-wrapping`
Suppress or disable rule (1)
{ .annotate }
1. Suppress rule in code with annotation below:
```kotlin
@Suppress("ktlint:parameter-list-wrapping")
```
Enable rule via `.editorconfig`
```editorconfig
ktlint_standard_parameter-list-wrapping = enabled
```
Disable rule via `.editorconfig`
```editorconfig
ktlint_standard_parameter-list-wrapping = disabled
```
### Parameter wrapping
When a function or class parameter doesn't fit on a single line, wrap the type or value to a separate line
Expand Down Expand Up @@ -4554,6 +4666,22 @@ When a property doesn't fit on a single line, wrap the type or value to a separa
Rule id: `standard:property-wrapping`
Suppress or disable rule (1)
{ .annotate }
1. Suppress rule in code with annotation below:
```kotlin
@Suppress("ktlint:property-wrapping")
```
Enable rule via `.editorconfig`
```editorconfig
ktlint_standard_property-wrapping = enabled
```
Disable rule via `.editorconfig`
```editorconfig
ktlint_standard_property-wrapping = disabled
```
### Statement wrapping
A function, class/object body or other block body statement has to be placed on different line than the braces of the body block.
Expand Down
Loading

0 comments on commit 6555f5d

Please sign in to comment.