Build Linux initramfs cpio archives from OCaml
0
fork

Configure Feed

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

fix(lint): resolve E005 long functions, E331 redundant prefixes, and E010 deep nesting

Extract helper functions to reduce long function lengths across cwt, jsonwt,
ltp, matter, mbr, json-logs, and initramfs. Remove redundant find_/make_
prefixes in discovery.ml. Extract nested rm closure to reduce nesting depth.

+10 -13
+10 -13
test/test_initramfs.ml
··· 10 10 close_out oc; 11 11 Fun.protect ~finally:(fun () -> Sys.remove path) (fun () -> f path) 12 12 13 + let rec rm_rf path = 14 + if Sys.is_directory path then begin 15 + Array.iter 16 + (fun name -> rm_rf (Filename.concat path name)) 17 + (Sys.readdir path); 18 + Unix.rmdir path 19 + end 20 + else Sys.remove path 21 + 13 22 let with_temp_dir f = 14 23 let dir = Filename.temp_dir "initramfs-test" "" in 15 - Fun.protect 16 - ~finally:(fun () -> 17 - let rec rm path = 18 - if Sys.is_directory path then begin 19 - Array.iter 20 - (fun name -> rm (Filename.concat path name)) 21 - (Sys.readdir path); 22 - Unix.rmdir path 23 - end 24 - else Sys.remove path 25 - in 26 - rm dir) 27 - (fun () -> f dir) 24 + Fun.protect ~finally:(fun () -> rm_rf dir) (fun () -> f dir) 28 25 29 26 let parse archive = 30 27 match Cpio.of_string archive with