Skip to content

chore: enable a few revive rules #1330

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

Merged

Conversation

alexandear
Copy link
Collaborator

@alexandear alexandear commented Apr 30, 2025

The PR enables additional rules in revive.toml that is used to lint revive's codebase.

The following issues are fixed:

❯ revive -config revive.toml ./...
internal/typeparams/typeparams_go118.go:2:1: The build tag "// +build" is redundant since Go 1.17 and can be removed
cli/main.go:36:2: calls to os.Exit only in main() or init() functions
cli/main.go:47:3: calls to os.Exit only in main() or init() functions
cli/main.go:90:2: calls to os.Exit only in main() or init() functions
rule/max_public_structs.go:84:23: switch with only one case can be replaced by an if-then
rule/bool_literal_in_expr.go:39:26: switch with only one case can be replaced by an if-then
rule/confusing_naming.go:162:28: switch with only one case can be replaced by an if-then
rule/if_return.go:39:26: switch with only one case can be replaced by an if-then
rule/constant_logical_expr.go:38:26: switch with only one case can be replaced by an if-then
rule/struct_tag.go:139:26: switch with only one case can be replaced by an if-then
rule/enforce_repeated_arg_type_style.go:114:25: switch with only one case can be replaced by an if-then
rule/context_keys_type.go:45:23: switch with only one case can be replaced by an if-then
rule/unhandled_error.go:76:26: switch with only one case can be replaced by an if-then

@alexandear alexandear requested a review from denisvmedia April 30, 2025 10:24
@alexandear alexandear marked this pull request as ready for review April 30, 2025 10:25
@alexandear alexandear requested a review from chavacava April 30, 2025 10:25
@chavacava
Copy link
Collaborator

I think we could also add

comment-spacings
constant-logical-expr
identical-branches
unused-receiver

@alexandear alexandear merged commit a5e5d78 into mgechev:master May 1, 2025
7 checks passed
@alexandear alexandear deleted the chore/enable-few-revive-rules branch May 1, 2025 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants