Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update configuration and rules doc for error cuddling #115

Merged
merged 1 commit into from
Sep 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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