From 8793ce95eabcfc8a85fbb00ff76b2fa8e9e5e2cb Mon Sep 17 00:00:00 2001 From: Virgile Prevosto <virgile.prevosto@m4x.org> Date: Wed, 2 Dec 2020 10:08:18 +0100 Subject: [PATCH] [mdr] put all Eva dependencies in a single file --- src/plugins/markdown-report/Makefile.in | 2 +- src/plugins/markdown-report/configure.ac | 2 ++ .../markdown-report/{eva_coverage.ml => eva_info.ml} | 12 ++++++++++-- .../{eva_coverage.mli => eva_info.mli} | 7 +++++-- src/plugins/markdown-report/md_gen.ml | 10 ++-------- 5 files changed, 20 insertions(+), 13 deletions(-) rename src/plugins/markdown-report/{eva_coverage.ml => eva_info.ml} (96%) rename src/plugins/markdown-report/{eva_coverage.mli => eva_info.mli} (88%) diff --git a/src/plugins/markdown-report/Makefile.in b/src/plugins/markdown-report/Makefile.in index 833c1113e09..5b79c428b72 100644 --- a/src/plugins/markdown-report/Makefile.in +++ b/src/plugins/markdown-report/Makefile.in @@ -36,7 +36,7 @@ PLUGIN_HAS_META:=yes PLUGIN_GENERATED:=$(PLUGIN_DIR)/Markdown_report.mli PLUGIN_CMO:=\ sarif mdr_params parse_remarks \ - eva_coverage md_gen sarif_gen mdr_register + eva_info md_gen sarif_gen mdr_register PLUGIN_DISTRIBUTED:=$(PLUGIN_ENABLE) PLUGIN_REQUIRES:=ppx_deriving ppx_deriving_yojson yojson PLUGIN_DISTRIB_EXTERNAL:= Makefile.in configure.ac configure share/acsl.xml diff --git a/src/plugins/markdown-report/configure.ac b/src/plugins/markdown-report/configure.ac index f9fb685d200..b187dc61bc2 100644 --- a/src/plugins/markdown-report/configure.ac +++ b/src/plugins/markdown-report/configure.ac @@ -35,6 +35,8 @@ m4_ifndef([FRAMAC_M4_MACROS], check_plugin(mdr,PLUGIN_RELATIVE_PATH(plugin_file),[Markdown/SARIF report plug-in],yes) +plugin_use(mdr,eva) + plugin_require_pkg(mdr,ppx_deriving) plugin_require_pkg(mdr,ppx_deriving_yojson) diff --git a/src/plugins/markdown-report/eva_coverage.ml b/src/plugins/markdown-report/eva_info.ml similarity index 96% rename from src/plugins/markdown-report/eva_coverage.ml rename to src/plugins/markdown-report/eva_info.ml index 3b04f7e3077..1825feb942d 100644 --- a/src/plugins/markdown-report/eva_coverage.ml +++ b/src/plugins/markdown-report/eva_info.ml @@ -184,7 +184,9 @@ let nb_fundefs () = is_analyzed_function (Kernel_function.get_vi kf) then nb + 1 else nb) 0 -let md_gen () = +open Markdown + +let coverage_md_gen () = let main = Kernel.MainFunction.get () in !Db.Value.compute (); let vis = new eva_coverage_vis ~from_entry_point:false in @@ -227,4 +229,10 @@ let md_gen () = (float_of_int stats.covered_stmts *. 100. /. float_of_int stats.total_stmts) in - Markdown.([ Block [Text summary_whole]; Block [Text summary ]]) + [ Block [Text summary_whole]; Block [Text summary ]] + +let domains_md_gen () = + let eva_domains = Eva.Value_parameters.enabled_domains () in + let domains = List.filter (fun (name, _) -> name <> "cvalue") eva_domains in + let aux (name, descr) = (plain "domain" @ bold name), plain descr in + List.map aux domains diff --git a/src/plugins/markdown-report/eva_coverage.mli b/src/plugins/markdown-report/eva_info.mli similarity index 88% rename from src/plugins/markdown-report/eva_coverage.mli rename to src/plugins/markdown-report/eva_info.mli index 68e7b5fb773..ca9054b9482 100644 --- a/src/plugins/markdown-report/eva_coverage.mli +++ b/src/plugins/markdown-report/eva_info.mli @@ -20,5 +20,8 @@ (* *) (**************************************************************************) -(** generates a coverage summary of EVA's run*) -val md_gen: unit -> Markdown.element list +(** generates a coverage summary of Eva's run*) +val coverage_md_gen: unit -> Markdown.elements + +(** generates a summary of activated Eva domains. *) +val domains_md_gen: unit -> (Markdown.text * Markdown.text) list diff --git a/src/plugins/markdown-report/md_gen.ml b/src/plugins/markdown-report/md_gen.ml index a230323fc8c..a23672c24fb 100644 --- a/src/plugins/markdown-report/md_gen.ml +++ b/src/plugins/markdown-report/md_gen.ml @@ -49,12 +49,6 @@ let plural l s = | [] | [ _ ] -> s | _::_::_ -> s ^ "s" -let get_eva_domains () = - let eva_domains = Eva.Value_parameters.enabled_domains () in - let domains = List.filter (fun (name, _) -> name <> "cvalue") eva_domains in - let aux (name, descr) = (plain "domain" @ bold name), plain descr in - List.map aux domains - let section_domains env = let anchor = "domains" in let head = H3 (plain "Eva Domains", Some anchor) in @@ -63,7 +57,7 @@ let section_domains env = :: Comment "You can give more information about the choice of Eva domains" :: insert_marks env anchor else begin - let l = get_eva_domains () in + let l = Eva_info.domains_md_gen () in head :: Block (match l with @@ -271,7 +265,7 @@ let gen_context env = let gen_coverage env = let anchor = "coverage" in let header = H1 (plain "Coverage", Some anchor) in - let content = Eva_coverage.md_gen () in + let content = Eva_info.coverage_md_gen () in let content = if env.is_draft then content @ -- GitLab