Skip to content

Commit

Permalink
spelling: github
Browse files Browse the repository at this point in the history
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
  • Loading branch information
jsoref committed Dec 26, 2021
1 parent c907f36 commit 9e34d16
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,6 @@ Contributions are greatly appreciated! The project follows the typical GitHub pu

## Roadmap

The [codeowners-validator roadmap uses Github milestones](https://github.com/mszostok/codeowners-validator/milestone/1) to track the progress of the project.
The [codeowners-validator roadmap uses GitHub milestones](https://github.com/mszostok/codeowners-validator/milestone/1) to track the progress of the project.

They are sorted with priority. First are most important.
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: "GitHub CODEOWNERS Validator"
description: "Github action to ensure the correctness of your CODEOWNERS file."
description: "GitHub action to ensure the correctness of your CODEOWNERS file."
author: "szostok.mateusz@gmail.com"

inputs:
Expand Down
12 changes: 6 additions & 6 deletions internal/check/valid_owner.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,14 @@ func isEmailAddress(s string) bool {
return err == nil
}

func isGithubTeam(s string) bool {
func isGitHubTeam(s string) bool {
hasPrefix := strings.HasPrefix(s, "@")
containsSlash := strings.Contains(s, "/")
split := strings.SplitN(s, "/", 3) // 3 is enough to confirm that is invalid + will not overflow the buffer
return hasPrefix && containsSlash && len(split) == 2 && len(split[1]) > 0
}

func isGithubUser(s string) bool {
func isGitHubUser(s string) bool {
return !strings.Contains(s, "/") && strings.HasPrefix(s, "@")
}

Expand All @@ -119,9 +119,9 @@ func (v *ValidOwner) isIgnoredOwner(name string) bool {

func (v *ValidOwner) selectValidateFn(name string) func(context.Context, string) *validateError {
switch {
case isGithubUser(name):
return v.validateGithubUser
case isGithubTeam(name):
case isGitHubUser(name):
return v.validateGitHubUser
case isGitHubTeam(name):
return v.validateTeam
case isEmailAddress(name):
// TODO(mszostok): try to check if e-mail really exists
Expand Down Expand Up @@ -252,7 +252,7 @@ func (v *ValidOwner) validateTeam(ctx context.Context, name string) *validateErr
return nil
}

func (v *ValidOwner) validateGithubUser(ctx context.Context, name string) *validateError {
func (v *ValidOwner) validateGitHubUser(ctx context.Context, name string) *validateError {
if v.orgMembers == nil { //TODO(mszostok): lazy init, make it more robust.
if err := v.initOrgListMembers(ctx); err != nil {
return newValidateError("Cannot initialize organization member list: %v", err).AsPermanent()
Expand Down
2 changes: 1 addition & 1 deletion internal/check/valid_owner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,5 @@ func TestValidOwnerCheckerIgnoredOwner(t *testing.T) {
}

func isValidOwner(owner string) bool {
return isEmailAddress(owner) || isGithubUser(owner) || isGithubTeam(owner)
return isEmailAddress(owner) || isGitHubUser(owner) || isGitHubTeam(owner)
}
4 changes: 2 additions & 2 deletions internal/load/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ func Checks(ctx context.Context, enabledChecks []string, experimentalChecks []st
if isEnabled(enabledChecks, "owners") {
var cfg struct {
OwnerChecker check.ValidOwnerConfig
Github github.ClientConfig
GitHub github.ClientConfig
}
if err := envconfig.Init(&cfg); err != nil {
return nil, errors.Wrapf(err, "while loading config for %s", "owners")
}

ghClient, err := github.NewClient(ctx, cfg.Github)
ghClient, err := github.NewClient(ctx, cfg.GitHub)
if err != nil {
return nil, errors.Wrap(err, "while creating GitHub client")
}
Expand Down

0 comments on commit 9e34d16

Please sign in to comment.