Skip to content

Commit

Permalink
Enable review linter with exported docs check (netbirdio#1647)
Browse files Browse the repository at this point in the history
Exported function and methods should have comments. This warns on undocumented exported functions and methods.
  • Loading branch information
mlsmaycon authored Feb 29, 2024
1 parent 9e777a4 commit 069445e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
9 changes: 9 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ linters-settings:
enable:
- nilness

revive:
rules:
- name: exported
severity: warning
disabled: false
arguments:
- "checkPrivateReceivers"
- "sayRepetitiveInsteadOfStutters"
tenv:
# 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.
Expand Down Expand Up @@ -93,6 +101,7 @@ linters:
- 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
- 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
- thelper # thelper detects Go test helpers without t.Helper() call and checks the consistency of test helpers.
- wastedassign # wastedassign finds wasted assignment statements
Expand Down
2 changes: 1 addition & 1 deletion client/internal/auth/oauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type HTTPClient interface {
}

// AuthFlowInfo holds information for the OAuth 2.0 authorization flow
type AuthFlowInfo struct {
type AuthFlowInfo struct { //nolint:revive
DeviceCode string `json:"device_code"`
UserCode string `json:"user_code"`
VerificationURI string `json:"verification_uri"`
Expand Down
2 changes: 1 addition & 1 deletion iface/netstack/tun.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"golang.zx2c4.com/wireguard/tun/netstack"
)

type NetStackTun struct {
type NetStackTun struct { //nolint:revive
address string
mtu int
listenAddress string
Expand Down
2 changes: 1 addition & 1 deletion management/server/activity/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const (
)

// ActivityDescriber is an interface that describes an activity
type ActivityDescriber interface {
type ActivityDescriber interface { //nolint:revive
StringCode() string
Message() string
}
Expand Down
4 changes: 2 additions & 2 deletions management/server/peer/peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ type Peer struct {
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 time.Time
// Connected indicates whether peer is connected to the management service or not
Expand All @@ -72,7 +72,7 @@ type NetworkAddress struct {
}

// PeerSystemMeta is a metadata of a Peer machine system
type PeerSystemMeta struct {
type PeerSystemMeta struct { //nolint:revive
Hostname string
GoOS string
Kernel string
Expand Down

0 comments on commit 069445e

Please sign in to comment.