• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Kakadu / zanuda / 48

29 Oct 2025 10:56AM UTC coverage: 86.198% (-0.008%) from 86.206%
48

push

github

Kakadu
[fix] Disable fixes collection unless enabled explicitly

Fixes are the information about how to change code to fix a lint.
Let's not collect this by default, because I discovered that sometimes
we can get Out_of_memory exception while doing this.
In general fixes are currently not working too good to be usable

Signed-off-by: Kakadu <Kakadu@pm.me>

12 of 16 new or added lines in 3 files covered. (75.0%)

7 existing lines in 3 files now uncovered.

2242 of 2601 relevant lines covered (86.2%)

554.17 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

75.0
/src/fix/refactoring/Propose_function.ml
1
[@@@ocaml.text "/*"]
2

3
(** Copyright 2021-2025, Kakadu. *)
4

5
(** SPDX-License-Identifier: LGPL-3.0-or-later *)
6

7
[@@@ocaml.text "/*"]
8

9
open Tast_pattern
10
open Utils
11
open Typedtree
12

13
exception Fix_error of Warnings.loc * string
14

15
let first_case ~loc = function
16
  | h :: _ -> h
4✔
17
  | [] -> raise (Fix_error (loc, "Can't match cases"))
×
18
;;
19

20
let get_match_constr_payload loc ematch_cases =
21
  let pat =
4✔
22
    let c = first_case ~loc ematch_cases in
23
    c.c_lhs
4✔
24
  in
25
  let point = Utils.{ loc; pos = Start } in
26
  let shift_point = shift_point_cnum point 5 in
27
  set_padding shift_point (pat_point pat Start) Space_padding;
4✔
28
  set_padding point shift_point (Padding "function")
4✔
29
;;
30

31
let get_propose_function_payload loc =
32
  set_empty_padding (make_point loc Start) (make_point loc End)
4✔
33
;;
34

35
(* TODO(Kakadu): describe difference between two locations *)
36
let register_fix ~loc scru_pat_loc cases =
37
  if Zanuda_core.Config.gen_replacements ()
7✔
38
  then (
4✔
39
    (* Format.printf "%s: %a\n%!" __FUNCTION__ My_printtyped.expr e; *)
40
    (* Format.printf "loc = %a\n%!" Location.print_loc loc; *)
41
    try
42
      get_match_constr_payload loc cases;
43
      get_propose_function_payload scru_pat_loc
4✔
44
    with
NEW
45
    | Fix_error (loc, msg) ->
×
46
      Format.eprintf "Error at %s %d\n%!" __FILE__ __LINE__;
NEW
47
      Format.eprintf "While analyzing source at %a\n%!" Location.print_loc loc)
×
48
;;
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc