Format violations area

This commit is contained in:
cnagadya
2022-10-27 16:43:45 +00:00
parent 7b16bd0b54
commit 0144419c8e
3 changed files with 21 additions and 9 deletions
Generated Vendored
+9 -4
View File
@@ -679,27 +679,32 @@ function addLicensesToSummary(invalidLicenseChanges, config) {
} }
exports.addLicensesToSummary = addLicensesToSummary; exports.addLicensesToSummary = addLicensesToSummary;
function printLicenseViolation(heading, changes) { function printLicenseViolation(heading, changes) {
var _a; core.summary.addHeading(heading, 5).addSeparator();
if (changes.length > 0) { if (changes.length > 0) {
const rows = []; const rows = [];
const manifests = (0, utils_1.getManifestsSet)(changes); const manifests = (0, utils_1.getManifestsSet)(changes);
core.summary.addHeading(heading, 5).addSeparator();
for (const manifest of manifests) { for (const manifest of manifests) {
core.summary.addHeading(`<em>${manifest}</em>`, 4); core.summary.addHeading(`<em>${manifest}</em>`, 4);
for (const change of changes.filter(pkg => pkg.manifest === manifest)) { for (const change of changes.filter(pkg => pkg.manifest === manifest)) {
rows.push([ rows.push([
(0, utils_1.renderUrl)(change.source_repository_url, change.name), (0, utils_1.renderUrl)(change.source_repository_url, change.name),
change.version, change.version,
(_a = change.license) !== null && _a !== void 0 ? _a : 'Null' formatLicense(change.license)
]); ]);
} }
core.summary.addTable([['Package', 'Version', 'License'], ...rows]); core.summary.addTable([['Package', 'Version', 'License'], ...rows]);
} }
} }
else { else {
core.summary.addQuote(`No ${heading} detected.`); core.summary.addQuote(`No ${heading.toLowerCase()} detected.`);
} }
} }
function formatLicense(license) {
if (license === null || license === 'NOASSERTION') {
return 'Null';
}
return license;
}
function addScannedDependencies(changes) { function addScannedDependencies(changes) {
const dependencies = (0, utils_1.groupDependenciesByManifest)(changes); const dependencies = (0, utils_1.groupDependenciesByManifest)(changes);
const manifests = dependencies.keys(); const manifests = dependencies.keys();
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
+11 -4
View File
@@ -119,12 +119,12 @@ export function addLicensesToSummary(
) )
} }
function printLicenseViolation(heading: string, changes: Changes): void { function printLicenseViolation(heading: string, changes: Changes): void {
core.summary.addHeading(heading, 5).addSeparator()
if (changes.length > 0) { if (changes.length > 0) {
const rows: SummaryTableRow[] = [] const rows: SummaryTableRow[] = []
const manifests = getManifestsSet(changes) const manifests = getManifestsSet(changes)
core.summary.addHeading(heading, 5).addSeparator()
for (const manifest of manifests) { for (const manifest of manifests) {
core.summary.addHeading(`<em>${manifest}</em>`, 4) core.summary.addHeading(`<em>${manifest}</em>`, 4)
@@ -132,17 +132,24 @@ function printLicenseViolation(heading: string, changes: Changes): void {
rows.push([ rows.push([
renderUrl(change.source_repository_url, change.name), renderUrl(change.source_repository_url, change.name),
change.version, change.version,
change.license ?? 'Null' formatLicense(change.license)
]) ])
} }
core.summary.addTable([['Package', 'Version', 'License'], ...rows]) core.summary.addTable([['Package', 'Version', 'License'], ...rows])
} }
} else { } else {
core.summary.addQuote(`No ${heading} detected.`) core.summary.addQuote(`No ${heading.toLowerCase()} detected.`)
} }
} }
function formatLicense(license: string | null): string {
if (license === null || license === 'NOASSERTION') {
return 'Null'
}
return license
}
export function addScannedDependencies(changes: Changes): void { export function addScannedDependencies(changes: Changes): void {
const dependencies = groupDependenciesByManifest(changes) const dependencies = groupDependenciesByManifest(changes)
const manifests = dependencies.keys() const manifests = dependencies.keys()