Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
name: 'projectExternalUrl',
message: "Where is the project's code hosted?",
default: 'https://github.com//',
},
]);
const api = new ApiClient({rootURL: responses.serverBaseUrl || options.serverBaseUrl});
const project = await api.createProject({
name: responses.projectName,
externalUrl: responses.projectExternalUrl,
slug: '', // this property is dynamically generated server-side
});
const token = project.token;
process.stdout.write(`Created project ${project.name} (${project.id})!\n`);
process.stdout.write(`Use token ${log.bold}${token}${log.reset} to connect.\n`);
}
const groupedResults = _.groupBy(allResults, result => result.url);
process.stderr.write(
`Checking assertions against ${uniqueUrls.size} URL(s), ${lhrs.length} total run(s)\n\n`
);
let hasFailure = false;
for (const results of groupedResults) {
const url = results[0].url;
const sortedResults = results.sort((a, b) => {
const {level: levelA = 'error', auditId: auditIdA = 'unknown'} = a;
const {level: levelB = 'error', auditId: auditIdB = 'unknown'} = b;
return levelA.localeCompare(levelB) || auditIdA.localeCompare(auditIdB);
});
process.stderr.write(`${sortedResults.length} result(s) for ${log.bold}${url}${log.reset}\n`);
for (const result of sortedResults) {
hasFailure = hasFailure || result.level === 'error';
const label = result.level === 'warn' ? 'warning' : 'failure';
const icon = result.level === 'warn' ? '⚠️ ' : `${log.redify(log.cross)} `;
const idPart = `${log.bold}${result.auditId}${log.reset}`;
const propertyPart = result.auditProperty ? `.${result.auditProperty}` : '';
const namePart = `${log.bold}${result.name}${log.reset}`;
const auditTitlePart = result.auditTitle || '';
const documentationPart = result.auditDocumentationLink
? `Documentation: ${result.auditDocumentationLink}`
: '';
const titleAndDocs = [auditTitlePart, documentationPart]
.filter(Boolean)
.map(s => ` ` + s)