Skip to content

Commit

Permalink
Update configuration and rules doc for error cuddling
Browse files Browse the repository at this point in the history
  • Loading branch information
krzysztofgb authored and krzysztof-fetch committed Sep 30, 2022
1 parent ae82899 commit a205a1d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions doc/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ if 1 == 1 {
}
```

### [enforce-err-cuddling](rules.md#if-statements-that-check-an-error-must-be-cuddled-with-the-statement-that-assigned-the-error)
### [force-err-cuddling](rules.md#if-statements-that-check-an-error-must-be-cuddled-with-the-statement-that-assigned-the-error)

Enforces that an `if` statement checking an error variable is cuddled with the line that assigned that error variable.

Expand Down Expand Up @@ -362,4 +362,4 @@ if err != nil {
```

**Note**: this means the option _overrides_ the
[enforce-err-cuddling](#enforce-err-cuddling) option above, among others.
[force-err-cuddling](#force-err-cuddling) option above, among others.
2 changes: 1 addition & 1 deletion doc/rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -1016,7 +1016,7 @@ switch inSwitch.(type) {
### If statements that check an error must be cuddled with the statement that assigned the error

> Can be configured, see [configuration
documentation](configuration.md#enforce-err-cuddling)
documentation](configuration.md#force-err-cuddling)

When an `if` statement checks a variable named `err`, which was assigned on the line above, it should be cuddled with that assignment. This makes clear the relationship between the error check and the call that may have resulted in an error.

Expand Down

0 comments on commit a205a1d

Please sign in to comment.