File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,8 @@ module Cli = struct
28
28
29
29
let write = ref false
30
30
31
+ let exitCode = ref false
32
+
31
33
(* names to be considered live values *)
32
34
let liveNames = ref ([] : string list )
33
35
Original file line number Diff line number Diff line change @@ -98,7 +98,7 @@ let runAnalysis ~cmtRoot ~ppf =
98
98
let nIssues = Log_.Stats. report () in
99
99
Log_.Stats. clear () ;
100
100
if ! Common.Cli. json then EmitJson. finish () ;
101
- if nIssues > 0 then exit 1
101
+ if nIssues > 0 && ! Common.Cli. exitCode then exit 1
102
102
103
103
let cli () =
104
104
let analysisKindSet = ref false in
@@ -182,6 +182,9 @@ let cli () =
182
182
" comma-separated-path-prefixes Consider all values whose path has a \
183
183
prefix in the list as live" );
184
184
(" -noalloc" , Unit setNoalloc, " " );
185
+ ( " -set-exit-code" ,
186
+ Set Common.Cli. exitCode,
187
+ " Exit with code 1 in case an issue is detected" );
185
188
( " -suppress" ,
186
189
String
187
190
(fun s ->
You can’t perform that action at this time.
0 commit comments