mirror of
https://github.com/ossf/scorecard.git
synced 2024-11-05 05:17:00 +03:00
Fix lint issues: gofumpt linter
This commit is contained in:
parent
83a0fbd5eb
commit
8402e6d9d0
@ -46,7 +46,8 @@ func TestIsBranchProtected(t *testing.T) {
|
||||
}{
|
||||
{
|
||||
name: "Nothing is enabled",
|
||||
args: args{protection: &github.Protection{
|
||||
args: args{
|
||||
protection: &github.Protection{
|
||||
RequiredStatusChecks: &github.RequiredStatusChecks{
|
||||
Strict: false,
|
||||
Contexts: nil,
|
||||
@ -79,7 +80,8 @@ func TestIsBranchProtected(t *testing.T) {
|
||||
Enabled: false,
|
||||
},
|
||||
},
|
||||
c: checker.CheckRequest{Logf: l.Logf}},
|
||||
c: checker.CheckRequest{Logf: l.Logf},
|
||||
},
|
||||
want: checker.CheckResult{
|
||||
Name: branchProtectionStr,
|
||||
Pass: false,
|
||||
@ -89,8 +91,10 @@ func TestIsBranchProtected(t *testing.T) {
|
||||
Error: nil,
|
||||
},
|
||||
},
|
||||
{name: "Required status check enabled",
|
||||
args: args{protection: &github.Protection{
|
||||
{
|
||||
name: "Required status check enabled",
|
||||
args: args{
|
||||
protection: &github.Protection{
|
||||
RequiredStatusChecks: &github.RequiredStatusChecks{
|
||||
Strict: true,
|
||||
Contexts: []string{"foo"},
|
||||
@ -123,7 +127,8 @@ func TestIsBranchProtected(t *testing.T) {
|
||||
Enabled: false,
|
||||
},
|
||||
},
|
||||
c: checker.CheckRequest{Logf: l.Logf}},
|
||||
c: checker.CheckRequest{Logf: l.Logf},
|
||||
},
|
||||
want: checker.CheckResult{
|
||||
Name: branchProtectionStr,
|
||||
Pass: false,
|
||||
@ -133,8 +138,10 @@ func TestIsBranchProtected(t *testing.T) {
|
||||
Error: nil,
|
||||
},
|
||||
},
|
||||
{name: "Required status check enabled without checking for status string",
|
||||
args: args{protection: &github.Protection{
|
||||
{
|
||||
name: "Required status check enabled without checking for status string",
|
||||
args: args{
|
||||
protection: &github.Protection{
|
||||
RequiredStatusChecks: &github.RequiredStatusChecks{
|
||||
Strict: true,
|
||||
Contexts: nil,
|
||||
@ -167,7 +174,8 @@ func TestIsBranchProtected(t *testing.T) {
|
||||
Enabled: false,
|
||||
},
|
||||
},
|
||||
c: checker.CheckRequest{Logf: l.Logf}},
|
||||
c: checker.CheckRequest{Logf: l.Logf},
|
||||
},
|
||||
want: checker.CheckResult{
|
||||
Name: branchProtectionStr,
|
||||
Pass: false,
|
||||
@ -178,8 +186,10 @@ func TestIsBranchProtected(t *testing.T) {
|
||||
},
|
||||
},
|
||||
|
||||
{name: "Required pull request enabled",
|
||||
args: args{protection: &github.Protection{
|
||||
{
|
||||
name: "Required pull request enabled",
|
||||
args: args{
|
||||
protection: &github.Protection{
|
||||
RequiredStatusChecks: &github.RequiredStatusChecks{
|
||||
Strict: false,
|
||||
Contexts: []string{"foo"},
|
||||
@ -212,7 +222,8 @@ func TestIsBranchProtected(t *testing.T) {
|
||||
Enabled: false,
|
||||
},
|
||||
},
|
||||
c: checker.CheckRequest{Logf: l.Logf}},
|
||||
c: checker.CheckRequest{Logf: l.Logf},
|
||||
},
|
||||
want: checker.CheckResult{
|
||||
Name: branchProtectionStr,
|
||||
Pass: false,
|
||||
@ -222,8 +233,10 @@ func TestIsBranchProtected(t *testing.T) {
|
||||
Error: nil,
|
||||
},
|
||||
},
|
||||
{name: "Required admin enforcement enabled",
|
||||
args: args{protection: &github.Protection{
|
||||
{
|
||||
name: "Required admin enforcement enabled",
|
||||
args: args{
|
||||
protection: &github.Protection{
|
||||
RequiredStatusChecks: &github.RequiredStatusChecks{
|
||||
Strict: false,
|
||||
Contexts: []string{"foo"},
|
||||
@ -256,7 +269,8 @@ func TestIsBranchProtected(t *testing.T) {
|
||||
Enabled: false,
|
||||
},
|
||||
},
|
||||
c: checker.CheckRequest{Logf: l.Logf}},
|
||||
c: checker.CheckRequest{Logf: l.Logf},
|
||||
},
|
||||
want: checker.CheckResult{
|
||||
Name: branchProtectionStr,
|
||||
Pass: false,
|
||||
@ -266,8 +280,10 @@ func TestIsBranchProtected(t *testing.T) {
|
||||
Error: nil,
|
||||
},
|
||||
},
|
||||
{name: "Required linear history enabled",
|
||||
args: args{protection: &github.Protection{
|
||||
{
|
||||
name: "Required linear history enabled",
|
||||
args: args{
|
||||
protection: &github.Protection{
|
||||
RequiredStatusChecks: &github.RequiredStatusChecks{
|
||||
Strict: false,
|
||||
Contexts: []string{"foo"},
|
||||
@ -300,7 +316,8 @@ func TestIsBranchProtected(t *testing.T) {
|
||||
Enabled: false,
|
||||
},
|
||||
},
|
||||
c: checker.CheckRequest{Logf: l.Logf}},
|
||||
c: checker.CheckRequest{Logf: l.Logf},
|
||||
},
|
||||
want: checker.CheckResult{
|
||||
Name: branchProtectionStr,
|
||||
Pass: false,
|
||||
@ -310,8 +327,10 @@ func TestIsBranchProtected(t *testing.T) {
|
||||
Error: nil,
|
||||
},
|
||||
},
|
||||
{name: "Allow force push enabled",
|
||||
args: args{protection: &github.Protection{
|
||||
{
|
||||
name: "Allow force push enabled",
|
||||
args: args{
|
||||
protection: &github.Protection{
|
||||
RequiredStatusChecks: &github.RequiredStatusChecks{
|
||||
Strict: false,
|
||||
Contexts: []string{"foo"},
|
||||
@ -344,7 +363,8 @@ func TestIsBranchProtected(t *testing.T) {
|
||||
Enabled: false,
|
||||
},
|
||||
},
|
||||
c: checker.CheckRequest{Logf: l.Logf}},
|
||||
c: checker.CheckRequest{Logf: l.Logf},
|
||||
},
|
||||
want: checker.CheckResult{
|
||||
Name: branchProtectionStr,
|
||||
Pass: false,
|
||||
@ -353,8 +373,11 @@ func TestIsBranchProtected(t *testing.T) {
|
||||
ShouldRetry: false,
|
||||
Error: nil,
|
||||
},
|
||||
}, {name: "Allow deletions enabled",
|
||||
args: args{protection: &github.Protection{
|
||||
},
|
||||
{
|
||||
name: "Allow deletions enabled",
|
||||
args: args{
|
||||
protection: &github.Protection{
|
||||
RequiredStatusChecks: &github.RequiredStatusChecks{
|
||||
Strict: false,
|
||||
Contexts: []string{"foo"},
|
||||
@ -387,7 +410,8 @@ func TestIsBranchProtected(t *testing.T) {
|
||||
Enabled: true,
|
||||
},
|
||||
},
|
||||
c: checker.CheckRequest{Logf: l.Logf}},
|
||||
c: checker.CheckRequest{Logf: l.Logf},
|
||||
},
|
||||
want: checker.CheckResult{
|
||||
Name: branchProtectionStr,
|
||||
Pass: false,
|
||||
@ -396,8 +420,11 @@ func TestIsBranchProtected(t *testing.T) {
|
||||
ShouldRetry: false,
|
||||
Error: nil,
|
||||
},
|
||||
}, {name: "Branches are protected",
|
||||
args: args{protection: &github.Protection{
|
||||
},
|
||||
{
|
||||
name: "Branches are protected",
|
||||
args: args{
|
||||
protection: &github.Protection{
|
||||
RequiredStatusChecks: &github.RequiredStatusChecks{
|
||||
Strict: true,
|
||||
Contexts: []string{"foo"},
|
||||
@ -429,7 +456,8 @@ func TestIsBranchProtected(t *testing.T) {
|
||||
Enabled: false,
|
||||
},
|
||||
},
|
||||
c: checker.CheckRequest{Logf: l.Logf}},
|
||||
c: checker.CheckRequest{Logf: l.Logf},
|
||||
},
|
||||
want: checker.CheckResult{
|
||||
Name: branchProtectionStr,
|
||||
Pass: true,
|
||||
|
@ -29,9 +29,11 @@ import (
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
var ghClient *github.Client
|
||||
var graphClient *githubv4.Client
|
||||
var client *http.Client
|
||||
var (
|
||||
ghClient *github.Client
|
||||
graphClient *githubv4.Client
|
||||
client *http.Client
|
||||
)
|
||||
|
||||
type log struct {
|
||||
messages []string
|
||||
@ -76,7 +78,6 @@ var _ = BeforeSuite(func() {
|
||||
|
||||
ghClient = github.NewClient(client)
|
||||
graphClient = githubv4.NewClient(client)
|
||||
|
||||
})
|
||||
|
||||
var _ = AfterSuite(func() {
|
||||
|
Loading…
Reference in New Issue
Block a user