Skip to content

Commit

Permalink
chore: more linting
Browse files Browse the repository at this point in the history
  • Loading branch information
plyr4 committed Oct 29, 2024
1 parent 6ec7bbc commit a3d0821
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion compiler/types/yaml/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type Build struct {
Stages StageSlice `yaml:"stages,omitempty" json:"stages,omitempty" jsonschema:"oneof_required=stages,description=Provide parallel execution instructions.\nReference: https://go-vela.github.io/docs/reference/yaml/stages/"`
Steps StepSlice `yaml:"steps,omitempty" json:"steps,omitempty" jsonschema:"oneof_required=steps,description=Provide sequential execution instructions.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/"`
Templates TemplateSlice `yaml:"templates,omitempty" json:"templates,omitempty" jsonschema:"description=Provide the name of templates to expand.\nReference: https://go-vela.github.io/docs/reference/yaml/templates/"`
Git Git `yaml:"git,omitempty" json:"git,omitempty" jsonschema:"description=Provide the git access specifications.\nReference: https://go-vela.github.io/docs/reference/yaml/git/"`
Git Git `yaml:"git,omitempty" json:"git,omitempty" jsonschema:"description=Provide the git access specifications.\nReference: https://go-vela.github.io/docs/reference/yaml/git/"`
}

// ToPipelineAPI converts the Build type to an API Pipeline type.
Expand Down
2 changes: 1 addition & 1 deletion compiler/types/yaml/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type Git struct {
// Only applies when using GitHub App installations.
type Token struct {
Repositories []string `yaml:"repositories,omitempty" json:"repositories,omitempty" jsonschema:"description=Provide a list of repositories to clone.\nReference: https://go-vela.github.io/docs/reference/yaml/git/#repositories"`
Permissions map[string]string `yaml:"permissions,omitempty" json:"permissions,omitempty" jsonschema:"description=Provide a list of repository permissions to apply to the git token.\nReference: https://go-vela.github.io/docs/reference/yaml/git/#permissions"`
Permissions map[string]string `yaml:"permissions,omitempty" json:"permissions,omitempty" jsonschema:"description=Provide a list of repository permissions to apply to the git token.\nReference: https://go-vela.github.io/docs/reference/yaml/git/#permissions"`
}

// ToPipeline converts the Git type
Expand Down
10 changes: 4 additions & 6 deletions scm/github/app_transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ type AppsTransport struct {
Client Client // Client to use to refresh tokens, defaults to http.Client with provided transport
tr http.RoundTripper // tr is the underlying roundtripper being wrapped
signer Signer // signer signs JWT tokens.
//nolint:unused // ignore false positive
appID int64 // appID is the GitHub App's ID
appID int64 // appID is the GitHub App's ID
}

// NewAppsTransportFromPrivateKey returns an AppsTransport using a crypto/rsa.(*PrivateKey).
Expand Down Expand Up @@ -67,7 +66,7 @@ func (t *AppsTransport) RoundTrip(req *http.Request) (*http.Response, error) {

ss, err := t.signer.Sign(claims)
if err != nil {
return nil, fmt.Errorf("could not sign jwt: %s", err)
return nil, fmt.Errorf("could not sign jwt: %w", err)
}

req.Header.Set("Authorization", "Bearer "+ss)
Expand All @@ -87,7 +86,6 @@ type Transport struct {
BaseURL string // BaseURL is the scheme and host for GitHub API, defaults to https://api.github.com
Client Client // Client to use to refresh tokens, defaults to http.Client with provided transport
tr http.RoundTripper // tr is the underlying roundtripper being wrapped
appID int64 // appID is the GitHub App's ID
installationID int64 // installationID is the GitHub App Installation ID
InstallationTokenOptions *github.InstallationTokenOptions // parameters restrict a token's access
appsTransport *AppsTransport
Expand Down Expand Up @@ -137,8 +135,8 @@ func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error) {
}

reqBodyClosed = true
resp, err := t.tr.RoundTrip(creq)
return resp, err

return t.tr.RoundTrip(creq)
}

// getRefreshTime returns the time when the token should be refreshed.
Expand Down
5 changes: 2 additions & 3 deletions scm/github/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ func (c *client) processRepositoryEvent(h *api.Hook, payload *github.RepositoryE
}

// processInstallationEvent is a helper function to process the installation event.
func (c *client) processInstallationEvent(ctx context.Context, h *api.Hook, payload *github.InstallationEvent) (*internal.Webhook, error) {
func (c *client) processInstallationEvent(_ context.Context, h *api.Hook, payload *github.InstallationEvent) (*internal.Webhook, error) {
h.SetEvent(constants.EventRepository)
h.SetEventAction(payload.GetAction())

Expand All @@ -559,7 +559,6 @@ func (c *client) processInstallationEvent(ctx context.Context, h *api.Hook, payl
for _, repo := range payload.Repositories {
install.RepositoriesAdded = append(install.RepositoriesAdded, repo.GetName())
}
break
case "deleted":
for _, repo := range payload.Repositories {
install.RepositoriesRemoved = append(install.RepositoriesRemoved, repo.GetName())
Expand All @@ -573,7 +572,7 @@ func (c *client) processInstallationEvent(ctx context.Context, h *api.Hook, payl
}

// processInstallationRepositoriesEvent is a helper function to process the installation repositories event.
func (c *client) processInstallationRepositoriesEvent(ctx context.Context, h *api.Hook, payload *github.InstallationRepositoriesEvent) (*internal.Webhook, error) {
func (c *client) processInstallationRepositoriesEvent(_ context.Context, h *api.Hook, payload *github.InstallationRepositoriesEvent) (*internal.Webhook, error) {
install := new(internal.Installation)

install.Action = payload.GetAction()
Expand Down

0 comments on commit a3d0821

Please sign in to comment.