Skip to content

Commit 3a062d1

Browse files
authored
chore: Add new lint rule to make sure exported names documented (#3682)
1 parent dc807dd commit 3a062d1

13 files changed

+38
-6
lines changed

.golangci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ linters:
8484
- name: error-return
8585
- name: error-strings
8686
- name: errorf
87+
- name: exported
88+
arguments:
89+
- disableChecksOnConstants
90+
- disableChecksOnVariables
91+
- disableStutteringCheck
8792
- name: filename-format
8893
arguments:
8994
- ^[_a-z][_a-z0-9]*.go$

github/actions_workflow_runs.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ type PendingDeploymentsRequest struct {
106106
Comment string `json:"comment"`
107107
}
108108

109+
// ReferencedWorkflow represents a referenced workflow in a workflow run.
109110
type ReferencedWorkflow struct {
110111
Path *string `json:"path,omitempty"`
111112
SHA *string `json:"sha,omitempty"`

github/apps.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ type InstallationTokenOptions struct {
5656
Permissions *InstallationPermissions `json:"permissions,omitempty"`
5757
}
5858

59+
// InstallationTokenListRepoOptions allow restricting a token's access to a list of all repositories in an installation.
60+
// It differs from InstallationTokenOptions as a parameter which does not omit RepositoryIDs if that field is nil or an empty array.
5961
type InstallationTokenListRepoOptions struct {
6062
// The IDs of the repositories that the installation token can access.
6163
// Providing repository IDs restricts the access of an installation token to specific repositories.

github/copilot.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ type CopilotMetrics struct {
185185
CopilotDotcomPullRequests *CopilotDotcomPullRequests `json:"copilot_dotcom_pull_requests,omitempty"`
186186
}
187187

188+
// UnmarshalJSON implements the json.Unmarshaler interface.
188189
func (cp *CopilotSeatDetails) UnmarshalJSON(data []byte) error {
189190
// Using an alias to avoid infinite recursion when calling json.Unmarshal
190191
type alias CopilotSeatDetails

github/dependency_graph.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ import (
1010
"fmt"
1111
)
1212

13+
// DependencyGraphService handles communication with the dependency graph
14+
// related methods of the GitHub API.
15+
//
16+
// GitHub API docs: https://docs.github.com/rest/dependency-graph
1317
type DependencyGraphService service
1418

1519
// SBOM represents a software bill of materials, which describes the

github/git_commits.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ type MessageSigner interface {
3737
// MessageSignerFunc is a single function implementation of MessageSigner.
3838
type MessageSignerFunc func(w io.Writer, r io.Reader) error
3939

40+
// Sign implements the MessageSigner interface for MessageSignerFunc.
4041
func (f MessageSignerFunc) Sign(w io.Writer, r io.Reader) error {
4142
return f(w, r)
4243
}
@@ -110,6 +111,8 @@ type createCommit struct {
110111
Signature *string `json:"signature,omitempty"`
111112
}
112113

114+
// CreateCommitOptions specifies optional parameters to creates
115+
// a new commit in a repository.
113116
type CreateCommitOptions struct {
114117
// CreateCommit will sign the commit with this signer. See MessageSigner doc for more details.
115118
// Ignored on commits where Verification.Signature is defined.

github/git_trees.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ type treeEntryWithFileDelete struct {
5858
URL *string `json:"url,omitempty"`
5959
}
6060

61+
// MarshalJSON implements the json.Marshaler interface.
6162
func (t *TreeEntry) MarshalJSON() ([]byte, error) {
6263
if t.SHA == nil && t.Content == nil {
6364
return json.Marshal(struct {

github/github.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,6 +1392,7 @@ func (e *Error) Error() string {
13921392
e.Code, e.Field, e.Resource)
13931393
}
13941394

1395+
// UnmarshalJSON implements the json.Unmarshaler interface.
13951396
func (e *Error) UnmarshalJSON(data []byte) error {
13961397
type aliasError Error // avoid infinite recursion by using type alias.
13971398
if err := json.Unmarshal(data, (*aliasError)(e)); err != nil {
@@ -1494,6 +1495,7 @@ func parseBoolResponse(err error) (bool, error) {
14941495
return false, err
14951496
}
14961497

1498+
// RateLimitCategory represents the enumeration of rate limit categories.
14971499
type RateLimitCategory uint8
14981500

14991501
const (

github/orgs_audit_log.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ type AuditEntry struct {
5656
AdditionalFields map[string]any `json:"-"`
5757
}
5858

59+
// UnmarshalJSON implements the json.Unmarshaler interface.
5960
func (a *AuditEntry) UnmarshalJSON(data []byte) error {
6061
type entryAlias AuditEntry
6162
var v entryAlias
@@ -89,6 +90,7 @@ func (a *AuditEntry) UnmarshalJSON(data []byte) error {
8990
return nil
9091
}
9192

93+
// MarshalJSON implements the json.Marshaler interface.
9294
func (a *AuditEntry) MarshalJSON() ([]byte, error) {
9395
type entryAlias AuditEntry
9496
v := entryAlias(*a)

github/repos_tags.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ type tagProtectionRequest struct {
2222
Pattern string `json:"pattern"`
2323
}
2424

25-
// Deprecated: ListTagProtection lists tag protection of the specified repository.
26-
// Deprecation notice: This operation is deprecated and will be removed after August 30, 2024. Use the "Repository Rulesets" endpoint instead: https://docs.github.com/rest/repos/rules#get-all-repository-rulesets
25+
// ListTagProtection lists tag protection of the specified repository.
26+
//
27+
// Deprecated: This operation is deprecated and will be removed after August 30, 2024. Use the "Repository Rulesets" endpoint instead: https://docs.github.com/rest/repos/rules#get-all-repository-rulesets
2728
//
2829
// GitHub API docs: https://docs.github.com/rest/repos/tags#closing-down---list-tag-protection-states-for-a-repository
2930
//
@@ -45,8 +46,9 @@ func (s *RepositoriesService) ListTagProtection(ctx context.Context, owner, repo
4546
return tagProtections, resp, nil
4647
}
4748

48-
// Deprecated: CreateTagProtection creates the tag protection of the specified repository.
49-
// Deprecation notice: This operation is deprecated and will be removed after August 30, 2024. Use the "Repository Rulesets" endpoint instead: https://docs.github.com/rest/repos/rules#create-a-repository-ruleset
49+
// CreateTagProtection creates the tag protection of the specified repository.
50+
//
51+
// Deprecated: This operation is deprecated and will be removed after August 30, 2024. Use the "Repository Rulesets" endpoint instead: https://docs.github.com/rest/repos/rules#create-a-repository-ruleset
5052
//
5153
// GitHub API docs: https://docs.github.com/rest/repos/tags#closing-down---create-a-tag-protection-state-for-a-repository
5254
//
@@ -68,8 +70,9 @@ func (s *RepositoriesService) CreateTagProtection(ctx context.Context, owner, re
6870
return tagProtection, resp, nil
6971
}
7072

71-
// Deprecated: DeleteTagProtection deletes a tag protection from the specified repository.
72-
// Deprecation notice: This operation is deprecated and will be removed after August 30, 2024. Use the "Repository Rulesets" endpoint instead: https://docs.github.com/rest/repos/rules#delete-a-repository-ruleset
73+
// DeleteTagProtection deletes a tag protection from the specified repository.
74+
//
75+
// Deprecated: This operation is deprecated and will be removed after August 30, 2024. Use the "Repository Rulesets" endpoint instead: https://docs.github.com/rest/repos/rules#delete-a-repository-ruleset
7376
//
7477
// GitHub API docs: https://docs.github.com/rest/repos/tags#closing-down---delete-a-tag-protection-state-for-a-repository
7578
//

0 commit comments

Comments
 (0)