diff --git a/src/plugins/report/classify.ml b/src/plugins/report/classify.ml index 1c6c22f3d644838f5ab6dbbe6e833784f446642e..f78b7a4c99b29b9c551aafd304a259bc7d6c322e 100644 --- a/src/plugins/report/classify.ml +++ b/src/plugins/report/classify.ml @@ -520,14 +520,14 @@ let report_dump fmt = end let report_output file = - R.feedback "Output %s@." file ; - Command.print_file file report_dump + R.feedback "Output %a@." Filepath.Normalized.pretty file; + Command.print_file (file:>string) report_dump let report_number name nb opt = if nb > 0 then R.feedback "%s%4d" name nb ; let file = opt () in - if file <> "" then - let out = open_out file in + if not (Filepath.Normalized.is_unknown file) then + let out = open_out (file:>string) in output_string out (string_of_int nb) ; flush out ; close_out out @@ -541,7 +541,7 @@ let classify () = not (R.Output.is_set ())) then report_console () ; let file = R.Output.get () in - if file <> "" then report_output file ; + if not (Filepath.Normalized.is_unknown file) then report_output file ; report_number "Reviews : " !nb_reviews R.OutputReviews.get ; report_number "Errors : " !nb_errors R.OutputErrors.get ; report_number "Unclassified: " !nb_unclassified R.OutputUnclassified.get ; diff --git a/src/plugins/report/csv.ml b/src/plugins/report/csv.ml index bd6becb61a8ef9dbb6b4dde3387827fcfec7fa71..f35afcec6251d41e225651975697f516a5fe0647 100644 --- a/src/plugins/report/csv.ml +++ b/src/plugins/report/csv.ml @@ -95,8 +95,9 @@ let print_csv = let print_csv_once () = let file = Report_parameters.CSVFile.get () in - Report_parameters.feedback "Dumping properties in '%s'" file; - print_csv file + Report_parameters.feedback "Dumping properties in '%a'" + Filepath.Normalized.pretty file; + print_csv (file:>string) let print_csv, _ = State_builder.apply_once @@ -107,7 +108,9 @@ let print_csv, _ = Property_status.self ] print_csv_once -let main () = if Report_parameters.CSVFile.get () <> "" then print_csv () +let main () = + if not (Filepath.Normalized.is_unknown (Report_parameters.CSVFile.get ())) + then print_csv () let () = Db.Main.extend main diff --git a/src/plugins/report/report_parameters.ml b/src/plugins/report/report_parameters.ml index b7f24343af6f4afc0dc5e609f2d6e535c0e3e42a..da18d1ca076be5d29c04d093f6f9ca169dfc57e4 100644 --- a/src/plugins/report/report_parameters.ml +++ b/src/plugins/report/report_parameters.ml @@ -73,11 +73,12 @@ module Proven = let () = Parameter_customize.set_group printing module CSVFile = - String + Filepath (struct let option_name = "-report-csv" let arg_name = "name" - let default = "" + let file_kind = "CSV" + let existence = Fc_Filepath.Indifferent let help = "if set, output properties as a csv file of the given name" end) @@ -166,12 +167,13 @@ module InvalidStatus = let () = Parameter_customize.set_group monitoring module Output = - String + Filepath (struct let option_name = "-report-output" let arg_name = "*.json" + let file_kind = "JSON" + let existence = Fc_Filepath.Indifferent let help = "Output -report-classify in JSON format" - let default = "" end) let () = Parameter_customize.set_group monitoring @@ -184,32 +186,35 @@ module AbsolutePath = let () = Parameter_customize.set_group monitoring module OutputReviews = - String + Filepath (struct let option_name = "-report-output-reviews" let arg_name = "file" + let file_kind = "Text" + let existence = Fc_Filepath.Indifferent let help = "Output number of reviews to <file>" - let default = "" end) let () = Parameter_customize.set_group monitoring module OutputErrors = - String + Filepath (struct let option_name = "-report-output-errors" let arg_name = "file" + let file_kind = "Text" + let existence = Fc_Filepath.Indifferent let help = "Output number of errors to <file>" - let default = "" end) let () = Parameter_customize.set_group monitoring module OutputUnclassified = - String + Filepath (struct let option_name = "-report-output-unclassified" let arg_name = "file" + let file_kind = "Text" + let existence = Fc_Filepath.Indifferent let help = "Output number of unclassified to <file>" - let default = "" end) let () = Parameter_customize.set_group monitoring diff --git a/src/plugins/report/report_parameters.mli b/src/plugins/report/report_parameters.mli index 0f806eeed28e8f2741737097c5079fa667404ac9..80602986b49cf3ff4669859c0bc49a1e9fa1ae84 100644 --- a/src/plugins/report/report_parameters.mli +++ b/src/plugins/report/report_parameters.mli @@ -29,7 +29,7 @@ module Untried: Parameter_sig.Bool module Specialized: Parameter_sig.Bool module Proven: Parameter_sig.Bool -module CSVFile: Parameter_sig.String +module CSVFile: Parameter_sig.Filepath module Classify: Parameter_sig.Bool module Rules: Parameter_sig.String_list module Warning: Parameter_sig.String @@ -39,10 +39,10 @@ module UntriedStatus: Parameter_sig.String module UnknownStatus: Parameter_sig.String module InvalidStatus: Parameter_sig.String -module Output: Parameter_sig.String -module OutputReviews: Parameter_sig.String -module OutputErrors: Parameter_sig.String -module OutputUnclassified: Parameter_sig.String +module Output: Parameter_sig.Filepath +module OutputReviews: Parameter_sig.Filepath +module OutputErrors: Parameter_sig.Filepath +module OutputUnclassified: Parameter_sig.Filepath module AbsolutePath: Parameter_sig.Bool module Stdout: Parameter_sig.Bool module Stderr: Parameter_sig.Bool