Skip to content

Commit

Permalink
other round linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
renzodavid9 committed May 20, 2024
1 parent e3540fd commit ce90cb6
Show file tree
Hide file tree
Showing 11 changed files with 180 additions and 275 deletions.
2 changes: 1 addition & 1 deletion pkg/artifacts/signable_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ const (
var ignore = []cmp.Option{cmpopts.IgnoreUnexported(name.Registry{}, name.Repository{}, name.Digest{})}

func TestOCIArtifact_ExtractObjects(t *testing.T) {

tests := []struct {
name string
obj objects.TektonObject
Expand Down Expand Up @@ -808,6 +807,7 @@ func TestExtractBuildArtifactsFromResults(t *testing.T) {
}

func createDigest(t *testing.T, dgst string) name.Digest {
t.Helper()
result, err := name.NewDigest(dgst)
if err != nil {
t.Fatal(err)
Expand Down
4 changes: 2 additions & 2 deletions pkg/chains/formats/slsa/internal/metadata/metadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
)

func TestMetadata(t *testing.T) {
tr := &v1.TaskRun{ //nolint:staticcheck
tr := &v1.TaskRun{
ObjectMeta: metav1.ObjectMeta{
Name: "my-taskrun",
Namespace: "my-namespace",
Expand Down Expand Up @@ -58,7 +58,7 @@ func TestMetadata(t *testing.T) {

func TestMetadataInTimeZone(t *testing.T) {
tz := time.FixedZone("Test Time", int((12 * time.Hour).Seconds()))
tr := &v1.TaskRun{ //nolint:staticcheck
tr := &v1.TaskRun{
ObjectMeta: metav1.ObjectMeta{
Name: "my-taskrun",
Namespace: "my-namespace",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const (

// used to toggle the fields in see AddTektonTaskDescriptor
// and AddSLSATaskDescriptor
type addTaskDescriptorContent func(*objects.TaskRunObjectV1) (*intoto.ResourceDescriptor, error) //nolint:staticcheck
type addTaskDescriptorContent func(*objects.TaskRunObjectV1) (*intoto.ResourceDescriptor, error)

// ResolveOptions represents the configuration to be use to resolve dependencies.
type ResolveOptions struct {
Expand Down Expand Up @@ -111,7 +111,7 @@ func RemoveDuplicateResolvedDependencies(resolvedDependencies []*intoto.Resource

// AddTektonTaskDescriptor returns the more verbose resolved dependency content. this adds the name, uri, digest
// and content if possible.
func AddTektonTaskDescriptor(tr *objects.TaskRunObjectV1) (*intoto.ResourceDescriptor, error) { //nolint:staticcheck
func AddTektonTaskDescriptor(tr *objects.TaskRunObjectV1) (*intoto.ResourceDescriptor, error) {
rd := intoto.ResourceDescriptor{}
storedTr, err := json.Marshal(tr)
if err != nil {
Expand All @@ -130,7 +130,7 @@ func AddTektonTaskDescriptor(tr *objects.TaskRunObjectV1) (*intoto.ResourceDescr

// AddSLSATaskDescriptor resolves dependency content for the more generic slsa verifiers. just logs
// the name, uri and digest.
func AddSLSATaskDescriptor(tr *objects.TaskRunObjectV1) (*intoto.ResourceDescriptor, error) { //nolint:staticcheck
func AddSLSATaskDescriptor(tr *objects.TaskRunObjectV1) (*intoto.ResourceDescriptor, error) {
if tr.Status.Provenance != nil && tr.Status.Provenance.RefSource != nil {
return &intoto.ResourceDescriptor{
Name: PipelineTaskConfigName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ func tektonTaskRuns() map[string][]byte {
func TestTaskRun(t *testing.T) {
tests := []struct {
name string
obj objects.TektonObject //nolint:staticcheck
obj objects.TektonObject
resolveOpts ResolveOptions
want []*intoto.ResourceDescriptor
}{
Expand Down Expand Up @@ -375,7 +375,7 @@ func TestTaskRun(t *testing.T) {
},
{
name: "resolvedDependencies from remote task",
obj: objects.NewTaskRunObjectV1(&v1.TaskRun{ //nolint:staticcheck
obj: objects.NewTaskRunObjectV1(&v1.TaskRun{
Status: v1.TaskRunStatus{
TaskRunStatusFields: v1.TaskRunStatusFields{
Provenance: &v1.Provenance{
Expand All @@ -401,7 +401,7 @@ func TestTaskRun(t *testing.T) {
},
{
name: "git resolvedDependencies from taskrun params",
obj: objects.NewTaskRunObjectV1(&v1.TaskRun{ //nolint:staticcheck
obj: objects.NewTaskRunObjectV1(&v1.TaskRun{
Spec: v1.TaskRunSpec{
Params: []v1.Param{{
Name: "CHAINS-GIT_COMMIT",
Expand All @@ -424,7 +424,7 @@ func TestTaskRun(t *testing.T) {
},
{
name: "resolvedDependencies from step images",
obj: objects.NewTaskRunObjectV1(&v1.TaskRun{ //nolint:staticcheck
obj: objects.NewTaskRunObjectV1(&v1.TaskRun{
Status: v1.TaskRunStatus{
TaskRunStatusFields: v1.TaskRunStatusFields{
Steps: []v1.StepState{{
Expand Down Expand Up @@ -457,7 +457,7 @@ func TestTaskRun(t *testing.T) {
},
{
name: "resolvedDependencies from step and sidecar images",
obj: objects.NewTaskRunObjectV1(&v1.TaskRun{ //nolint:staticcheck
obj: objects.NewTaskRunObjectV1(&v1.TaskRun{
Status: v1.TaskRunStatus{
TaskRunStatusFields: v1.TaskRunStatusFields{
Steps: []v1.StepState{{
Expand Down Expand Up @@ -507,7 +507,7 @@ func TestTaskRun(t *testing.T) {
resolveOpts: ResolveOptions{
WithStepActionsResults: true,
},
obj: objects.NewTaskRunObjectV1(&v1.TaskRun{ //nolint:staticcheck
obj: objects.NewTaskRunObjectV1(&v1.TaskRun{
Status: v1.TaskRunStatus{
TaskRunStatusFields: v1.TaskRunStatusFields{
Steps: []v1.StepState{{
Expand Down
Loading

0 comments on commit ce90cb6

Please sign in to comment.