diff options
author | Chimrod <> | 2024-12-02 09:05:18 +0100 |
---|---|---|
committer | Chimrod <> | 2024-12-02 09:05:18 +0100 |
commit | 53c02501935b3cb2db78e79deb4d38c997505a95 (patch) | |
tree | 88a75e012ee186ffb6c6e3e0c53ba80610ec3b0b /bin | |
parent | 9e7b9de243e488e15d2c7528ce64e569eba8add2 (diff) |
Moved the checks in a dedicated library
Diffstat (limited to 'bin')
-rw-r--r-- | bin/args.ml | 6 | ||||
-rw-r--r-- | bin/args.mli | 2 | ||||
-rw-r--r-- | bin/dune | 1 | ||||
-rw-r--r-- | bin/qsp_parser.ml | 22 |
4 files changed, 16 insertions, 15 deletions
diff --git a/bin/args.ml b/bin/args.ml index 54751c8..b124575 100644 --- a/bin/args.ml +++ b/bin/args.ml @@ -29,7 +29,7 @@ let disable_module modules identifier = String.sub identifier ~pos:1 ~len:(String.length identifier - 1) in List.iter modules ~f:(fun t -> - let (module C : Qsp_syntax.S.Analyzer) = Qsp_syntax.Check.get_module t in + let (module C : Qsp_syntax.S.Analyzer) = Qsp_checks.Check.get_module t in if String.equal C.identifier identifier then C.active := false) let enable_module modules identifier = @@ -37,7 +37,7 @@ let enable_module modules identifier = String.sub identifier ~pos:1 ~len:(String.length identifier - 1) in List.iter modules ~f:(fun t -> - let (module C : Qsp_syntax.S.Analyzer) = Qsp_syntax.Check.get_module t in + let (module C : Qsp_syntax.S.Analyzer) = Qsp_checks.Check.get_module t in if String.equal C.identifier identifier then C.active := true) let speclist printer = @@ -74,7 +74,7 @@ let speclist printer = common_arguments @ windows_arguments let parse : - modules:Qsp_syntax.Check.t list -> + modules:Qsp_checks.Check.t list -> list_tests:(Format.formatter -> unit) -> string list * t = fun ~modules ~list_tests -> diff --git a/bin/args.mli b/bin/args.mli index fb15542..0041b59 100644 --- a/bin/args.mli +++ b/bin/args.mli @@ -4,6 +4,6 @@ type t = { reset_line : bool; filters : filters } (** All the arguments given from the command line *) val parse : - modules:Qsp_syntax.Check.t list -> + modules:Qsp_checks.Check.t list -> list_tests:(Format.formatter -> unit) -> string list * t @@ -4,6 +4,7 @@ (libraries sedlex qsp_syntax + qsp_checks qparser tools ) diff --git a/bin/qsp_parser.ml b/bin/qsp_parser.ml index 4eb5c66..cdd509c 100644 --- a/bin/qsp_parser.ml +++ b/bin/qsp_parser.ml @@ -19,12 +19,12 @@ type ctx = { error_nb : int; warn_nb : int; debug_nb : int; fatal_error : bool } *) let available_checks = [ - snd @@ Qsp_syntax.Check.build (module Qsp_syntax.Type_of); - snd @@ Qsp_syntax.Check.build (module Qsp_syntax.Dead_end); - snd @@ Qsp_syntax.Check.build (module Qsp_syntax.Nested_strings); - snd @@ Qsp_syntax.Check.build (module Qsp_syntax.Locations); - snd @@ Qsp_syntax.Check.build (module Qsp_syntax.Dup_test); - snd @@ Qsp_syntax.Check.build (module Qsp_syntax.Write_only); + snd @@ Qsp_checks.Check.build (module Qsp_checks.Type_of); + snd @@ Qsp_checks.Check.build (module Qsp_checks.Dead_end); + snd @@ Qsp_checks.Check.build (module Qsp_checks.Nested_strings); + snd @@ Qsp_checks.Check.build (module Qsp_checks.Locations); + snd @@ Qsp_checks.Check.build (module Qsp_checks.Dup_test); + snd @@ Qsp_checks.Check.build (module Qsp_checks.Write_only); ] let pp_module formatter (module A : Qsp_syntax.S.Analyzer) = @@ -42,7 +42,7 @@ let pp_modules formatter = let max_length = List.fold_left available_checks ~init:0 ~f:(fun l v -> let (module A : Qsp_syntax.S.Analyzer) = - Qsp_syntax.Check.get_module v + Qsp_checks.Check.get_module v in max l (String.length A.identifier)) in @@ -61,7 +61,7 @@ let pp_modules formatter = Format.fprintf formatter "%a" (Format.pp_print_list (fun f v -> - let m = Qsp_syntax.Check.get_module v in + let m = Qsp_checks.Check.get_module v in pp_module f m) ~pp_sep:(fun f () -> Format.pp_force_newline f ())) available_checks; @@ -74,11 +74,11 @@ let pp_modules formatter = from the command line before. *) let checkers : (module Qsp_syntax.S.Analyzer) Lazy.t = lazy - (let module Check = Qsp_syntax.Check.Make (struct + (let module Check = Qsp_checks.Check.Make (struct let t = List.filter available_checks ~f:(fun v -> let (module A : Qsp_syntax.S.Analyzer) = - Qsp_syntax.Check.get_module v + Qsp_checks.Check.get_module v in !A.active) |> Array.of_list @@ -142,7 +142,7 @@ let () = (* Deactivate the tests which only applies to a global file *) List.iter available_checks ~f:(fun t -> let (module C : Qsp_syntax.S.Analyzer) = - Qsp_syntax.Check.get_module t + Qsp_checks.Check.get_module t in if C.is_global && !C.active then C.active := false); (* The source file are in UTF-8, and we can use the file line number as |