Skip to content

Commit 76485a8

Browse files
cknittcristianoc
authored andcommitted
exit 1 if analysis issues found
1 parent 47f510a commit 76485a8

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/Log_.ml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,11 @@ module Stats = struct
135135
^ (sortedIssues
136136
|> List.map (fun (name, cnt) -> name ^ ":" ^ string_of_int !cnt)
137137
|> String.concat ", ")
138-
^ ")"))
138+
^ ")"));
139+
140+
nIssues
141+
else
142+
0
139143
end
140144

141145
type kind = Warning | Error

src/Reanalyze.ml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,10 @@ let runAnalysis ~cmtRoot ~ppf =
9595
if runConfig.exception_ then Exception.reportResults ~ppf;
9696
if runConfig.noalloc then Noalloc.reportResults ~ppf;
9797
if runConfig.termination then Arnold.reportResults ~ppf;
98-
Log_.Stats.report ();
98+
let nIssues = Log_.Stats.report () in
9999
Log_.Stats.clear ();
100-
if !Common.Cli.json then EmitJson.finish ()
100+
if !Common.Cli.json then EmitJson.finish ();
101+
if nIssues > 0 then exit 1
101102

102103
let cli () =
103104
let analysisKindSet = ref false in

0 commit comments

Comments
 (0)