Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
pipe command line arguments through the backend to run additional che…
…cks after type checking

Reviewed By: shannonzhu

Differential Revision: D10519389

fbshipit-source-id: 706cb69a2283d4d9ac93b62958702c62847c4697
  • Loading branch information
dkgi authored and facebook-github-bot committed Oct 25, 2018
1 parent 2884735 commit 67d9b0f
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 0 deletions.
2 changes: 2 additions & 0 deletions command/analyzeCommand.ml
Expand Up @@ -21,6 +21,7 @@ let run_analysis
show_error_traces
infer
recursive_infer
run_additional_checks
sequential
filter_directories
number_of_workers
Expand Down Expand Up @@ -50,6 +51,7 @@ let run_analysis
?logger
~infer
~recursive_infer
~run_additional_checks
~project_root:(Path.create_absolute project_root)
~parallel:(not sequential)
?filter_directories
Expand Down
2 changes: 2 additions & 0 deletions command/checkCommand.ml
Expand Up @@ -22,6 +22,7 @@ let run_check
show_error_traces
infer
recursive_infer
run_additional_checks
sequential
filter_directories
number_of_workers
Expand Down Expand Up @@ -51,6 +52,7 @@ let run_check
?logger
~infer
~recursive_infer
~run_additional_checks
~project_root:(Path.create_absolute project_root)
~parallel:(not sequential)
?filter_directories
Expand Down
2 changes: 2 additions & 0 deletions command/incrementalCommand.ml
Expand Up @@ -19,6 +19,7 @@ let run
show_error_traces
infer
recursive_infer
run_additional_checks
sequential
filter_directories
number_of_workers
Expand Down Expand Up @@ -49,6 +50,7 @@ let run
?logger
~infer
~recursive_infer
~run_additional_checks
~parallel:(not sequential)
?filter_directories
~number_of_workers
Expand Down
2 changes: 2 additions & 0 deletions command/specification.ml
Expand Up @@ -5,6 +5,7 @@

open Core


let base_command_line_arguments =
Command.Spec.(
empty
Expand All @@ -27,6 +28,7 @@ let base_command_line_arguments =
"-recursive-infer"
no_arg
~doc:"Recursively run infer until no new annotations are generated."
+> flag "-run-additional-checks" no_arg ~doc:"Run additional checks after type checking"
+> flag "-sequential" no_arg ~doc:"Turn off parallel processing (parallel on by default)."
(* Delete -filter-directories once there are no callers *)
+> flag
Expand Down
1 change: 1 addition & 0 deletions command/specification.mli
Expand Up @@ -14,6 +14,7 @@ val base_command_line_arguments
-> bool
-> bool
-> bool
-> bool
-> string option
-> int
-> string
Expand Down
2 changes: 2 additions & 0 deletions command/startCommand.ml
Expand Up @@ -570,6 +570,7 @@ let run_start_command
show_error_traces
infer
recursive_infer
run_additional_checks
sequential
filter_directories
number_of_workers
Expand All @@ -594,6 +595,7 @@ let run_start_command
~debug
~infer
~recursive_infer
~run_additional_checks
~strict
~declare
~show_error_traces
Expand Down
5 changes: 5 additions & 0 deletions configuration.ml
Expand Up @@ -13,6 +13,7 @@ module Analysis = struct
start_time: float;
infer: bool;
recursive_infer: bool;
run_additional_checks: bool;
parallel: bool;
filter_directories: (Path.t list) option;
number_of_workers: int;
Expand All @@ -32,9 +33,11 @@ module Analysis = struct
}
[@@deriving show]


let equal first second =
first.infer = second.infer &&
first.recursive_infer = second.recursive_infer &&
first.run_additional_checks = second.run_additional_checks &&
first.debug = second.debug &&
first.expected_version = second.expected_version &&
first.strict = second.strict &&
Expand All @@ -45,6 +48,7 @@ module Analysis = struct
?(start_time = Unix.time())
?(infer = false)
?(recursive_infer = false)
?(run_additional_checks = false)
?(parallel = true)
?filter_directories
?(number_of_workers = 4)
Expand All @@ -66,6 +70,7 @@ module Analysis = struct
start_time;
infer;
recursive_infer;
run_additional_checks;
parallel;
filter_directories;
number_of_workers;
Expand Down
2 changes: 2 additions & 0 deletions configuration.mli
Expand Up @@ -10,6 +10,7 @@ module Analysis: sig
start_time: float;
infer: bool;
recursive_infer: bool;
run_additional_checks: bool;
parallel: bool;
filter_directories: (Path.t list) option;
number_of_workers: int;
Expand All @@ -33,6 +34,7 @@ module Analysis: sig
: ?start_time: float
-> ?infer: bool
-> ?recursive_infer: bool
-> ?run_additional_checks: bool
-> ?parallel: bool
-> ?filter_directories: Path.t list
-> ?number_of_workers: int
Expand Down
9 changes: 9 additions & 0 deletions service/check.ml
Expand Up @@ -29,6 +29,7 @@ let analyze_sources
~configuration:({
Configuration.Analysis.project_root;
filter_directories;
run_additional_checks;
_;
} as configuration)
~environment
Expand Down Expand Up @@ -122,6 +123,7 @@ let analyze_sources
|> List.sort ~compare:File.Handle.compare
in
Statistics.performance ~name:"filtered directories" ~timer ();

Log.info "Checking %d sources..." (List.length handles);
let timer = Timer.start () in
let empty_result = {
Expand Down Expand Up @@ -175,9 +177,16 @@ let analyze_sources
()
in
Statistics.performance ~name:"analyzed sources" ~timer ();

let timer = Timer.start () in
let errors = Postprocess.ignore ~configuration scheduler handles errors in
Statistics.performance ~name:"postprocessed" ~timer ();

let timer = Timer.start () in
if run_additional_checks then
Log.info "Running additional checks (not yet implemented)...";
Statistics.performance ~name:"additional_checks" ~timer ();

errors, coverage


Expand Down

0 comments on commit 67d9b0f

Please sign in to comment.