.ocp-indent & Views: Changed max_indent to 4 - the default

This commit is contained in:
rand00 2022-02-03 19:39:51 +01:00
parent 36f2064034
commit a28b0829b3
2 changed files with 144 additions and 145 deletions

View file

@ -60,8 +60,7 @@ ppx_stritem_ext = 2
# x) # x) # x) # x)
# ) # ) # ) # )
# ) # ) # ) # )
max_indent = 2 max_indent = 4
# < default = 4
# #

View file

@ -11,15 +11,15 @@ let check_icon result =
match result with match result with
| Builder.Exited 0 -> | Builder.Exited 0 ->
H.span ~a:H.[ H.span ~a:H.[
a_style "color: green; cursor: pointer;"; a_style "color: green; cursor: pointer;";
a_titlef "%a" Builder.pp_execution_result result; a_titlef "%a" Builder.pp_execution_result result;
] ]
[H.txt ""] [H.txt ""]
| _ -> | _ ->
H.span ~a:H.[ H.span ~a:H.[
a_style "color: red; cursor: pointer;"; a_style "color: red; cursor: pointer;";
a_titlef "%a" Builder.pp_execution_result result; a_titlef "%a" Builder.pp_execution_result result;
] ]
[H.txt ""] [H.txt ""]
type nav = [ type nav = [
@ -86,8 +86,8 @@ let layout ?include_static_css ?(nav=`Default) ~title body =
H.nav [ H.nav [
H.ul ( H.ul (
List.map (fun (desc, href) -> List.map (fun (desc, href) ->
H.li [H.a ~a:H.[a_href href] [desc]] H.li [H.a ~a:H.[a_href href] [desc]]
) kvs ) kvs
)] )]
in in
match nav with match nav with
@ -140,29 +140,29 @@ let layout ?include_static_css ?(nav=`Default) ~title body =
[H.style ~a:H.[a_mime_type "text/css"] static_css]) [H.style ~a:H.[a_mime_type "text/css"] static_css])
(H.body [ (H.body [
breadcrumb; breadcrumb;
H.main body H.main body
]) ])
let toggleable ?(hidden=true) ~id ~description content = let toggleable ?(hidden=true) ~id ~description content =
let checked = if hidden then [] else H.[a_checked ()] in let checked = if hidden then [] else H.[a_checked ()] in
H.div [ H.div [
H.label H.label
~a:H.[ ~a:H.[
a_label_for id; a_label_for id;
a_class ["toggleable-descr"]; a_class ["toggleable-descr"];
] ]
[H.txt description]; [H.txt description];
H.input H.input
~a:(checked @ H.[ ~a:(checked @ H.[
a_input_type `Checkbox; a_input_type `Checkbox;
a_id id; a_id id;
a_style "display: none;"; a_style "display: none;";
]) (); ]) ();
H.div H.div
~a:H.[ ~a:H.[
a_class ["toggleable"] a_class ["toggleable"]
] ]
content; content;
] ]
@ -216,15 +216,15 @@ module Builds = struct
H.txt "Search artifact by SHA256"; H.txt "Search artifact by SHA256";
H.br (); H.br ();
H.input ~a:H.[ H.input ~a:H.[
a_input_type `Search; a_input_type `Search;
a_id "sha256"; a_id "sha256";
a_name "sha256"; a_name "sha256";
] (); ] ();
]; ];
H.input ~a:H.[ H.input ~a:H.[
a_input_type `Submit; a_input_type `Submit;
a_value "Search"; a_value "Search";
] (); ] ();
]; ];
] ]
@ -246,31 +246,31 @@ module Builds = struct
H.txt " "; H.txt " ";
] ]
@ (match latest_artifact with @ (match latest_artifact with
| Some main_binary -> | Some main_binary ->
artifact artifact
~basename:true ~basename:true
~job_name ~job_name
~build:latest_build ~build:latest_build
~file:main_binary ~file:main_binary
| None -> | None ->
[ txtf "Build failure: %a" Builder.pp_execution_result [ txtf "Build failure: %a" Builder.pp_execution_result
latest_build.Builder_db.Build.result ] latest_build.Builder_db.Build.result ]
) )
@ [ H.br () ] @ [ H.br () ]
let make_jobs jobs = let make_jobs jobs =
jobs |> List.map (fun (job_name, synopsis, platform_builds) -> jobs |> List.map (fun (job_name, synopsis, platform_builds) ->
H.li ( H.li (
[ [
H.a ~a:H.[a_href ("job/" ^ job_name ^ "/")] H.a ~a:H.[a_href ("job/" ^ job_name ^ "/")]
[H.txt job_name]; [H.txt job_name];
H.br (); H.br ();
H.txt (Option.value ~default:"" synopsis); H.txt (Option.value ~default:"" synopsis);
H.br () H.br ()
] ]
@ List.concat_map (make_platform_builds ~job_name) platform_builds @ List.concat_map (make_platform_builds ~job_name) platform_builds
)
) )
)
let make_body section_job_map = let make_body section_job_map =
let aux section jobs acc = let aux section jobs acc =
@ -283,11 +283,11 @@ module Builds = struct
let make_failed_builds = let make_failed_builds =
[ H.p [ [ H.p [
H.txt "View the latest failed builds "; H.txt "View the latest failed builds ";
H.a ~a:H.[a_href "/failed-builds/"] H.a ~a:H.[a_href "/failed-builds/"]
[H.txt "here"]; [H.txt "here"];
H.txt "." H.txt "."
]] ]]
let make section_job_map = let make section_job_map =
layout ~title:"Reproducible OPAM builds" layout ~title:"Reproducible OPAM builds"
@ -318,9 +318,9 @@ module Job = struct
check_icon build.Builder_db.Build.result; check_icon build.Builder_db.Build.result;
txtf " %s " build.platform; txtf " %s " build.platform;
H.a ~a:H.[ H.a ~a:H.[
Fmt.kstr a_href "/job/%s/build/%a/" Fmt.kstr a_href "/job/%s/build/%a/"
job_name job_name
Uuidm.pp build.Builder_db.Build.uuid ] Uuidm.pp build.Builder_db.Build.uuid ]
[ [
txtf "%a" pp_ptime build.Builder_db.Build.start; txtf "%a" pp_ptime build.Builder_db.Build.start;
]; ];
@ -394,48 +394,48 @@ module Job_build = struct
H.ul [ H.ul [
H.li [ H.li [
H.a ~a:H.[ H.a ~a:H.[
Fmt.kstr a_href "/job/%s/build/%a/console" name Uuidm.pp build.uuid Fmt.kstr a_href "/job/%s/build/%a/console" name Uuidm.pp build.uuid
] [H.txt "Console output"]; ] [H.txt "Console output"];
]; ];
H.li [ H.li [
H.a ~a:H.[ H.a ~a:H.[
Fmt.kstr a_href "/job/%s/build/%a/script" name Uuidm.pp build.uuid Fmt.kstr a_href "/job/%s/build/%a/script" name Uuidm.pp build.uuid
] [H.txt "Build script"]; ] [H.txt "Build script"];
] ]
]; ];
H.h3 [H.txt "Build artifacts"]; H.h3 [H.txt "Build artifacts"];
H.dl (List.concat_map (fun (file:Builder_db.file) -> H.dl (List.concat_map (fun (file:Builder_db.file) ->
let (`Hex sha256_hex) = Hex.of_cstruct file.sha256 in let (`Hex sha256_hex) = Hex.of_cstruct file.sha256 in
[ [
H.dt [H.a H.dt [H.a
~a:H.[Fmt.kstr a_href "f/%a" Fpath.pp file.filepath] ~a:H.[Fmt.kstr a_href "f/%a" Fpath.pp file.filepath]
[H.code [txtf "%a" Fpath.pp file.filepath]]]; [H.code [txtf "%a" Fpath.pp file.filepath]]];
H.dd [ H.dd [
H.code [H.txt "SHA256:"; H.txt sha256_hex]; H.code [H.txt "SHA256:"; H.txt sha256_hex];
txtf " (%a)" Fmt.byte_size file.size; txtf " (%a)" Fmt.byte_size file.size;
]; ];
]) ])
artifacts); artifacts);
H.h3 [ H.h3 [
txtf "Reproduced by %d builds" txtf "Reproduced by %d builds"
(List.length (same_input_same_output @ different_input_same_output))] ; (List.length (same_input_same_output @ different_input_same_output))] ;
H.ul H.ul
((List.map (fun (build:Builder_db.Build.t) -> ((List.map (fun (build:Builder_db.Build.t) ->
H.li [ H.li [
txtf "on %s, same input, " build.platform; txtf "on %s, same input, " build.platform;
H.a ~a:H.[Fmt.kstr a_href "/job/%s/build/%a/" name Uuidm.pp build.uuid] H.a ~a:H.[Fmt.kstr a_href "/job/%s/build/%a/" name Uuidm.pp build.uuid]
[txtf "%a" pp_ptime build.start] [txtf "%a" pp_ptime build.start]
]) ])
same_input_same_output) @ same_input_same_output) @
List.map (fun (build':Builder_db.Build.t) -> List.map (fun (build':Builder_db.Build.t) ->
H.li [ H.li [
txtf "on %s, different input, " build'.platform; txtf "on %s, different input, " build'.platform;
H.a ~a:H.[ H.a ~a:H.[
Fmt.kstr a_href "/compare/%a/%a/" Fmt.kstr a_href "/compare/%a/%a/"
Uuidm.pp build'.uuid Uuidm.pp build'.uuid
Uuidm.pp build.uuid] Uuidm.pp build.uuid]
[txtf "%a" pp_ptime build'.start] [txtf "%a" pp_ptime build'.start]
]) ])
different_input_same_output) different_input_same_output)
] ]
@ (if same_input_different_output = [] then @ (if same_input_different_output = [] then
@ -444,14 +444,14 @@ module Job_build = struct
[ H.h3 [H.txt "Same input, different output (not reproducible!)"]; [ H.h3 [H.txt "Same input, different output (not reproducible!)"];
H.ul ( H.ul (
List.map (fun (build':Builder_db.Build.t) -> List.map (fun (build':Builder_db.Build.t) ->
H.li [ H.li [
txtf "on %s, " build'.platform ; txtf "on %s, " build'.platform ;
H.a ~a:H.[ H.a ~a:H.[
Fmt.kstr a_href "/compare/%a/%a/" Fmt.kstr a_href "/compare/%a/%a/"
Uuidm.pp build'.uuid Uuidm.pp build'.uuid
Uuidm.pp build.uuid] Uuidm.pp build.uuid]
[txtf "%a" pp_ptime build'.start] [txtf "%a" pp_ptime build'.start]
]) ])
same_input_different_output) same_input_different_output)
] ]
) )
@ -498,21 +498,21 @@ module Job_build = struct
[ [
(* [ H.h3 [txt "Analysis"] ]; *) (* [ H.h3 [txt "Analysis"] ]; *)
[ H.p [ [ H.p [
let src = Fmt.str "/job/%s/build/%a/vizdependencies" name Uuidm.pp uuid in let src = Fmt.str "/job/%s/build/%a/vizdependencies" name Uuidm.pp uuid in
H.iframe ~a:H.[ H.iframe ~a:H.[
a_src src; a_src src;
a_title "Opam dependencies"; a_title "Opam dependencies";
a_style viz_style_deps a_style viz_style_deps
] [] ] []
]]; ]];
if not @@ contains_debug_bin artifacts then [] else [ if not @@ contains_debug_bin artifacts then [] else [
H.p [ H.p [
let src = Fmt.str "/job/%s/build/%a/viztreemap" name Uuidm.pp uuid in let src = Fmt.str "/job/%s/build/%a/viztreemap" name Uuidm.pp uuid in
H.iframe ~a:H.[ H.iframe ~a:H.[
a_src src; a_src src;
a_title "Binary dissection"; a_title "Binary dissection";
a_style viz_style_treemap a_style viz_style_treemap
] [] ] []
]]; ]];
] |> List.flatten ] |> List.flatten
@ -579,45 +579,45 @@ let key_value_changes xs =
let packages packages = let packages packages =
OpamPackage.Set.elements packages OpamPackage.Set.elements packages
|> List.concat_map (fun p -> [ |> List.concat_map (fun p -> [
txtf "%a" Opamdiff.pp_opampackage p; txtf "%a" Opamdiff.pp_opampackage p;
H.br (); H.br ();
]) ])
let package_diffs diffs = let package_diffs diffs =
List.concat_map (fun pd -> [ List.concat_map (fun pd -> [
txtf "%a" Opamdiff.pp_version_diff pd; txtf "%a" Opamdiff.pp_version_diff pd;
H.br (); H.br ();
]) ])
diffs diffs
let opam_diffs diffs = let opam_diffs diffs =
List.concat_map (fun pd -> List.concat_map (fun pd ->
H.h4 [ txtf "%a" Opamdiff.pp_opam_diff pd ] :: H.h4 [ txtf "%a" Opamdiff.pp_opam_diff pd ] ::
(match pd.Opamdiff.build with None -> [] | Some a -> (match pd.Opamdiff.build with None -> [] | Some a ->
let l, r = Opamdiff.commands_to_strings a in let l, r = Opamdiff.commands_to_strings a in
[ [
H.h5 [ H.txt "build instruction (without common prefix) modifications, old:" ] ; H.h5 [ H.txt "build instruction (without common prefix) modifications, old:" ] ;
H.code (List.concat_map (fun s -> [ H.txt s ; H.br () ]) l) ; H.code (List.concat_map (fun s -> [ H.txt s ; H.br () ]) l) ;
H.h5 [ H.txt "new" ] ; H.h5 [ H.txt "new" ] ;
H.code (List.concat_map (fun s -> [ H.txt s ; H.br () ]) r) H.code (List.concat_map (fun s -> [ H.txt s ; H.br () ]) r)
]) @ ]) @
(match pd.Opamdiff.install with None -> [] | Some a -> (match pd.Opamdiff.install with None -> [] | Some a ->
let l, r = Opamdiff.commands_to_strings a in let l, r = Opamdiff.commands_to_strings a in
[ [
H.h5 [ H.txt "install instruction (without common prefix) modifications, old:" ] ; H.h5 [ H.txt "install instruction (without common prefix) modifications, old:" ] ;
H.code (List.concat_map (fun s -> [ H.txt s ; H.br () ]) l) ; H.code (List.concat_map (fun s -> [ H.txt s ; H.br () ]) l) ;
H.h5 [ H.txt "new" ] ; H.h5 [ H.txt "new" ] ;
H.code (List.concat_map (fun s -> [ H.txt s ; H.br () ]) r) H.code (List.concat_map (fun s -> [ H.txt s ; H.br () ]) r)
]) @ ]) @
(match pd.Opamdiff.url with None -> [] | Some a -> (match pd.Opamdiff.url with None -> [] | Some a ->
let l, r = Opamdiff.opt_url_to_string a in let l, r = Opamdiff.opt_url_to_string a in
[ [
H.h5 [ H.txt "URL" ] ; H.h5 [ H.txt "URL" ] ;
txtf "old: %s" l; txtf "old: %s" l;
H.br (); H.br ();
txtf "new: %s" r txtf "new: %s" r
]) @ ]) @
[ H.br () ]) [ H.br () ])
diffs diffs
let compare_builds let compare_builds
@ -656,10 +656,10 @@ let compare_builds
pp_platform (Some build_right.platform)]; pp_platform (Some build_right.platform)];
]; ];
H.h3 [ H.a ~a:H.[ H.h3 [ H.a ~a:H.[
Fmt.kstr a_href "/compare/%a/%a/" Fmt.kstr a_href "/compare/%a/%a/"
Uuidm.pp build_right.uuid Uuidm.pp build_right.uuid
Uuidm.pp build_left.uuid ] Uuidm.pp build_left.uuid ]
[H.txt "Compare in reverse direction"]] ; [H.txt "Compare in reverse direction"]] ;
H.ul [ H.ul [
H.li [ H.li [
H.a ~a:H.[a_href "#opam-packages-removed"] H.a ~a:H.[a_href "#opam-packages-removed"]
@ -755,8 +755,8 @@ let failed_builds ~start ~count builds =
H.ul (List.map build builds); H.ul (List.map build builds);
H.p [ txtf "View the next %d failed builds " count; H.p [ txtf "View the next %d failed builds " count;
H.a ~a:H.[ H.a ~a:H.[
Fmt.kstr a_href "/failed-builds/?count=%d&start=%d" Fmt.kstr a_href "/failed-builds/?count=%d&start=%d"
count (start + count) ] count (start + count) ]
[ H.txt "here"]; [ H.txt "here"];
H.txt "."; H.txt ".";
] ]