Skip to content

Commit

Permalink
unused (#205)
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhitms authored Jun 13, 2023
1 parent 4dc4518 commit 3738621
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 19 deletions.
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,5 @@ linters:
- varcheck
- wastedassign
- whitespace
- unparam
disable-all: true
2 changes: 1 addition & 1 deletion pkg/repo/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ func (r *repository) cleanupBranch(ctx context.Context, branchName *string, ap A
}
// now, we are on default and need to delete branchToCleanup. First, delete on remote.
localBranchRef := plumbing.NewBranchReferenceName(branchToCleanup)
if err := r.repo.Push(&git.PushOptions{
if err := r.repo.PushContext(ctx, &git.PushOptions{
RemoteName: RemoteName,
// Note: the fact that the source ref is empty means this is a delete. This is
// equivalent to doing `git push origin --delete <branch_name> on the cmd line.
Expand Down
4 changes: 2 additions & 2 deletions pkg/star/static/traverse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ import (
)

func testFile(t *testing.T) *build.File {
_, _, starBytes := testStar(t, feature.FeatureTypeBool)
_, starBytes := testStar(t, feature.FeatureTypeBool)
p := butils.GetParser(InputTypeAuto)
file, err := p("test.star", starBytes)
require.NoError(t, err, "failed to parse test star file")
return file
}

func TestTraverseNoop(t *testing.T) {
_, _, starBytes := testStar(t, feature.FeatureTypeBool)
_, starBytes := testStar(t, feature.FeatureTypeBool)
f := testFile(t)
tvs := newTraverser(f)
err := tvs.traverse()
Expand Down
32 changes: 16 additions & 16 deletions pkg/star/static/walk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ func typedVals(t *testing.T, ft feature.FeatureType) (defaultVal testVal, ruleVa
return
}

func testStar(t *testing.T, ft feature.FeatureType) (testVal, testVal, []byte) {
func testStar(t *testing.T, ft feature.FeatureType) (testVal, []byte) {
val, ruleVal := typedVals(t, ft)
return val, ruleVal, []byte(fmt.Sprintf(`result = feature(
return val, []byte(fmt.Sprintf(`result = feature(
description = "this is a simple feature",
default = %s,
rules = [
Expand All @@ -98,15 +98,15 @@ func testWalker(t *testing.T, testStar []byte) *walker {
}

func TestWalkerBuild(t *testing.T) {
_, _, starBytes := testStar(t, feature.FeatureTypeBool)
_, starBytes := testStar(t, feature.FeatureTypeBool)
b := testWalker(t, starBytes)
f, err := b.Build()
require.NoError(t, err)
require.NotNil(t, f)
}

func TestWalkerBuildJSON(t *testing.T) {
_, _, starBytes := testStar(t, feature.FeatureTypeJSON)
_, starBytes := testStar(t, feature.FeatureTypeJSON)
b := testWalker(t, starBytes)
f, err := b.Build()
require.NoError(t, err)
Expand All @@ -116,7 +116,7 @@ func TestWalkerBuildJSON(t *testing.T) {
func TestWalkerMutateNoop(t *testing.T) {
for _, fType := range parsableFeatureTypes {
t.Run(string(fType), func(t *testing.T) {
_, _, starBytes := testStar(t, fType)
_, starBytes := testStar(t, fType)
b := testWalker(t, starBytes)
f, err := b.Build()
require.NoError(t, err)
Expand All @@ -130,7 +130,7 @@ func TestWalkerMutateNoop(t *testing.T) {
}

func TestWalkerMutateDefault(t *testing.T) {
_, _, starBytes := testStar(t, feature.FeatureTypeBool)
_, starBytes := testStar(t, feature.FeatureTypeBool)
b := testWalker(t, starBytes)
f, err := b.Build()
require.NoError(t, err)
Expand All @@ -147,7 +147,7 @@ func TestWalkerMutateDefault(t *testing.T) {
}

func TestWalkerMutateModifyRuleCondition(t *testing.T) {
_, _, starBytes := testStar(t, feature.FeatureTypeBool)
_, starBytes := testStar(t, feature.FeatureTypeBool)
b := testWalker(t, starBytes)
f, err := b.Build()
require.NoError(t, err)
Expand All @@ -162,7 +162,7 @@ func TestWalkerMutateModifyRuleCondition(t *testing.T) {
}

func TestWalkerMutateModifyRuleConditionV3(t *testing.T) {
_, _, starBytes := testStar(t, feature.FeatureTypeBool)
_, starBytes := testStar(t, feature.FeatureTypeBool)
b := testWalker(t, starBytes)
f, err := b.Build()
require.NoError(t, err)
Expand All @@ -177,7 +177,7 @@ func TestWalkerMutateModifyRuleConditionV3(t *testing.T) {
}

func TestWalkerMutateAddRule(t *testing.T) {
_, _, starBytes := testStar(t, feature.FeatureTypeBool)
_, starBytes := testStar(t, feature.FeatureTypeBool)
b := testWalker(t, starBytes)
f, err := b.Build()
require.NoError(t, err)
Expand Down Expand Up @@ -240,7 +240,7 @@ func TestWalkerMutateAddFirstRule(t *testing.T) {
}

func TestWalkerMutateRemoveRule(t *testing.T) {
_, _, starBytes := testStar(t, feature.FeatureTypeBool)
_, starBytes := testStar(t, feature.FeatureTypeBool)
b := testWalker(t, starBytes)
f, err := b.Build()
require.NoError(t, err)
Expand Down Expand Up @@ -278,7 +278,7 @@ func TestWalkerMutateRemoveOnlyRule(t *testing.T) {
func TestWalkerMutateDescription(t *testing.T) {
for _, fType := range parsableFeatureTypes {
t.Run(string(fType), func(t *testing.T) {
_, _, starBytes := testStar(t, fType)
_, starBytes := testStar(t, fType)
b := testWalker(t, starBytes)
f, err := b.Build()
require.NoError(t, err)
Expand All @@ -294,7 +294,7 @@ func TestWalkerMutateDescription(t *testing.T) {
}

func TestWalkerMutateTypeMismatch(t *testing.T) {
_, _, starBytes := testStar(t, feature.FeatureTypeFloat)
_, starBytes := testStar(t, feature.FeatureTypeFloat)
b := testWalker(t, starBytes)
f, err := b.Build()
require.NoError(t, err)
Expand All @@ -308,7 +308,7 @@ func TestWalkerMutateTypeMismatch(t *testing.T) {
}

func TestWalkerMutateDefaultFloat(t *testing.T) {
val, _, starBytes := testStar(t, feature.FeatureTypeFloat)
val, starBytes := testStar(t, feature.FeatureTypeFloat)
b := testWalker(t, starBytes)
f, err := b.Build()
require.NoError(t, err)
Expand All @@ -326,7 +326,7 @@ func TestWalkerMutateDefaultFloat(t *testing.T) {
}

func TestWalkerMutateDefaultInt(t *testing.T) {
val, _, starBytes := testStar(t, feature.FeatureTypeInt)
val, starBytes := testStar(t, feature.FeatureTypeInt)
b := testWalker(t, starBytes)
f, err := b.Build()
require.NoError(t, err)
Expand All @@ -344,7 +344,7 @@ func TestWalkerMutateDefaultInt(t *testing.T) {
}

func TestWalkerMutateDefaultString(t *testing.T) {
val, _, starBytes := testStar(t, feature.FeatureTypeString)
val, starBytes := testStar(t, feature.FeatureTypeString)
b := testWalker(t, starBytes)
f, err := b.Build()
require.NoError(t, err)
Expand All @@ -363,7 +363,7 @@ func TestWalkerMutateDefaultString(t *testing.T) {
}

func TestWalkerMutateDefaultJSON(t *testing.T) {
_, _, starBytes := testStar(t, feature.FeatureTypeJSON)
_, starBytes := testStar(t, feature.FeatureTypeJSON)
b := testWalker(t, starBytes)
f, err := b.Build()
require.NoError(t, err)
Expand Down

0 comments on commit 3738621

Please sign in to comment.