From 71d5b2f8ff9e54a64766e80fe04d1b48a45b902e Mon Sep 17 00:00:00 2001 From: Martino Luca Date: Wed, 14 Nov 2018 07:17:25 -0800 Subject: [PATCH] [Infer][Perf] Enrich messages with Markup syntax Summary: Messages emitted by cost-analysis now look like the following: Complexity of this function has **increased** from `O(1)` to `O(n)`. Reviewed By: mbouaziz Differential Revision: D13058008 fbshipit-source-id: 119037703 --- infer/src/backend/Differential.ml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/infer/src/backend/Differential.ml b/infer/src/backend/Differential.ml index 5858bec3a..f7c9752da 100644 --- a/infer/src/backend/Differential.ml +++ b/infer/src/backend/Differential.ml @@ -150,9 +150,13 @@ let issue_of_cost cost_info ~delta ~prev_cost ~curr_cost = CostDomain.BasicCost.pp_degree cost_polynomial else () in - Format.asprintf "Complexity of this function has %a from %a to %a.%a" pp_delta delta - CostDomain.BasicCost.pp_degree_hum prev_cost CostDomain.BasicCost.pp_degree_hum curr_cost - pp_raw_cost curr_cost + Format.asprintf "Complexity of this function has %a from %a to %a.%a" + (MarkupFormatter.wrap_bold pp_delta) + delta + (MarkupFormatter.wrap_monospaced CostDomain.BasicCost.pp_degree_hum) + prev_cost + (MarkupFormatter.wrap_monospaced CostDomain.BasicCost.pp_degree_hum) + curr_cost pp_raw_cost curr_cost in let line = cost_info.Jsonbug_t.loc.lnum in let column = cost_info.Jsonbug_t.loc.cnum in