Skip to content

Commit cba1e2b

Browse files
molantalrra
authored andcommitted
Return with exit code 0 if there are only warnings
Fix #102 Close #110
1 parent 0b35971 commit cba1e2b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/lib/cli.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,9 @@ import * as Config from './config';
2424
import * as sonar from './sonar';
2525
import * as validator from './config/config-validator';
2626
import * as resourceLoader from './util/resource-loader';
27-
2827
import { getAsUris } from './util/get-as-uri';
29-
3028
import { loadJSONFile } from './util/file-loader';
29+
import { Severity } from './interfaces';
3130

3231
const pkg = loadJSONFile(path.join(__dirname, '../../../package.json'));
3332

@@ -86,10 +85,15 @@ export const cli = {
8685
for (const target of targets) {
8786
try {
8887
const results = await engine.executeOn(target); // eslint-disable-line no-await-in-loop
88+
const hasError = results.some((result) => {
89+
return result.severity === Severity.error;
90+
});
8991

90-
if (results.length > 0) {
92+
format(results);
93+
94+
if (hasError) {
9195
exitCode = 1;
92-
format(results);
96+
9397
}
9498
} catch (e) {
9599
exitCode = 1;

0 commit comments

Comments
 (0)