Skip to content

Commit

Permalink
Merge pull request #115 from krzysztofgb/error-cuddling-doc-fix
Browse files Browse the repository at this point in the history
Update configuration and rules doc for error cuddling
  • Loading branch information
bombsimon authored Sep 30, 2022
2 parents ae82899 + a205a1d commit 3e0a4f4
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 3e0a4f4

Please sign in to comment.