Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const partialResult = _.reduce(sortedMessages, (subtotal: string, msg: Problem) => {
let partial: string;
const color = severityToColor(msg.severity);
const severity = color(getMessage(`capitalized${Severity[msg.severity].toString()}` as MessageName, language));
const location = msg.location;
totals[msg.severity.toString()]++;
partial = `${getMessage('hintInfo', language, [
severity,
msg.message,
msg.hintId,
resourceString,
(location.line !== -1 && location.column !== -1) ? `:${location.line}:${location.column}` : ''
])}\n`;
if (msg.sourceCode) {
partial += codeFrame(msg.sourceCode, location);
}
_.forEach(sortedResources, ([hintId, problems]) => {
const msgsBySeverity = _.groupBy(problems, 'severity');
const errors = msgsBySeverity[Severity.error] ? msgsBySeverity[Severity.error].length : 0;
const warnings = msgsBySeverity[Severity.warning] ? msgsBySeverity[Severity.warning].length : 0;
const informations = msgsBySeverity[Severity.information] ? msgsBySeverity[Severity.information].length : 0;
const hints = msgsBySeverity[Severity.hint] ? msgsBySeverity[Severity.hint].length : 0;
const red = severityToColor(Severity.error);
const yellow = severityToColor(Severity.warning);
const gray = severityToColor(Severity.information);
const pink = severityToColor(Severity.hint);
const line: string[] = [chalk.cyan(hintId)];
if (errors > 0) {
line.push(red(getMessage(errors === 1 ? 'errorCount' : 'errorsCount', language, errors.toString())));
}
if (warnings > 0) {
line.push(yellow(getMessage(warnings === 1 ? 'warningCount' : 'warningsCount', language, warnings.toString())));
}
if (hints > 0) {
line.push(pink(getMessage(hints === 1 ? 'hintCount' : 'hintsCount', language, hints.toString())));
}
if (informations > 0) {
line.push(gray(getMessage(informations === 1 ? 'informationCount' : 'informationsCount', language, informations.toString())));
}
_.forEach(sortedResources, ([hintId, problems]) => {
const msgsBySeverity = _.groupBy(problems, 'severity');
const errors = msgsBySeverity[Severity.error] ? msgsBySeverity[Severity.error].length : 0;
const warnings = msgsBySeverity[Severity.warning] ? msgsBySeverity[Severity.warning].length : 0;
const informations = msgsBySeverity[Severity.information] ? msgsBySeverity[Severity.information].length : 0;
const hints = msgsBySeverity[Severity.hint] ? msgsBySeverity[Severity.hint].length : 0;
const red = severityToColor(Severity.error);
const yellow = severityToColor(Severity.warning);
const gray = severityToColor(Severity.information);
const pink = severityToColor(Severity.hint);
const line: string[] = [chalk.cyan(hintId)];
if (errors > 0) {
line.push(red(getMessage(errors === 1 ? 'errorCount' : 'errorsCount', language, errors.toString())));
}
if (warnings > 0) {
line.push(yellow(getMessage(warnings === 1 ? 'warningCount' : 'warningsCount', language, warnings.toString())));
}
if (hints > 0) {
line.push(pink(getMessage(hints === 1 ? 'hintCount' : 'hintsCount', language, hints.toString())));
}
if (informations > 0) {
line.push(gray(getMessage(informations === 1 ? 'informationCount' : 'informationsCount', language, informations.toString())));
}
tableData.push(line);
_.forEach(sortedMessages, (msg: Problem) => {
const color = severityToColor(msg.severity);
const severity = color(getMessage(`capitalized${Severity[msg.severity].toString()}` as MessageName, language));
partials[msg.severity.toString()]++;
const line: string = printPosition(msg.location.line, getMessage('line', language));
const column: string = printPosition(msg.location.column, getMessage('col', language));
if (line) {
hasPosition = true;
}
tableData.push([line, column, severity, msg.message, msg.hintId]);
});
_.forEach(sortedResources, ([hintId, problems]) => {
const msgsBySeverity = _.groupBy(problems, 'severity');
const errors = msgsBySeverity[Severity.error] ? msgsBySeverity[Severity.error].length : 0;
const warnings = msgsBySeverity[Severity.warning] ? msgsBySeverity[Severity.warning].length : 0;
const informations = msgsBySeverity[Severity.information] ? msgsBySeverity[Severity.information].length : 0;
const hints = msgsBySeverity[Severity.hint] ? msgsBySeverity[Severity.hint].length : 0;
const red = severityToColor(Severity.error);
const yellow = severityToColor(Severity.warning);
const gray = severityToColor(Severity.information);
const pink = severityToColor(Severity.hint);
const line: string[] = [chalk.cyan(hintId)];
if (errors > 0) {
line.push(red(getMessage(errors === 1 ? 'errorCount' : 'errorsCount', language, errors.toString())));
}
if (warnings > 0) {
line.push(yellow(getMessage(warnings === 1 ? 'warningCount' : 'warningsCount', language, warnings.toString())));
}
if (hints > 0) {
line.push(pink(getMessage(hints === 1 ? 'hintCount' : 'hintsCount', language, hints.toString())));
}
if (informations > 0) {
line.push(gray(getMessage(informations === 1 ? 'informationCount' : 'informationsCount', language, informations.toString())));
}
_.forEach(sortedResources, ([hintId, problems]) => {
const msgsBySeverity = _.groupBy(problems, 'severity');
const errors = msgsBySeverity[Severity.error] ? msgsBySeverity[Severity.error].length : 0;
const warnings = msgsBySeverity[Severity.warning] ? msgsBySeverity[Severity.warning].length : 0;
const informations = msgsBySeverity[Severity.information] ? msgsBySeverity[Severity.information].length : 0;
const hints = msgsBySeverity[Severity.hint] ? msgsBySeverity[Severity.hint].length : 0;
const red = severityToColor(Severity.error);
const yellow = severityToColor(Severity.warning);
const gray = severityToColor(Severity.information);
const pink = severityToColor(Severity.hint);
const line: string[] = [chalk.cyan(hintId)];
if (errors > 0) {
line.push(red(getMessage(errors === 1 ? 'errorCount' : 'errorsCount', language, errors.toString())));
}
if (warnings > 0) {
line.push(yellow(getMessage(warnings === 1 ? 'warningCount' : 'warningsCount', language, warnings.toString())));
}
if (hints > 0) {
line.push(pink(getMessage(hints === 1 ? 'hintCount' : 'hintsCount', language, hints.toString())));
}
if (informations > 0) {
line.push(gray(getMessage(informations === 1 ? 'informationCount' : 'informationsCount', language, informations.toString())));