Skip to content

Commit

Permalink
🚨 Fixing linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
marcwieserdev committed Sep 16, 2024
1 parent cc5b4f5 commit 92b99ea
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
26 changes: 14 additions & 12 deletions src/commands/sbom/payload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ export const generatePayload = (
}

const dependencies: Dependency[] = []
const files: File[] = [];
const component_links: ComponentLink[] = []
const files: File[] = []
const componentLinks: ComponentLink[] = []

if (jsonContent) {
if (jsonContent['components']) {
Expand All @@ -116,7 +116,7 @@ export const generatePayload = (

if (component['type'] === 'library') {
const dependency = extractingDependency(component)
if (dependency !== null) {
if (dependency !== undefined) {
dependencies.push(dependency)
}
} else if (component['type'] === 'file') {
Expand All @@ -129,7 +129,7 @@ export const generatePayload = (
if (!dependency['ref'] || !dependency['dependsOn']) {
continue
}
component_links.push(extractingComponentLink(dependency));
componentLinks.push(extractingComponentLink(dependency))
}
}
}
Expand All @@ -150,24 +150,25 @@ export const generatePayload = (
tags,
dependencies,
files,
component_links,
component_links: componentLinks,
service,
env,
}
}

const extractingDependency = (component: any): Dependency|null => {
const extractingDependency = (component: any): Dependency | undefined => {
const lang = getLanguageFromComponent(component)

if (!lang) {
return null;
return
}

const purl: string | undefined = component['purl']

if (!purl) {
console.error(`cannot find purl for component ${component['name']}`)
return null;

return
}

const locations: Locations[] = []
Expand Down Expand Up @@ -201,21 +202,22 @@ const extractingDependency = (component: any): Dependency|null => {
licenses: [],
purl,
locations,
properties: component['properties'] || undefined
properties: component['properties'] || undefined,
}

return dependency
}

const extractingFile = (component: any): File => {
return {
name: component['name'],
properties: component['properties'] || undefined
properties: component['properties'] || undefined,
}
}

const extractingComponentLink = (dependency: any): ComponentLink => {
return {
component_ref: dependency['ref'],
depends_on: dependency['dependsOn']
depends_on: dependency['dependsOn'],
}
}
}
2 changes: 1 addition & 1 deletion src/commands/sbom/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export interface Locations {
}

export interface Property {
name: string,
name: string
value: string
}

Expand Down

0 comments on commit 92b99ea

Please sign in to comment.