Skip to content

Commit

Permalink
Fixed Error in Scorecard Certifier (#1501)
Browse files Browse the repository at this point in the history
* Fixes #1364

Signed-off-by: nathannaveen <[email protected]>
  • Loading branch information
nathannaveen authored Nov 14, 2023
1 parent a3301cb commit 565483d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
3 changes: 2 additions & 1 deletion pkg/certifier/components/source/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"context"
"fmt"
"math"
"path"
"strings"
"time"

Expand Down Expand Up @@ -83,7 +84,7 @@ func (s sourceQuery) GetComponents(ctx context.Context, compChan chan<- interfac
}
if !scoreCardFound {
sourceNode := SourceNode{
Repo: names.Name,
Repo: path.Join(namespace.Namespace, names.Name),
Commit: trimAlgorithm(nilOrEmpty(names.Commit)),
Tag: nilOrEmpty(names.Tag),
}
Expand Down
30 changes: 15 additions & 15 deletions pkg/certifier/components/source/source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ func Test_sourceArtifacts_GetComponents(t *testing.T) {
testSourceDjangoTag.Type = "git"
testSourceDjangoTag.Namespaces = append(testSourceDjangoTag.Namespaces, generated.AllSourceTreeNamespacesSourceNamespace{
Id: "",
Namespace: "github",
Namespace: "github.com/django",
Names: []generated.AllSourceTreeNamespacesSourceNamespaceNamesSourceName{
{
Name: "https://github.com/django/django",
Name: "django",
Commit: ptrfrom.String(""),
Tag: ptrfrom.String("1.11.1"),
},
Expand All @@ -87,10 +87,10 @@ func Test_sourceArtifacts_GetComponents(t *testing.T) {
testSourceDjangoCommit.Type = "git"
testSourceDjangoCommit.Namespaces = append(testSourceDjangoCommit.Namespaces, generated.AllSourceTreeNamespacesSourceNamespace{
Id: "",
Namespace: "github",
Namespace: "github.com/django",
Names: []generated.AllSourceTreeNamespacesSourceNamespaceNamesSourceName{
{
Name: "https://github.com/django/django",
Name: "django",
Commit: ptrfrom.String("e829b0a239cffdeab5781df450a6b0e0026faa2d"),
Tag: ptrfrom.String(""),
},
Expand All @@ -101,10 +101,10 @@ func Test_sourceArtifacts_GetComponents(t *testing.T) {
testSourceDjangoCommitWithAlgo.Type = "git"
testSourceDjangoCommitWithAlgo.Namespaces = append(testSourceDjangoCommitWithAlgo.Namespaces, generated.AllSourceTreeNamespacesSourceNamespace{
Id: "",
Namespace: "github",
Namespace: "github.com/django",
Names: []generated.AllSourceTreeNamespacesSourceNamespaceNamesSourceName{
{
Name: "https://github.com/django/django",
Name: "django",
Commit: ptrfrom.String("sha1:e829b0a239cffdeab5781df450a6b0e0026faa2d"),
Tag: ptrfrom.String(""),
},
Expand All @@ -115,10 +115,10 @@ func Test_sourceArtifacts_GetComponents(t *testing.T) {
testSourceKubeTestTag.Type = "git"
testSourceKubeTestTag.Namespaces = append(testSourceKubeTestTag.Namespaces, generated.AllSourceTreeNamespacesSourceNamespace{
Id: "",
Namespace: "github",
Namespace: "github.com/vapor-ware",
Names: []generated.AllSourceTreeNamespacesSourceNamespaceNamesSourceName{
{
Name: "https://github.com/vapor-ware/kubetest",
Name: "kubetest",
Commit: ptrfrom.String(""),
Tag: ptrfrom.String("0.9.5"),
},
Expand Down Expand Up @@ -158,7 +158,7 @@ func Test_sourceArtifacts_GetComponents(t *testing.T) {
},
wantSourceNode: []*SourceNode{
{
Repo: "https://github.com/django/django",
Repo: "github.com/django/django",
Commit: "",
Tag: "1.11.1",
},
Expand All @@ -179,7 +179,7 @@ func Test_sourceArtifacts_GetComponents(t *testing.T) {
},
wantSourceNode: []*SourceNode{
{
Repo: "https://github.com/django/django",
Repo: "github.com/django/django",
Commit: "e829b0a239cffdeab5781df450a6b0e0026faa2d",
Tag: "",
},
Expand All @@ -200,7 +200,7 @@ func Test_sourceArtifacts_GetComponents(t *testing.T) {
},
wantSourceNode: []*SourceNode{
{
Repo: "https://github.com/django/django",
Repo: "github.com/django/django",
Commit: "e829b0a239cffdeab5781df450a6b0e0026faa2d",
Tag: "",
},
Expand Down Expand Up @@ -236,7 +236,7 @@ func Test_sourceArtifacts_GetComponents(t *testing.T) {
},
wantSourceNode: []*SourceNode{
{
Repo: "https://github.com/django/django",
Repo: "github.com/django/django",
Commit: "",
Tag: "1.11.1",
},
Expand Down Expand Up @@ -272,15 +272,15 @@ func Test_sourceArtifacts_GetComponents(t *testing.T) {
},
wantSourceNode: []*SourceNode{
{
Repo: "https://github.com/django/django",
Repo: "github.com/django/django",
Commit: "",
Tag: "1.11.1",
}, {
Repo: "https://github.com/django/django",
Repo: "github.com/django/django",
Commit: "e829b0a239cffdeab5781df450a6b0e0026faa2d",
Tag: "",
}, {
Repo: "https://github.com/vapor-ware/kubetest",
Repo: "github.com/vapor-ware/kubetest",
Commit: "",
Tag: "0.9.5",
},
Expand Down

0 comments on commit 565483d

Please sign in to comment.