Skip to content

Commit 66ed84d

Browse files
authored
Lint godoc comments (#2972)
1 parent 3c49fd9 commit 66ed84d

19 files changed

+61
-40
lines changed

.golangci.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,13 @@ linters:
1818
linters-settings:
1919
gosec:
2020
excludes:
21+
# duplicates errcheck
22+
- G104
2123
# performance issue: see https://github.com/golangci/golangci-lint/issues/4039
2224
# and https://github.com/securego/gosec/issues/1007
2325
- G602
2426
issues:
27+
exclude-use-default: false
2528
exclude-rules:
2629
- linters:
2730
- dupl
@@ -38,3 +41,13 @@ issues:
3841
# We need to use sha1 for validating signatures
3942
- linters: [ gosec ]
4043
text: 'G505: Blocklisted import crypto/sha1: weak cryptographic primitive'
44+
45+
# This is adapted from golangci-lint's default exclusions. It disables linting for error checks on
46+
# os.RemoveAll and any function ending in "Close".
47+
- linters: [ errcheck ]
48+
text: Error return value of .(.*Close|os\.Remove(All)?). is not checked
49+
50+
# We don't care about file inclusion via variable in examples or internal tools.
51+
- linters: [ gosec ]
52+
text: 'G304: Potential file inclusion via variable'
53+
path: '^(example|update-urls)\/'

github/actions_permissions_enterprise.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"fmt"
1111
)
1212

13-
// ActionsEnabledOnEnterpriseOrgs represents all the repositories in an enterprise for which Actions is enabled.
13+
// ActionsEnabledOnEnterpriseRepos represents all the repositories in an enterprise for which Actions is enabled.
1414
type ActionsEnabledOnEnterpriseRepos struct {
1515
TotalCount int `json:"total_count"`
1616
Organizations []*Organization `json:"organizations"`

github/actions_permissions_orgs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ func (s *ActionsService) AddEnabledReposInOrg(ctx context.Context, owner string,
145145
return resp, nil
146146
}
147147

148-
// RemoveEnabledRepoInOrg removes a single repository from the list of enabled repos for GitHub Actions in an organization.
148+
// RemoveEnabledReposInOrg removes a single repository from the list of enabled repos for GitHub Actions in an organization.
149149
//
150150
// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#disable-a-selected-repository-for-github-actions-in-an-organization
151151
func (s *ActionsService) RemoveEnabledReposInOrg(ctx context.Context, owner string, repositoryID int64) (*Response, error) {

github/codesofconduct.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ func (s *CodesOfConductService) List(ctx context.Context) ([]*CodeOfConduct, *Re
4646
return cs, resp, nil
4747
}
4848

49-
// ListCodesOfConduct
49+
// ListCodesOfConduct returns all codes of conduct.
50+
//
5051
// Deprecated: Use CodesOfConductService.List instead
5152
func (c *Client) ListCodesOfConduct(ctx context.Context) ([]*CodeOfConduct, *Response, error) {
5253
return c.CodesOfConduct.List(ctx)
@@ -74,7 +75,8 @@ func (s *CodesOfConductService) Get(ctx context.Context, key string) (*CodeOfCon
7475
return coc, resp, nil
7576
}
7677

77-
// GetCodeOfConduct
78+
// GetCodeOfConduct returns an individual code of conduct.
79+
//
7880
// Deprecated: Use CodesOfConductService.Get instead
7981
func (c *Client) GetCodeOfConduct(ctx context.Context, key string) (*CodeOfConduct, *Response, error) {
8082
return c.CodesOfConduct.Get(ctx, key)

github/codespaces.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func (s *CodespacesService) ListInRepo(ctx context.Context, owner, repo string,
112112
return codespaces, resp, nil
113113
}
114114

115-
// ListOptions represents the options for listing codespaces for a user.
115+
// ListCodespacesOptions represents the options for listing codespaces for a user.
116116
type ListCodespacesOptions struct {
117117
ListOptions
118118
RepositoryID int64 `url:"repository_id,omitempty"`

github/emojis.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ func (s *EmojisService) List(ctx context.Context) (map[string]string, *Response,
3030
return emoji, resp, nil
3131
}
3232

33-
// ListEmojis
33+
// ListEmojis returns the emojis available to use on GitHub.
34+
//
3435
// Deprecated: Use EmojisService.List instead
3536
func (c *Client) ListEmojis(ctx context.Context) (map[string]string, *Response, error) {
3637
return c.Emojis.List(ctx)

github/event_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1069,7 +1069,7 @@ type ArchivedAt struct {
10691069
To *Timestamp `json:"to,omitempty"`
10701070
}
10711071

1072-
// ProjectsV2 represents an item belonging to a project.
1072+
// ProjectV2Item represents an item belonging to a project.
10731073
type ProjectV2Item struct {
10741074
ID *int64 `json:"id,omitempty"`
10751075
NodeID *string `json:"node_id,omitempty"`

github/issues.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ func (s *IssuesService) Edit(ctx context.Context, owner string, repo string, num
303303
return i, resp, nil
304304
}
305305

306-
// Remove a milestone from an issue.
306+
// RemoveMilestone removes a milestone from an issue.
307307
//
308308
// This is a helper method to explicitly update an issue with a `null` milestone, thereby removing it.
309309
//

github/messages.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ func ParseWebHook(messageType string, payload []byte) (interface{}, error) {
326326
return event.ParsePayload()
327327
}
328328

329-
// WebhookTypes returns a sorted list of all the known GitHub event type strings
329+
// MessageTypes returns a sorted list of all the known GitHub event type strings
330330
// supported by go-github.
331331
func MessageTypes() []string {
332332
types := make([]string, 0, len(eventTypeMapping))

github/meta.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ func (s *MetaService) Get(ctx context.Context) (*APIMeta, *Response, error) {
8787
return meta, resp, nil
8888
}
8989

90-
// APIMeta
90+
// APIMeta returns information about GitHub.com.
91+
//
9192
// Deprecated: Use MetaService.Get instead.
9293
func (c *Client) APIMeta(ctx context.Context) (*APIMeta, *Response, error) {
9394
return c.Meta.Get(ctx)
@@ -117,7 +118,9 @@ func (s *MetaService) Octocat(ctx context.Context, message string) (string, *Res
117118
return buf.String(), resp, nil
118119
}
119120

120-
// Octocat
121+
// Octocat returns an ASCII art octocat with the specified message in a speech
122+
// bubble. If message is empty, a random zen phrase is used.
123+
//
121124
// Deprecated: Use MetaService.Octocat instead.
122125
func (c *Client) Octocat(ctx context.Context, message string) (string, *Response, error) {
123126
return c.Meta.Octocat(ctx, message)
@@ -143,7 +146,8 @@ func (s *MetaService) Zen(ctx context.Context) (string, *Response, error) {
143146
return buf.String(), resp, nil
144147
}
145148

146-
// Zen
149+
// Zen returns a random line from The Zen of GitHub.
150+
//
147151
// Deprecated: Use MetaService.Zen instead.
148152
func (c *Client) Zen(ctx context.Context) (string, *Response, error) {
149153
return c.Meta.Zen(ctx)

0 commit comments

Comments
 (0)