123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101(* Yoann Padioleau
*
* Copyright (C) 2010 Facebook
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2.1 as published by the Free Software Foundation, with the
* special exception on linking described in file license.txt.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the file
* license.txt for more details.
*)openCommonopenParse_info(*****************************************************************************)(* Prelude *)(*****************************************************************************)(*****************************************************************************)(* Types *)(*****************************************************************************)(* todo: do some generic red_green_and_heatmap helpers? so can factorize
* code with layer_coverage.ml
*)(*****************************************************************************)(* Helper *)(*****************************************************************************)(*****************************************************************************)(* Main entry point *)(*****************************************************************************)letgen_red_green_layer~rootstats=letroot=Common2.relative_to_absoluterootin{Layer_code.title="Parsing errors (red/green)";description="";files=stats|>List.map(funstat->letfile=stat.filename|>Common2.relative_to_absolute|>Common.readable~rootinfile,{Layer_code.micro_level=[];(* TODO use problematic_lines *)macro_level=[(ifstat.bad>0then"bad"else"ok"),1.];});kinds=Layer_code.red_green_properties;}letgen_heatmap_layer~rootstats=letroot=Common2.relative_to_absoluterootin{Layer_code.title="Parsing errors (heatmap)";description="lower is better";files=stats|>List.map(funstat->letfile=stat.filename|>Common2.relative_to_absolute|>Common.readable~rootinletcovered=stat.correctinletnot_covered=stat.badinletpercent=tryCommon2.pourcent_good_badnot_coveredcoveredwithDivision_by_zero->0infile,{Layer_code.micro_level=stat.problematic_lines|>List.map(fun(_strs,lineno)->lineno,"bad");macro_level=[(letpercent_round=(percent/10)*10inspf"cover %d%%"percent_round),1.];});kinds=Layer_code.heat_map_properties;}