Skip to content

Commit

Permalink
Made the addition column clearer
Browse files Browse the repository at this point in the history
(I hope)

Signed-off-by: nigel brown <[email protected]>
  • Loading branch information
therealnb committed May 17, 2024
1 parent 6e5d1fb commit 73dc706
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
15 changes: 9 additions & 6 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

19 changes: 13 additions & 6 deletions src/trusty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ function nameAndLink(change: Change, endpoint: string): string {

// Function to determine the delta icon for a change
function delta(change: Change, config: ConfigurationOptions): string {
const ct = {added: icons.plus, removed: icons.minus}
let icon = icons.check
const score = change?.trusty?.score || 0
if (change.change_type === 'added') {
Expand All @@ -177,7 +176,17 @@ function delta(change: Change, config: ConfigurationOptions): string {
icon = icons.cross
}
}
return `${ct[change.change_type]}${icon}`
return `${icon} ${change.change_type} `
}

// Return the change compiled as a string
function dependencyChange(
change: Change,
config: ConfigurationOptions
): string {
const action = delta(change, config)
const name = nameAndLink(change, config.trusty_ui)
return `${action} ${name}`
}

// Function to convert a change to a summary table row
Expand All @@ -186,8 +195,7 @@ function changeAsRow(
config: ConfigurationOptions
): SummaryTableRow {
const row: SummaryTableRow = [
delta(change, config),
nameAndLink(change, config.trusty_ui),
dependencyChange(change, config),
change.version,
change.trusty?.score?.toString() || '',
change.trusty?.description?.malicious || false ? icons.cross : icons.check,
Expand All @@ -210,8 +218,7 @@ function changesAsTable(
config: ConfigurationOptions
): SummaryTableRow[] {
const headings = [
'+/-',
'Package',
'Dependency Change',
'Version',
'Score',
'Not Malicious',
Expand Down

0 comments on commit 73dc706

Please sign in to comment.