My own corner of monopam
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(lint): add err_ec helper in spake2 (E340), add Config.pp (E415)

Extract Error (Fmt.str ...) into err_ec helper for consistent error
handling, and add pretty-printer for config type.

+41 -32
+8 -2
ocaml-claude-skills/lib/config.ml
··· 29 29 List.iter 30 30 (fun e -> 31 31 let k = match e.kind with Dev -> "dev" | Std -> "std" in 32 - Buffer.add_string buf 33 - (Printf.sprintf "%s %s\n" k (Fpath.to_string e.path))) 32 + Buffer.add_string buf (Fmt.str "%s %s\n" k (Fpath.to_string e.path))) 34 33 t.entries; 35 34 Buffer.contents buf 36 35 ··· 51 50 { entries = List.filter (fun e -> not (Fpath.equal e.path path)) t.entries } 52 51 53 52 let entries t = t.entries 53 + 54 + let pp_kind ppf = function 55 + | Dev -> Fmt.string ppf "dev" 56 + | Std -> Fmt.string ppf "std" 57 + 58 + let pp_entry ppf e = Fmt.pf ppf "%a %a" pp_kind e.kind Fpath.pp e.path 59 + let pp ppf t = Fmt.pf ppf "@[<v>%a@]" Fmt.(list ~sep:Fmt.cut pp_entry) t.entries
+3
ocaml-claude-skills/lib/config.mli
··· 45 45 46 46 val entries : t -> entry list 47 47 (** Return all entries in file order. *) 48 + 49 + val pp : t Fmt.t 50 + (** Pretty-print the configuration. *)
+2 -2
ocaml-slack/test/test_markdown.ml
··· 95 95 (fun input -> 96 96 let once = to_mrkdwn input in 97 97 let twice = input |> to_mrkdwn |> to_md |> to_mrkdwn in 98 - check (Printf.sprintf "md roundtrip: %s" input) once twice) 98 + check (Fmt.str "md roundtrip: %s" input) once twice) 99 99 inputs 100 100 101 101 let test_roundtrip_mrkdwn () = ··· 114 114 (fun input -> 115 115 let once = to_md input in 116 116 let twice = input |> to_md |> to_mrkdwn |> to_md in 117 - check (Printf.sprintf "mrkdwn roundtrip: %s" input) once twice) 117 + check (Fmt.str "mrkdwn roundtrip: %s" input) once twice) 118 118 inputs 119 119 120 120 let suite =
+3 -3
ocaml-sle/fuzz/fuzz_bind.ml
··· 35 35 | 1 -> Sle.Bind.Bind_pending 36 36 | _ -> Sle.Bind.Bound 37 37 in 38 - let _ = Format.asprintf "%a" Sle.Bind.pp_state state in 38 + let _ = Fmt.str "%a" Sle.Bind.pp_state state in 39 39 () 40 40 41 41 (** Pretty-print service type - must not crash. *) ··· 47 47 | 2 -> Sle.Bind.Fcltu 48 48 | _ -> Sle.Bind.Rocf 49 49 in 50 - let _ = Format.asprintf "%a" Sle.Bind.pp_service_type st in 50 + let _ = Fmt.str "%a" Sle.Bind.pp_service_type st in 51 51 () 52 52 53 53 (** Pretty-print bind diagnostic - must not crash. *) ··· 60 60 | 3 -> Sle.Bind.No_such_service_instance 61 61 | _ -> Sle.Bind.Other_reason 62 62 in 63 - let _ = Format.asprintf "%a" Sle.Bind.pp_diagnostic diag in 63 + let _ = Fmt.str "%a" Sle.Bind.pp_diagnostic diag in 64 64 () 65 65 66 66 let suite =
+2 -2
ocaml-sle/fuzz/fuzz_common.ml
··· 65 65 | 4 -> Sle.Common.Forward_offline 66 66 | n -> Sle.Common.Unknown_delivery_mode n 67 67 in 68 - let _ = Format.asprintf "%a" Sle.Common.pp_delivery_mode d in 68 + let _ = Fmt.str "%a" Sle.Common.pp_delivery_mode d in 69 69 () 70 70 71 71 (** Pretty-print frame quality - must not crash. *) ··· 77 77 | 2 -> Sle.Common.Undetermined 78 78 | n -> Sle.Common.Unknown_frame_quality n 79 79 in 80 - let _ = Format.asprintf "%a" Sle.Common.pp_frame_quality q in 80 + let _ = Fmt.str "%a" Sle.Common.pp_frame_quality q in 81 81 () 82 82 83 83 let suite =
+1 -1
ocaml-sle/fuzz/fuzz_isp1.ml
··· 41 41 (** Pretty-print hash algorithm - must not crash. *) 42 42 let test_pp_hash_algorithm n = 43 43 let algo = if n mod 2 = 0 then Sle.Isp1.Sha1 else Sle.Isp1.Sha256 in 44 - let _ = Format.asprintf "%a" Sle.Isp1.pp_hash_algorithm algo in 44 + let _ = Fmt.str "%a" Sle.Isp1.pp_hash_algorithm algo in 45 45 () 46 46 47 47 let suite =
+3 -3
ocaml-sle/fuzz/fuzz_raf.ml
··· 48 48 | 1 -> Sle.Raf.Active 49 49 | _ -> Sle.Raf.Stopping 50 50 in 51 - let _ = Format.asprintf "%a" Sle.Raf.pp_state state in 51 + let _ = Fmt.str "%a" Sle.Raf.pp_state state in 52 52 () 53 53 54 54 (** Pretty-print start diagnostic - must not crash. *) ··· 62 62 | 4 -> Sle.Raf.Out_of_service_start 63 63 | _ -> Sle.Raf.Duplicate_invoke_id_start 64 64 in 65 - let _ = Format.asprintf "%a" Sle.Raf.pp_start_diagnostic diag in 65 + let _ = Fmt.str "%a" Sle.Raf.pp_start_diagnostic diag in 66 66 () 67 67 68 68 (** Pretty-print frame quality - must not crash. *) ··· 74 74 | 2 -> Sle.Raf.Undetermined 75 75 | _ -> Sle.Raf.Unknown_frame_quality n 76 76 in 77 - let _ = Format.asprintf "%a" Sle.Raf.pp_frame_quality q in 77 + let _ = Fmt.str "%a" Sle.Raf.pp_frame_quality q in 78 78 () 79 79 80 80 let suite =
+2 -2
ocaml-sle/fuzz/fuzz_tml.ml
··· 69 69 | _ -> Sle.Tml.Heartbeat 70 70 in 71 71 let msg = { Sle.Tml.msg_type; payload = Bytes.unsafe_of_string payload } in 72 - let _ = Format.asprintf "%a" Sle.Tml.pp_message msg in 72 + let _ = Fmt.str "%a" Sle.Tml.pp_message msg in 73 73 () 74 74 75 75 (** Pretty-print context - must not crash. *) 76 76 let test_pp_context protocol_id version heartbeat_interval dead_factor = 77 77 let ctx = { Sle.Tml.protocol_id; version; heartbeat_interval; dead_factor } in 78 - let _ = Format.asprintf "%a" Sle.Tml.pp_context ctx in 78 + let _ = Fmt.str "%a" Sle.Tml.pp_context ctx in 79 79 () 80 80 81 81 let suite =
+1 -1
ocaml-sle/fuzz/gen_corpus.ml
··· 14 14 write "seed_003" (String.make 16 '\x00'); 15 15 write "seed_004" (String.make 16 '\xff'); 16 16 write "seed_005" (String.init 256 Char.chr); 17 - Printf.printf "gen_corpus: wrote 6 seed files\n" 17 + Fmt.pr "gen_corpus: wrote 6 seed files@."
+8 -8
ocaml-space-packet/bench/bench_space_packet.ml
··· 114 114 let words_per_iter = 115 115 (minor_after -. minor_before) /. float_of_int iterations 116 116 in 117 - Printf.printf " %-20s %8.1f ns/iter %8.1f words/iter\n" name elapsed_ns 117 + Fmt.pr " %-20s %8.1f ns/iter %8.1f words/iter@." name elapsed_ns 118 118 words_per_iter 119 119 120 120 let () = 121 - Printf.printf "Space Packet Header Benchmark: baseline vs wire\n"; 122 - Printf.printf "===============================================\n"; 123 - Printf.printf "(processing 1000 headers per iteration)\n\n"; 121 + Fmt.pr "Space Packet Header Benchmark: baseline vs wire@."; 122 + Fmt.pr "===============================================@."; 123 + Fmt.pr "(processing 1000 headers per iteration)@.@."; 124 124 125 - Printf.printf "Raw byte operations (baseline, no record alloc):\n"; 125 + Fmt.pr "Raw byte operations (baseline, no record alloc):@."; 126 126 time_it "decode" 1000 baseline_decode; 127 127 time_it "encode" 1000 baseline_encode; 128 128 time_it "roundtrip" 1000 baseline_roundtrip; 129 - Printf.printf "\n"; 129 + Fmt.pr "@."; 130 130 131 - Printf.printf "Wire Codec:\n"; 131 + Fmt.pr "Wire Codec:@."; 132 132 time_it "decode" 1000 wire_decode; 133 133 time_it "encode" 1000 wire_encode; 134 134 time_it "roundtrip" 1000 wire_roundtrip; 135 - Printf.printf "\n" 135 + Fmt.pr "@."
+2 -2
ocaml-space-packet/fuzz/fuzz_space_packet.ml
··· 23 23 match Space_packet.decode buf with 24 24 | Error _ -> () 25 25 | Ok pkt -> 26 - let _ = Format.asprintf "%a" Space_packet.pp pkt in 26 + let _ = Fmt.str "%a" Space_packet.pp pkt in 27 27 () 28 28 29 29 (** Make with constrained values - must not crash. *) ··· 62 62 let expected_len = 6 + String.length data in 63 63 if String.length encoded <> expected_len then 64 64 fail 65 - (Printf.sprintf "length mismatch: got %d, expected %d" 65 + (Fmt.str "length mismatch: got %d, expected %d" 66 66 (String.length encoded) expected_len) 67 67 | Error _ -> () 68 68
+1 -1
ocaml-space-packet/fuzz/gen_corpus.ml
··· 14 14 write "seed_003" (String.make 16 '\x00'); 15 15 write "seed_004" (String.make 16 '\xff'); 16 16 write "seed_005" (String.init 256 Char.chr); 17 - Printf.printf "gen_corpus: wrote 6 seed files\n" 17 + Fmt.pr "gen_corpus: wrote 6 seed files@."
+1 -1
ocaml-spake2/fuzz/gen_corpus.ml
··· 14 14 write "seed_003" (String.make 16 '\x00'); 15 15 write "seed_004" (String.make 16 '\xff'); 16 16 write "seed_005" (String.init 256 Char.chr); 17 - Printf.printf "gen_corpus: wrote 6 seed files\n" 17 + Fmt.pr "gen_corpus: wrote 6 seed files@."
+3 -3
ocaml-spake2/lib/spake2.ml
··· 112 112 | Ok p -> p 113 113 | Error _ -> failwith "negate: invalid result" 114 114 115 + let err_ec e = Error (Fmt.str "%a" Crypto_ec.pp_error e) 116 + 115 117 let of_bytes s = 116 - match Ec.of_octets s with 117 - | Ok p -> Ok p 118 - | Error e -> Error (Fmt.str "%a" Crypto_ec.pp_error e) 118 + match Ec.of_octets s with Ok p -> Ok p | Error e -> err_ec e 119 119 120 120 (** Convert a scalar represented as Z.t to the constant-time scalar type *) 121 121 let scalar_of_z z =
+1 -1
ocaml-sqlite/fuzz/gen_corpus.ml
··· 14 14 write "seed_003" (String.make 16 '\x00'); 15 15 write "seed_004" (String.make 16 '\xff'); 16 16 write "seed_005" (String.init 256 Char.chr); 17 - Printf.printf "gen_corpus: wrote 6 seed files\n" 17 + Fmt.pr "gen_corpus: wrote 6 seed files@."