[cost] Modify error message to include trace and constructor information

Reviewed By: ngorogiannis

Differential Revision: D15713465

fbshipit-source-id: e43f118a4
master
Ezgi Çiçek 6 years ago committed by Facebook Github Bot
parent caef28f49e
commit 6f422fb78f

@ -172,7 +172,10 @@ let issue_of_cost cost_info ~delta ~prev_cost ~curr_cost =
in in
let pp_extra_msg fmt () = let pp_extra_msg fmt () =
if Config.developer_mode then curr_cost_msg fmt () if Config.developer_mode then curr_cost_msg fmt ()
else Format.fprintf fmt "Please make sure this is an expected change." else
Format.fprintf fmt
"Please make sure this is an expected change. You can inspect the trace to understand \
the complexity increase:"
in in
let cold_start_msg = let cold_start_msg =
if ExternalPerfData.in_profiler_data_map procname then if ExternalPerfData.in_profiler_data_map procname then
@ -181,7 +184,14 @@ let issue_of_cost cost_info ~delta ~prev_cost ~curr_cost =
else "" else ""
in in
let prev_degree_with_term = CostDomain.BasicCost.get_degree_with_term prev_cost in let prev_degree_with_term = CostDomain.BasicCost.get_degree_with_term prev_cost in
Format.asprintf "Complexity of this function has %a from %a to %a. %s %a" let msg =
(* Java Only *)
if String.equal method_name Typ.Procname.Java.constructor_method_name then "constructor"
else if String.equal method_name Typ.Procname.Java.class_initializer_method_name then
"class initializer"
else "this function"
in
Format.asprintf "Complexity of %s has %a from %a to %a. %s %a" msg
(MarkupFormatter.wrap_bold pp_delta) (MarkupFormatter.wrap_bold pp_delta)
delta delta
(MarkupFormatter.wrap_monospaced (CostDomain.BasicCost.pp_degree ~only_bigO:true)) (MarkupFormatter.wrap_monospaced (CostDomain.BasicCost.pp_degree ~only_bigO:true))

Loading…
Cancel
Save