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

13
dist/index.js generated vendored
View File

@@ -679,27 +679,32 @@ function addLicensesToSummary(invalidLicenseChanges, config) {
}
exports.addLicensesToSummary = addLicensesToSummary;
function printLicenseViolation(heading, changes) {
var _a;
core.summary.addHeading(heading, 5).addSeparator();
if (changes.length > 0) {
const rows = [];
const manifests = (0, utils_1.getManifestsSet)(changes);
core.summary.addHeading(heading, 5).addSeparator();
for (const manifest of manifests) {
core.summary.addHeading(`<em>${manifest}</em>`, 4);
for (const change of changes.filter(pkg => pkg.manifest === manifest)) {
rows.push([
(0, utils_1.renderUrl)(change.source_repository_url, change.name),
change.version,
(_a = change.license) !== null && _a !== void 0 ? _a : 'Null'
formatLicense(change.license)
]);
}
core.summary.addTable([['Package', 'Version', 'License'], ...rows]);
}
}
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) {
const dependencies = (0, utils_1.groupDependenciesByManifest)(changes);
const manifests = dependencies.keys();

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@@ -119,12 +119,12 @@ export function addLicensesToSummary(
)
}
function printLicenseViolation(heading: string, changes: Changes): void {
core.summary.addHeading(heading, 5).addSeparator()
if (changes.length > 0) {
const rows: SummaryTableRow[] = []
const manifests = getManifestsSet(changes)
core.summary.addHeading(heading, 5).addSeparator()
for (const manifest of manifests) {
core.summary.addHeading(`<em>${manifest}</em>`, 4)
@@ -132,17 +132,24 @@ function printLicenseViolation(heading: string, changes: Changes): void {
rows.push([
renderUrl(change.source_repository_url, change.name),
change.version,
change.license ?? 'Null'
formatLicense(change.license)
])
}
core.summary.addTable([['Package', 'Version', 'License'], ...rows])
}
} 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 {
const dependencies = groupDependenciesByManifest(changes)
const manifests = dependencies.keys()