You've already forked woodpecker
mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-07-12 22:21:40 +02:00
Add linter revive (#554)
* Add linter revive * Add underscore to variable name to prevent shadowing * Remove unnecessary leading underscore * Revert changes to vendor file * export ConfigFetcher as interface * no 'yoda conditions' * rename envsubst Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
@ -39,8 +39,8 @@ type User struct {
|
||||
|
||||
type Repository struct {
|
||||
Name string `json:"name"`
|
||||
HttpsURL string `json:"https_url"`
|
||||
SshURL string `json:"ssh_url"`
|
||||
HTTPSURL string `json:"https_url"`
|
||||
SSHURL string `json:"ssh_url"`
|
||||
WebURL string `json:"web_url"`
|
||||
Owner *User `json:"owner"`
|
||||
}
|
||||
@ -131,9 +131,9 @@ func findLastCommit(commits []*Commit, sha string) *Commit {
|
||||
func convertRepository(repo *Repository) (*model.Repo, error) {
|
||||
// tricky stuff for a team project without a team owner instead of a user owner
|
||||
re := regexp.MustCompile(`git@.+:([^/]+)/.+\.git`)
|
||||
matches := re.FindStringSubmatch(repo.SshURL)
|
||||
matches := re.FindStringSubmatch(repo.SSHURL)
|
||||
if len(matches) != 2 {
|
||||
return nil, fmt.Errorf("Unable to resolve owner from ssh url %q", repo.SshURL)
|
||||
return nil, fmt.Errorf("Unable to resolve owner from ssh url %q", repo.SSHURL)
|
||||
}
|
||||
|
||||
return &model.Repo{
|
||||
@ -173,7 +173,7 @@ func parsePushHook(raw []byte) (*model.Repo, *model.Build, error) {
|
||||
Email: lastCommit.Committer.Email,
|
||||
Avatar: hook.User.Avatar,
|
||||
Author: hook.User.GlobalKey,
|
||||
Remote: hook.Repository.HttpsURL,
|
||||
Remote: hook.Repository.HTTPSURL,
|
||||
}
|
||||
return repo, build, nil
|
||||
}
|
||||
@ -203,7 +203,7 @@ func parsePullRequestHook(raw []byte) (*model.Repo, *model.Build, error) {
|
||||
Author: hook.PullRequest.User.GlobalKey,
|
||||
Avatar: hook.PullRequest.User.Avatar,
|
||||
Title: hook.PullRequest.Title,
|
||||
Remote: hook.Repository.HttpsURL,
|
||||
Remote: hook.Repository.HTTPSURL,
|
||||
Refspec: fmt.Sprintf("%s:%s", hook.PullRequest.SourceBranch, hook.PullRequest.TargetBranch),
|
||||
}
|
||||
|
||||
@ -236,7 +236,7 @@ func parseMergeReuqestHook(raw []byte) (*model.Repo, *model.Build, error) {
|
||||
Author: hook.MergeRequest.User.GlobalKey,
|
||||
Avatar: hook.MergeRequest.User.Avatar,
|
||||
Title: hook.MergeRequest.Title,
|
||||
Remote: hook.Repository.HttpsURL,
|
||||
Remote: hook.Repository.HTTPSURL,
|
||||
Refspec: fmt.Sprintf("%s:%s", hook.MergeRequest.SourceBranch, hook.MergeRequest.TargetBranch),
|
||||
}
|
||||
return repo, build, nil
|
||||
|
Reference in New Issue
Block a user