Skip to content
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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

teowa
Copy link

@teowa teowa commented Oct 9, 2023

from https://docs.github.com/en/rest/pulls/pulls?apiVersion=2022-11-28#list-pull-requests-files the PullRequests.listFiles by default returns 30 files, add a for loop to handle more files in PR.

Copy link
Owner

@katbyte katbyte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the pr @teowa

instead of complicating this file with the logic of getting files from gh, could we follow the pattern here: https://github.com/katbyte/tctest/blob/main/lib/gh/pr.go ?

and create ListAllPullRequestFiles / GetAllPullRequestFiles functions which should simplify this code?

as well as fix CI

thanks

@katbyte
Copy link
Owner

katbyte commented Oct 25, 2023

@teowa - CI is still failing

@teowa
Copy link
Author

teowa commented Oct 26, 2023

Seems the golangci-lint (version 1.47.3) panic while running CI, should we upgrade to the latest version?

@katbyte
Copy link
Owner

katbyte commented Nov 20, 2023

@teowa - if thats what it takes to fix it yes. thanks

Copy link
Author

@teowa teowa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some fix for golangci-lint run -v

cli/gh-pr.go Outdated
@@ -218,7 +218,6 @@ func (gr githubRepo) GetAllPullRequestFiles(pri int, filterRegExStr string) (*ma

return nil
})

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cli/gh-pr.go:221: File is not gofumpt-ed (gofumpt)

gh.Repo
}

func (f FlagData) NewRepo() githubRepo {
func (f FlagData) NewRepo() GithubRepo {
Copy link
Author

Choose a reason for hiding this comment

The 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)

func (f FlagData) NewRepo() githubRepo {
                            ^

@@ -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 {
Copy link
Author

Choose a reason for hiding this comment

The 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)

func NewTransport(name string, t http.RoundTripper) *transport {
                                                    ^

tc.Server
}

func (f FlagData) NewServer() tcServer {
Copy link
Author

Choose a reason for hiding this comment

The 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)

func (f FlagData) NewServer() tcServer {
                              ^

Comment on lines 99 to 103
} else {
//revive:disable:indent-error-flow
c.Printf(" milestone: <red>%s</> <gray>(%s)</>\n", filterMilestone, milestone)
return false, nil
}
Copy link
Author

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:99:11: indent-error-flow: if block ends with a return statement, so drop this else and outdent its block (revive)

                        } else {
                                c.Printf("    milestone: <red>%s</> <gray>(%s)</>\n", filterMilestone, milestone)
                                return false, nil
                        }

@@ -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
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lib/chttp/http.go:61:4: directive // nolint:errcheck should be written without leading space as //nolint:errcheck (nolintlint)

                        // nolint:errcheck
                        ^

@@ -89,14 +89,15 @@ func GetFilterForMilestone(milestoneRaw string) *Filter {
PR: func(pr github.PullRequest) (bool, error) {
milestone := pr.GetMilestone().GetTitle()

// nolint:gocritic
//nolint:gocritic
Copy link
Author

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)

                        // nolint:gocritic
                        ^

@@ -207,7 +208,7 @@ func GetFilterForLabels(labels []string, and bool) *Filter {
for filterLabel, negate := range filterLabelMap {
_, found := labelMap[filterLabel]

// nolint:gocritic
//nolint:gocritic
Copy link
Author

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:210:5: directive // nolint:gocritic should be written without leading space as //nolint:gocritic (nolintlint)

                                // nolint:gocritic
                                ^

@@ -94,7 +94,7 @@ func (gr githubRepo) PrTests(pri int, filterRegExStr, splitTestsAt string) (*map
}

// todo thread ctx
// nolint: noctx
//nolint: noctx
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cli/gh-pr.go:97:3: directive // nolint: noctx should be written without leading space as //nolint: noctx (nolintlint)

                // nolint: noctx
                ^

@@ -15,7 +15,6 @@ linters:
- bidichk
- containedctx
- contextcheck
- deadcode
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARN [runner] The linter 'varcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused.
WARN [runner] The linter 'deadcode' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused.
WARN [runner] The linter 'ifshort' is deprecated (since v1.48.0) due to: The repository of the linter has been deprecated by the owner.
WARN [runner] The linter 'structcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants