Skip to content

Commit

Permalink
Merge pull request #17 from juliensnz/main
Browse files Browse the repository at this point in the history
fix return code to match the documentation
  • Loading branch information
webpro committed Oct 18, 2022
2 parents 8c815a2 + 37a65b5 commit e4b322d
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,12 @@ const run = async () => {
});

printReport({ report, issues, cwd, workingDir, isDev, options: reporterOptions });
const totalErrorCount = (Object.keys(report) as IssueGroup[])
.filter((reportGroup) => report[reportGroup])
.map(reportGroup => reportGroup === 'unlisted' ? 'unresolved' : reportGroup)
.reduce((errorCount: number, reportGroup) => errorCount + counters[reportGroup], 0);

const reportGroup = report.files ? 'files' : (Object.keys(report) as IssueGroup[]).find(key => report[key]);
const counterGroup = reportGroup === 'unlisted' ? 'unresolved' : reportGroup;
if (counterGroup) {
const count = counters[counterGroup];
if (count > Number(maxIssues)) process.exit(count);
}
if (totalErrorCount > Number(maxIssues)) process.exit(totalErrorCount);
} catch (error: unknown) {
if (error instanceof ConfigurationError) {
console.error(error.message + '\n');
Expand Down

0 comments on commit e4b322d

Please sign in to comment.