Enable review linter with exported docs check (#1647)

Exported function and methods should have comments. This warns on undocumented exported functions and methods.
This commit is contained in:
Maycon Santos 2024-02-29 16:05:31 +01:00 committed by GitHub
parent 190698bcf2
commit 9a6814deff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 14 additions and 5 deletions

View File

@ -63,6 +63,14 @@ linters-settings:
enable: enable:
- nilness - nilness
revive:
rules:
- name: exported
severity: warning
disabled: false
arguments:
- "checkPrivateReceivers"
- "sayRepetitiveInsteadOfStutters"
tenv: tenv:
# The option `all` will run against whole test files (`_test.go`) regardless of method/function signatures. # The option `all` will run against whole test files (`_test.go`) regardless of method/function signatures.
# Otherwise, only methods that take `*testing.T`, `*testing.B`, and `testing.TB` as arguments are checked. # Otherwise, only methods that take `*testing.T`, `*testing.B`, and `testing.TB` as arguments are checked.
@ -93,6 +101,7 @@ linters:
- nilerr # finds the code that returns nil even if it checks that the error is not nil - nilerr # finds the code that returns nil even if it checks that the error is not nil
- nilnil # checks that there is no simultaneous return of nil error and an invalid value - nilnil # checks that there is no simultaneous return of nil error and an invalid value
- predeclared # predeclared finds code that shadows one of Go's predeclared identifiers - predeclared # predeclared finds code that shadows one of Go's predeclared identifiers
- revive # Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint.
- sqlclosecheck # checks that sql.Rows and sql.Stmt are closed - sqlclosecheck # checks that sql.Rows and sql.Stmt are closed
- thelper # thelper detects Go test helpers without t.Helper() call and checks the consistency of test helpers. - thelper # thelper detects Go test helpers without t.Helper() call and checks the consistency of test helpers.
- wastedassign # wastedassign finds wasted assignment statements - wastedassign # wastedassign finds wasted assignment statements

View File

@ -26,7 +26,7 @@ type HTTPClient interface {
} }
// AuthFlowInfo holds information for the OAuth 2.0 authorization flow // AuthFlowInfo holds information for the OAuth 2.0 authorization flow
type AuthFlowInfo struct { type AuthFlowInfo struct { //nolint:revive
DeviceCode string `json:"device_code"` DeviceCode string `json:"device_code"`
UserCode string `json:"user_code"` UserCode string `json:"user_code"`
VerificationURI string `json:"verification_uri"` VerificationURI string `json:"verification_uri"`

View File

@ -8,7 +8,7 @@ import (
"golang.zx2c4.com/wireguard/tun/netstack" "golang.zx2c4.com/wireguard/tun/netstack"
) )
type NetStackTun struct { type NetStackTun struct { //nolint:revive
address string address string
mtu int mtu int
listenAddress string listenAddress string

View File

@ -9,7 +9,7 @@ const (
) )
// ActivityDescriber is an interface that describes an activity // ActivityDescriber is an interface that describes an activity
type ActivityDescriber interface { type ActivityDescriber interface { //nolint:revive
StringCode() string StringCode() string
Message() string Message() string
} }

View File

@ -46,7 +46,7 @@ type Peer struct {
Location Location `gorm:"embedded;embeddedPrefix:location_"` Location Location `gorm:"embedded;embeddedPrefix:location_"`
} }
type PeerStatus struct { type PeerStatus struct { //nolint:revive
// LastSeen is the last time peer was connected to the management service // LastSeen is the last time peer was connected to the management service
LastSeen time.Time LastSeen time.Time
// Connected indicates whether peer is connected to the management service or not // Connected indicates whether peer is connected to the management service or not
@ -72,7 +72,7 @@ type NetworkAddress struct {
} }
// PeerSystemMeta is a metadata of a Peer machine system // PeerSystemMeta is a metadata of a Peer machine system
type PeerSystemMeta struct { type PeerSystemMeta struct { //nolint:revive
Hostname string Hostname string
GoOS string GoOS string
Kernel string Kernel string