diff --git a/review/diff_parser.ml b/review/diff_parser.ml index fccf912..cb0d2ef 100644 --- a/review/diff_parser.ml +++ b/review/diff_parser.ml @@ -76,7 +76,7 @@ let file_head : _ option parser = let a_chunk : chunk parser = log "%d: a_chunk" __LINE__; - let* info = Line_parser.(run ~info:"chunk_head" @@ chunk_head "chunk_head") in + let* info = Line_parser.(run ~info:"chunk_head" chunk_head "chunk_head") in (* The string '\ No new line in the end of file' could be in an arbitrary place of the diff. So we do filter of result *) let* diffs = diff --git a/review/line_parser.ml b/review/line_parser.ml index 4b1de0e..d2565b6 100644 --- a/review/line_parser.ml +++ b/review/line_parser.ml @@ -79,7 +79,7 @@ let pos_num : int parser = | '0' .. '9' -> true | _ -> false in - take_while1 is_digit >>| fun s -> int_of_string s + take_while1 is_digit >>| int_of_string ;; let chunk_head : chunk_info parser = diff --git a/src/Collected_decls.ml b/src/Collected_decls.ml index e6dea93..7629566 100644 --- a/src/Collected_decls.ml +++ b/src/Collected_decls.ml @@ -1,3 +1,11 @@ +[@@@ocaml.text "/*"] + +(** Copyright 2021-2024, Kakadu. *) + +(** SPDX-License-Identifier: LGPL-3.0-or-later *) + +[@@@ocaml.text "/*"] + open Utils module StringSet = Set.Make (String) diff --git a/src/Collected_lints.ml b/src/Collected_lints.ml index eafa146..4cc8a39 100644 --- a/src/Collected_lints.ml +++ b/src/Collected_lints.ml @@ -51,7 +51,7 @@ let report () = let (_ : int) = Sys.command (Format.asprintf "touch %s" s) in (* By some reason on CI Open_creat is not enough to create a file *) let ch = Caml.open_out_gen [ Caml.Open_append; Open_creat ] 0o666 s in - [ ( (fun (module M : LINT.REPORTER) ppf -> M.rdjsonl ppf) + [ ( (fun (module M : LINT.REPORTER) -> M.rdjsonl) , Caml.Format.formatter_of_out_channel ch , ch ) ] diff --git a/src/Dune_project.ml b/src/Dune_project.ml index 88869af..876c956 100644 --- a/src/Dune_project.ml +++ b/src/Dune_project.ml @@ -1,3 +1,11 @@ +[@@@ocaml.text "/*"] + +(** Copyright 2021-2024, Kakadu. *) + +(** SPDX-License-Identifier: LGPL-3.0-or-later *) + +[@@@ocaml.text "/*"] + let string_of_sexp = Base.string_of_sexp let sexp_of_string = Base.sexp_of_string let option_of_sexp = Base.option_of_sexp diff --git a/src/Lint_filesystem.mli b/src/Lint_filesystem.mli index c41ad2a..22faa4f 100644 --- a/src/Lint_filesystem.mli +++ b/src/Lint_filesystem.mli @@ -1,2 +1,10 @@ +[@@@ocaml.text "/*"] + +(** Copyright 2021-2024, Kakadu. *) + +(** SPDX-License-Identifier: LGPL-3.0-or-later *) + +[@@@ocaml.text "/*"] + val check : Dune_project.t list -> unit val describe_as_json : unit -> Yojson.Safe.t diff --git a/src/Unused_ML_logger.ml b/src/Unused_ML_logger.ml index 66db0fd..b39a390 100644 --- a/src/Unused_ML_logger.ml +++ b/src/Unused_ML_logger.ml @@ -15,8 +15,7 @@ open Utils let run _info filename fallback = let _ : string = filename in - let rec get_ident_string path = - match path with + let rec get_ident_string = function | Path.Pident id -> Some (Ident.name id) | Path.Pdot (lhs, rhs) -> get_ident_string lhs |> Option.map ~f:(fun str -> str ^ "." ^ rhs) diff --git a/src/fix/replacement/log.ml b/src/fix/replacement/log.ml index f2079fe..6293695 100644 --- a/src/fix/replacement/log.ml +++ b/src/fix/replacement/log.ml @@ -36,11 +36,11 @@ let create_file name = ;; let rec rm path = - match Sys.is_directory path with - | true -> + if Sys.is_directory path + then ( Sys.readdir path |> Array.iter (fun f -> rm (fix_dir ^ f)); - Sys.rmdir path - | false -> Sys.remove path + Sys.rmdir path) + else Sys.remove path ;; let prepare_env () = diff --git a/src/fix/replacement/padding.ml b/src/fix/replacement/padding.ml index ed193ab..d65702c 100644 --- a/src/fix/replacement/padding.ml +++ b/src/fix/replacement/padding.ml @@ -68,9 +68,9 @@ let payload_between_repls (loc_end_buf, loc_start_repl) flines = loc_start_repl.pos_lnum, loc_start_repl.pos_cnum - loc_start_repl.pos_bol in let payload = - match end_buf_line = repl_line with - | true -> String.sub flines.(repl_line - 1) end_buf_col (repl_col - end_buf_col) - | false -> + if end_buf_line = repl_line + then String.sub flines.(repl_line - 1) end_buf_col (repl_col - end_buf_col) + else ( let lines = String.sub flines.(end_buf_line - 1) @@ -83,8 +83,7 @@ let payload_between_repls (loc_end_buf, loc_start_repl) flines = (Format.sprintf "%s\n" lines) (Array.sub flines end_buf_line (repl_line - end_buf_line - 1)) in - let lines = lines ^ String.sub flines.(repl_line - 1) 0 repl_col in - lines + lines ^ String.sub flines.(repl_line - 1) 0 repl_col) in payload ;; @@ -123,9 +122,9 @@ let comments_inside_loc comms fix_loc = let relative_pos st_pos pos = let rel_lnum = pos.pos_lnum - st_pos.pos_lnum in let rel_bol, rel_cnum = - match rel_lnum = 0 with - | true -> pos.pos_bol - st_pos.pos_bol, pos.pos_cnum - st_pos.pos_cnum - | false -> pos.pos_bol, pos.pos_cnum + if rel_lnum = 0 + then pos.pos_bol - st_pos.pos_bol, pos.pos_cnum - st_pos.pos_cnum + else pos.pos_bol, pos.pos_cnum in { pos with pos_bol = rel_bol; pos_cnum = rel_cnum; pos_lnum = rel_lnum + 1 } ;; diff --git a/src/pattern/Tast_pattern.ml b/src/pattern/Tast_pattern.ml index 5293558..c0b3c46 100644 --- a/src/pattern/Tast_pattern.ml +++ b/src/pattern/Tast_pattern.ml @@ -304,8 +304,7 @@ let path xs = T (helper (List.rev xs)) ;; -let path_of_list xs = - match xs with +let path_of_list = function | [] -> failwith "Bad argument: path_of_list" | s :: tl -> List.fold_left diff --git a/src/typed/Eta.ml b/src/typed/Eta.ml index 914742e..e31083b 100644 --- a/src/typed/Eta.ml +++ b/src/typed/Eta.ml @@ -121,8 +121,9 @@ let run _ fallback = (List.length ids) (List.length args); *) let idents = List.filter_map ~f:extract_ident args in - if List.length args > 0 - && List.length args = List.length idents + let args_len = List.length args in + if args_len > 0 + && args_len = List.length idents && List.equal String.equal ids (List.map idents ~f:Ident.name) && (not (Base.List.contains_dup ~compare:String.compare ids)) && List.for_all idents ~f:(fun ident -> no_ident ident func)