diff --git a/tools/internal/githistory/history.go b/tools/internal/githistory/history.go index a40dcea00..a3c6c06ba 100644 --- a/tools/internal/githistory/history.go +++ b/tools/internal/githistory/history.go @@ -11,7 +11,7 @@ import ( "strings" ) -// PRInfo lists commit metadata for a given GitHub PR. +// PRInfo lists commit metadata for a given Github PR. type PRInfo struct { Num int // CommitHash is the git hash in which the PSL contains the @@ -69,7 +69,7 @@ func GetPRInfo(gitPath string) (*History, error) { parents := strings.Split(parentsStr, " ") // For merge commits, we have multiple parents, and we want // the "main branch" side of the merge, i.e. the state of the - // tree before the PR was merged. Empirically, GitHub always + // tree before the PR was merged. Empirically, Github always // lists that commit as the 1st parent in merge commits. // // For squash commits, there is only one parent. @@ -86,7 +86,7 @@ func GetPRInfo(gitPath string) (*History, error) { if len(ms) != 3 { // The grep on git log returned a false positive where the // PR number is not on the first line of the commit - // message. This is not a commit in the standard GitHub + // message. This is not a commit in the standard github // format for PRs. continue } @@ -130,8 +130,8 @@ func GetPSL(gitPath string, hash string) ([]byte, error) { } // Matches either "(#1234)" at the end of a line, or "Merge pull -// request #1234 from" at the start of a line. The first is how GitHub -// formats squash-and-merge commits, the second is how GitHub formats +// request #1234 from" at the start of a line. The first is how github +// formats squash-and-merge commits, the second is how github formats // 2-parent merge commits. var prNumberRe = regexp.MustCompile(`(?:\(#(\d+)\)$)|(?:^Merge pull request #(\d+) from)`) diff --git a/tools/internal/github/pr.go b/tools/internal/github/pr.go index d27ec83d5..69e683d89 100644 --- a/tools/internal/github/pr.go +++ b/tools/internal/github/pr.go @@ -1,4 +1,4 @@ -// Package GitHub provides a GitHub client with functions tailored to +// Package github provides a github client with functions tailored to // the PSL's needs. package github @@ -16,7 +16,7 @@ import ( // operations. The zero value is a client that interacts with the // official publicsuffix/list repository. type Repo struct { - // Owner is the GitHub account of the repository to query. If + // Owner is the github account of the repository to query. If // empty, defaults to "publicsuffix". Owner string // Repo is the repository to query. If empty, defaults to "list". @@ -53,7 +53,7 @@ func (c *Repo) apiClient() *github.Client { // given pull request. Returns the PSL file for the target branch, and // the same but with the PR's changes applied. func (c *Repo) PSLForPullRequest(ctx context.Context, prNum int) (withoutPR, withPR []byte, err error) { - // GitHub sometimes needs a little time to think to update the PR + // Github sometimes needs a little time to think to update the PR // state, so we might need to sleep and retry a few times. Usually // the status updates in <5s, but just for safety, give it a more // generous timeout. @@ -99,7 +99,7 @@ var errMergeInfoNotReady = errors.New("PR mergeability information not available // no unrelated changes. // // For an unmerged PR, "after" is a "trial merge commit" created -// automatically by GitHub to run CI and check that the PR is +// automatically by Github to run CI and check that the PR is // mergeable, and "before" is the master branch state from that trial // merge - usually the latest current state. // @@ -108,7 +108,7 @@ var errMergeInfoNotReady = errors.New("PR mergeability information not available // before that. // // getPRCommitInfo returns the sentinel error errMergeInfoNotReady if -// an open PR exists, but GitHub needs a bit more time to update the +// an open PR exists, but github needs a bit more time to update the // trial merge commit. The caller is expected to retry with // appropriate backoff. func (c *Repo) getPRCommitInfo(ctx context.Context, prNum int) (withoutPRCommit, withPRCommit string, err error) { @@ -135,7 +135,7 @@ func (c *Repo) getPRCommitInfo(ctx context.Context, prNum int) (withoutPRCommit, // the pre-PR commit is simply the parent of the merge commit. beforeMergeCommit = commitInfo.Parents[0].GetSHA() } else if pr.Mergeable == nil { - // PR isn't merged, but GitHub needs time to rebase the PR and + // PR isn't merged, but github needs time to rebase the PR and // create a trial merge. Unfortunately the only way to know // when it's done is to just poll and wait for the mergeable // bool to be valid. diff --git a/tools/internal/parser/exceptions.go b/tools/internal/parser/exceptions.go index c1c67dece..caa58a79a 100644 --- a/tools/internal/parser/exceptions.go +++ b/tools/internal/parser/exceptions.go @@ -46,7 +46,7 @@ func adjustTXTPR(prNum int) int { // acceptPRForDomain reports whether the given prNum should be // accepted as verification for the given domain, without further -// checking of the GitHub PR. +// checking of the Github PR. func acceptPRForDomain(domain domain.Name, prNum int) bool { if exc, ok := txtAcceptPRs[domain.String()]; ok && exc == prNum { return true @@ -767,7 +767,7 @@ var txtReplacePRs = map[int]int{ // // This is to work around situations similar to txtReplacePRs, where // the suffix owners followed all the rules, but the change was either -// merged separately from the PR, or GitHub's API has bad data and +// merged separately from the PR, or Github's API has bad data and // returns bogus information that prevents us from tracing the change. var txtAcceptPRs = map[string]int{ // Change pushed to master by maintainer rather than merging PR. diff --git a/tools/internal/parser/validate.go b/tools/internal/parser/validate.go index d8e347721..b7f783d53 100644 --- a/tools/internal/parser/validate.go +++ b/tools/internal/parser/validate.go @@ -143,8 +143,8 @@ const ( // false positives. concurrentDNSRequests = 10 // concurrentGithubRequests is the maximum number of in-flight - // GitHub API requests. This is limited to avoid tripping GitHub - // DoS protections. GitHub seems to have made their rate limits + // Github API requests. This is limited to avoid tripping Github + // DoS protections. Github seems to have made their rate limits // more aggressive recently, so we stick to something very slow. concurrentGithubRequests = 10 @@ -170,7 +170,7 @@ type txtRecordChecker struct { // (e.g. user hit ctrl+c, or timeout was reached) ctx context.Context - // gh is the GitHub API client used to look up PRs and commits. + // gh is the Github API client used to look up PRs and commits. gh *github.Repo // resolver is the DNS resolver used to do TXT lookups. resolver net.Resolver @@ -182,7 +182,7 @@ type txtRecordChecker struct { // prExpected records what changes we expect to see in PRs, based // on TXT lookups. For example, if a TXT lookup for _psl.foo.com // points to PR 123, this map will have an entry for 123 -> - // {suffixes: [foo.com]}, meaning if we look at PR 123 on GitHub, + // {suffixes: [foo.com]}, meaning if we look at PR 123 on github, // we want to see a change for foo.com. prExpected map[int]*prExpected @@ -200,10 +200,10 @@ func validateTXTRecords(ctx context.Context, b Block, client *github.Repo, prHis } // TXT checking happens in two phases: first, look up all TXT - // records and construct a map of suffix<>GitHub PR map (and + // records and construct a map of suffix<>github PR map (and // record errors for missing/malformed records, of course). // - // Then, check the GitHub PRs and verify that they are changing + // Then, check the Github PRs and verify that they are changing // the expected domains. We do this so that someone cannot point // their TXT record to some random PR and pass our validation // check, the PR must be changing the correct suffix(es). @@ -282,7 +282,7 @@ func (c *txtRecordChecker) checkTXT(block Block, domain domain.Name) txtResult { } } -// extractPSLRecords extracts GitHub PR numbers from raw TXT +// extractPSLRecords extracts github PR numbers from raw TXT // records. TXT records which do not match the required PSL record // format (e.g. SPF records, DKIM records, other unrelated // verification records) are ignored. @@ -387,12 +387,12 @@ func (c *txtRecordChecker) getPRPSLs(prNum int) (before, after []byte, err error return c.gh.PSLForPullRequest(c.ctx, prNum) } -// checkPRs looks up the given GitHub PR, and verifies that it changes +// checkPRs looks up the given Github PR, and verifies that it changes // all the suffixes and wildcards provided in info. func (c *txtRecordChecker) checkPR(prNum int, info *prExpected) []error { log.Printf("Checking PR %d", prNum) - // Some PRs have broken state in GitHub, the API returns nonsense + // Some PRs have broken state in Github, the API returns nonsense // information. These cases were verified manually and recorded in // exceptions.go, so we skip those checks to avoid spurious // errors. diff --git a/tools/psltool/psltool.go b/tools/psltool/psltool.go index c5a72bbbd..5bcecbd55 100644 --- a/tools/psltool/psltool.go +++ b/tools/psltool/psltool.go @@ -135,8 +135,8 @@ func runFmt(env *command.Env, path string) error { } var validateArgs struct { - Owner string `flag:"gh-owner,default=publicsuffix,Owner of the GitHub repository to check"` - Repo string `flag:"gh-repo,default=list,GitHub repository to check"` + Owner string `flag:"gh-owner,default=publicsuffix,Owner of the github repository to check"` + Repo string `flag:"gh-repo,default=list,Github repository to check"` Clone string `flag:"gh-local-clone,Path to a local clone of the repository specified by gh-owner/gh-repo"` Online bool `flag:"online-checks,Run validations that require querying third-party servers"` } @@ -188,7 +188,7 @@ func runValidate(env *command.Env, pathOrHash string) error { } prHistory, err := githistory.GetPRInfo(validateArgs.Clone) if err != nil { - return fmt.Errorf("failed to get local PR history, refusing to run full validation to avoid GitHub DoS: %w", err) + return fmt.Errorf("failed to get local PR history, refusing to run full validation to avoid Github DoS: %w", err) } ctx, cancel := context.WithTimeout(env.Context(), 1200*time.Second) @@ -216,8 +216,8 @@ func runValidate(env *command.Env, pathOrHash string) error { } var checkPRArgs struct { - Owner string `flag:"gh-owner,default=publicsuffix,Owner of the GitHub repository to check"` - Repo string `flag:"gh-repo,default=list,GitHub repository to check"` + Owner string `flag:"gh-owner,default=publicsuffix,Owner of the github repository to check"` + Repo string `flag:"gh-repo,default=list,Github repository to check"` Clone string `flag:"gh-local-clone,Path to a local clone of the repository specified by gh-owner/gh-repo"` Online bool `flag:"online-checks,Run validations that require querying third-party servers"` }