Skip to content

Commit cb719eb

Browse files
committed
fix: tidying
1 parent 610e4ca commit cb719eb

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

lib/ecosystems/enrich_cyclonedx.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func enrichCDXLicense(comp *cdx.Component, pkgVersionData *packages.VersionWithD
6868
}
6969
}
7070

71-
func enrichCDXExternalReference(comp *cdx.Component, ref *string, refType cdx.ExternalReferenceType) {
71+
func enrichExternalReference(comp *cdx.Component, ref *string, refType cdx.ExternalReferenceType) {
7272
if ref == nil {
7373
return
7474
}
@@ -86,7 +86,7 @@ func enrichCDXExternalReference(comp *cdx.Component, ref *string, refType cdx.Ex
8686
}
8787
}
8888

89-
func enrichCDXProperty(comp *cdx.Component, name string, value string) {
89+
func enrichProperty(comp *cdx.Component, name string, value string) {
9090
prop := cdx.Property{
9191
Name: name,
9292
Value: value,
@@ -99,41 +99,41 @@ func enrichCDXProperty(comp *cdx.Component, name string, value string) {
9999
}
100100

101101
func enrichCDXHomepage(comp *cdx.Component, data *packages.Package) {
102-
enrichCDXExternalReference(comp, data.Homepage, cdx.ERTypeWebsite)
102+
enrichExternalReference(comp, data.Homepage, cdx.ERTypeWebsite)
103103
}
104104

105105
func enrichCDXRegistryURL(comp *cdx.Component, data *packages.Package) {
106-
enrichCDXExternalReference(comp, data.RegistryUrl, cdx.ERTypeDistribution)
106+
enrichExternalReference(comp, data.RegistryUrl, cdx.ERTypeDistribution)
107107
}
108108

109109
func enrichCDXRepositoryURL(comp *cdx.Component, data *packages.Package) {
110-
enrichCDXExternalReference(comp, data.RepositoryUrl, cdx.ERTypeVCS)
110+
enrichExternalReference(comp, data.RepositoryUrl, cdx.ERTypeVCS)
111111
}
112112

113113
func enrichCDXDocumentationURL(comp *cdx.Component, data *packages.Package) {
114-
enrichCDXExternalReference(comp, data.DocumentationUrl, cdx.ERTypeDocumentation)
114+
enrichExternalReference(comp, data.DocumentationUrl, cdx.ERTypeDocumentation)
115115
}
116116

117117
func enrichCDXFirstReleasePublishedAt(comp *cdx.Component, data *packages.Package) {
118118
if data.FirstReleasePublishedAt == nil {
119119
return
120120
}
121121
timestamp := data.FirstReleasePublishedAt.UTC().Format(time.RFC3339)
122-
enrichCDXProperty(comp, "ecosystems:first_release_published_at", timestamp)
122+
enrichProperty(comp, "ecosystems:first_release_published_at", timestamp)
123123
}
124124

125125
func enrichCDXLatestReleasePublishedAt(comp *cdx.Component, data *packages.Package) {
126126
if data.LatestReleasePublishedAt == nil {
127127
return
128128
}
129129
timestamp := data.LatestReleasePublishedAt.UTC().Format(time.RFC3339)
130-
enrichCDXProperty(comp, "ecosystems:latest_release_published_at", timestamp)
130+
enrichProperty(comp, "ecosystems:latest_release_published_at", timestamp)
131131
}
132132

133133
func enrichCDXRepoArchived(comp *cdx.Component, data *packages.Package) {
134134
if data.RepoMetadata != nil {
135135
if archived, ok := (*data.RepoMetadata)["archived"].(bool); ok && archived {
136-
enrichCDXProperty(comp, "ecosystems:repository_archived", "true")
136+
enrichProperty(comp, "ecosystems:repository_archived", "true")
137137
}
138138
}
139139
}
@@ -143,7 +143,7 @@ func enrichCDXLocation(comp *cdx.Component, data *packages.Package) {
143143
meta := *data.RepoMetadata
144144
if ownerRecord, ok := meta["owner_record"].(map[string]interface{}); ok {
145145
if location, ok := ownerRecord["location"].(string); ok {
146-
enrichCDXProperty(comp, "ecosystems:owner_location", location)
146+
enrichProperty(comp, "ecosystems:owner_location", location)
147147
}
148148
}
149149
}
@@ -188,7 +188,7 @@ func enrichCDXTopics(comp *cdx.Component, data *packages.Package) {
188188
if topics, ok := meta["topics"].([]interface{}); ok {
189189
for _, topic := range topics {
190190
if s, ok := topic.(string); ok {
191-
enrichCDXProperty(comp, "ecosystems:topic", s)
191+
enrichProperty(comp, "ecosystems:topic", s)
192192
}
193193
}
194194
}

lib/ecosystems/enrich_cyclonedx_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ func TestEnrichExternalReferenceWithNilURL(t *testing.T) {
255255
component := &cdx.Component{}
256256
packageData := &packages.Package{Homepage: nil}
257257

258-
enrichCDXExternalReference(component, packageData.Homepage, cdx.ERTypeWebsite)
258+
enrichExternalReference(component, packageData.Homepage, cdx.ERTypeWebsite)
259259

260260
assert.Nil(t, component.ExternalReferences)
261261
}
@@ -264,7 +264,7 @@ func TestEnrichExternalReferenceWithNonNullURL(t *testing.T) {
264264
component := &cdx.Component{}
265265
packageData := packages.Package{Homepage: pointerToString(t, "https://example.com")}
266266

267-
enrichCDXExternalReference(component, packageData.Homepage, cdx.ERTypeWebsite)
267+
enrichExternalReference(component, packageData.Homepage, cdx.ERTypeWebsite)
268268

269269
expected := &[]cdx.ExternalReference{
270270
{URL: "https://example.com", Type: cdx.ERTypeWebsite},

0 commit comments

Comments
 (0)