-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
handle PR files pages #60
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,14 +89,15 @@ func GetFilterForMilestone(milestoneRaw string) *Filter { | |
PR: func(pr github.PullRequest) (bool, error) { | ||
milestone := pr.GetMilestone().GetTitle() | ||
|
||
// nolint:gocritic | ||
//nolint:gocritic | ||
if strings.EqualFold(filterMilestone, milestone) && !negate { | ||
c.Printf(" milestone: <green>%s</> <gray>(%s)</>\n", filterMilestone, milestone) | ||
return true, nil | ||
} else if negate { | ||
c.Printf(" milestone: <green>-%s</> <gray>(%s)</>\n", filterMilestone, milestone) | ||
return true, nil | ||
} else { | ||
//revive:disable:indent-error-flow | ||
c.Printf(" milestone: <red>%s</> <gray>(%s)</>\n", filterMilestone, milestone) | ||
return false, nil | ||
} | ||
Comment on lines
99
to
103
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cli/gh-pr-filters.go:99:11: indent-error-flow: if block ends with a return statement, so drop this else and outdent its block (revive)
|
||
|
@@ -207,7 +208,7 @@ func GetFilterForLabels(labels []string, and bool) *Filter { | |
for filterLabel, negate := range filterLabelMap { | ||
_, found := labelMap[filterLabel] | ||
|
||
// nolint:gocritic | ||
//nolint:gocritic | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cli/gh-pr-filters.go:210:5: directive
|
||
if found && !negate { | ||
orPass = true | ||
c.Printf(" <green>%s</>", filterLabel) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,7 +43,7 @@ func (f FlagData) GetPrTests(pr int) (*map[string][]string, error) { | |
} | ||
|
||
// todo break this apart - get/check PR state, get files, filter/process files, get tests, get services. | ||
func (gr githubRepo) PrTests(pri int, filterRegExStr, splitTestsAt string) (*map[string][]string, error) { | ||
func (gr GithubRepo) PrTests(pri int, filterRegExStr, splitTestsAt string) (*map[string][]string, error) { | ||
client, ctx := gr.NewClient() | ||
httpClient := chttp.NewHTTPClient("HTTP") | ||
|
||
|
@@ -94,7 +94,7 @@ func (gr githubRepo) PrTests(pri int, filterRegExStr, splitTestsAt string) (*map | |
} | ||
|
||
// todo thread ctx | ||
// nolint: noctx | ||
//nolint: noctx | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cli/gh-pr.go:97:3: directive
|
||
resp, err := httpClient.Get(*fileContents.DownloadURL) | ||
if err != nil { | ||
return nil, fmt.Errorf("downloading file (%s): %w", f, err) | ||
|
@@ -151,7 +151,7 @@ func (gr githubRepo) PrTests(pri int, filterRegExStr, splitTestsAt string) (*map | |
return &serviceTests, nil | ||
} | ||
|
||
func (gr githubRepo) ListAllPullRequestFiles(pri int, cb func([]*github.CommitFile, *github.Response) error) error { | ||
func (gr GithubRepo) ListAllPullRequestFiles(pri int, cb func([]*github.CommitFile, *github.Response) error) error { | ||
client, ctx := gr.NewClient() | ||
|
||
opts := &github.ListOptions{ | ||
|
@@ -179,7 +179,7 @@ func (gr githubRepo) ListAllPullRequestFiles(pri int, cb func([]*github.CommitFi | |
return nil | ||
} | ||
|
||
func (gr githubRepo) GetAllPullRequestFiles(pri int, filterRegExStr string) (*map[string]struct{}, error) { | ||
func (gr GithubRepo) GetAllPullRequestFiles(pri int, filterRegExStr string) (*map[string]struct{}, error) { | ||
result := make(map[string]struct{}) | ||
filterRegEx := regexp.MustCompile(filterRegExStr) | ||
|
||
|
@@ -218,7 +218,6 @@ func (gr githubRepo) GetAllPullRequestFiles(pri int, filterRegExStr string) (*ma | |
|
||
return nil | ||
}) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cli/gh-pr.go:221: File is not |
||
if err != nil { | ||
return nil, fmt.Errorf("failed to get all files for %s/%s/pull/%d: %w", gr.Owner, gr.Name, pri, err) | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,11 +8,11 @@ import ( | |
) | ||
|
||
// wrap the common gh lib shared with my other tools. splits common GH code from this CLI tool's specific tooling code | ||
type githubRepo struct { | ||
type GithubRepo struct { | ||
gh.Repo | ||
} | ||
|
||
func (f FlagData) NewRepo() githubRepo { | ||
func (f FlagData) NewRepo() GithubRepo { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cli/gh.go:15:29: unexported-return: exported method NewRepo returns unexported type cli.githubRepo, which can be annoying to use (revive)
|
||
ownerrepo := f.GH.Repo | ||
|
||
parts := strings.Split(ownerrepo, "/") | ||
|
@@ -24,5 +24,5 @@ func (f FlagData) NewRepo() githubRepo { | |
token := f.GH.Token | ||
clog.Log.Debugf("new gh: %s@%s/%s", token, owner, repo) | ||
|
||
return githubRepo{gh.NewRepo(owner, repo, token)} | ||
return GithubRepo{gh.NewRepo(owner, repo, token)} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,10 +5,10 @@ import ( | |
) | ||
|
||
// wrap the common gh lib shared with my other tools. splits common GH code from this CLI tool's specific tooling code | ||
type tcServer struct { | ||
type TcServer struct { | ||
tc.Server | ||
} | ||
|
||
func (f FlagData) NewServer() tcServer { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cli/tc.go:12:31: unexported-return: exported method NewServer returns unexported type cli.tcServer, which can be annoying to use (revive)
|
||
return tcServer{tc.NewServer(f.TC.ServerURL, f.TC.Token, f.TC.User, f.TC.Pass)} | ||
func (f FlagData) NewServer() TcServer { | ||
return TcServer{tc.NewServer(f.TC.ServerURL, f.TC.Token, f.TC.User, f.TC.Pass)} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,12 +18,12 @@ func NewHTTPClient(name string) *http.Client { | |
} | ||
} | ||
|
||
type transport struct { | ||
type Transport struct { | ||
name string | ||
transport http.RoundTripper | ||
} | ||
|
||
func (t *transport) RoundTrip(req *http.Request) (*http.Response, error) { | ||
func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error) { | ||
reqData, err := httputil.DumpRequestOut(req, true) | ||
|
||
if err == nil { | ||
|
@@ -47,8 +47,8 @@ func (t *transport) RoundTrip(req *http.Request) (*http.Response, error) { | |
return resp, nil | ||
} | ||
|
||
func NewTransport(name string, t http.RoundTripper) *transport { | ||
return &transport{name, t} | ||
func NewTransport(name string, t http.RoundTripper) *Transport { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lib/chttp/http.go:50:53: unexported-return: exported func NewTransport returns unexported type *chttp.transport, which can be annoying to use (revive)
|
||
return &Transport{name, t} | ||
} | ||
|
||
// prettyPrintJSON iterates through a []byte line-by-line, | ||
|
@@ -58,7 +58,7 @@ func prettyPrintJSON(b []byte) string { | |
for i, p := range parts { | ||
if b := []byte(p); json.Valid(b) { | ||
var out bytes.Buffer | ||
// nolint:errcheck | ||
//nolint:errcheck | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lib/chttp/http.go:61:4: directive
|
||
json.Indent(&out, b, "", " ") | ||
parts[i] = out.String() | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cli/gh-pr-filters.go:92:4: directive
// nolint:gocritic
should be written without leading space as//nolint:gocritic
(nolintlint)