-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade to ocamlformat 0.26.0 #2262
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Upgrade to OCamlformat 0.26.0 | ||
faab08a7dd9c275111cae51651a78fd62ac3e031 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
version = 0.24.1 | ||
version = 0.26.0 | ||
profile = conventional | ||
|
||
ocaml-version = 4.08.0 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,13 +62,14 @@ module Make (HTTP : Cohttp_lwt.S.Server) (S : Irmin.S) = struct | |
let err = Fmt.str "Parse error %S: %s" str e in | ||
Wm.respond ~body:(`String err) 400 rd | ||
|
||
module Content_addressable (S : sig | ||
include Irmin.Content_addressable.S | ||
module Content_addressable | ||
(S : sig | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why the two additional spaces? It seems like the general rhythm is 2 spaces per indentation. Why should the arguments be indented twice under |
||
include Irmin.Content_addressable.S | ||
|
||
val batch : B.Repo.t -> (read_write t -> 'a Lwt.t) -> 'a Lwt.t | ||
end) | ||
(K : Irmin.Type.S with type t = S.key) | ||
(V : Irmin.Type.S with type t = S.value) = | ||
val batch : B.Repo.t -> (read_write t -> 'a Lwt.t) -> 'a Lwt.t | ||
end) | ||
(K : Irmin.Type.S with type t = S.key) | ||
(V : Irmin.Type.S with type t = S.value) = | ||
struct | ||
let with_key rd f = | ||
match Irmin.Type.of_string K.t (Wm.Rd.lookup_path_info_exn "id" rd) with | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,8 @@ | |
open! Import | ||
|
||
(** [Make] returns a module that can manage GC processes. *) | ||
module Make (Args : Gc_args.S) : sig | ||
module Make | ||
(Args : Gc_args.S) : sig | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is worse :P (but much less important than the corrected functor argument layout) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Noted. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have spent a bit of time on this issue and I could only fix it as part of a large refactoring, that is not ready to be released (ocaml-ppx/ocamlformat#2395) How bad would it be to roll the release with this new bug ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not the end of the world but I agree with @art-w that it would be nice to fix. We can also wait for the fix if it's upcoming. 😄 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Skipping a version is fine. Though, that's bigger diffs for next time. |
||
module Args : Gc_args.S | ||
|
||
type t | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,8 +49,8 @@ module Make (I : Cstubs_inverted.INTERNAL) = struct | |
(repo @-> hash @-> returning commit) | ||
(fun (type repo) repo hash -> | ||
with_repo' repo commit | ||
(fun (module Store : Irmin.Generic_key.S with type repo = repo) repo | ||
-> | ||
(fun | ||
(module Store : Irmin.Generic_key.S with type repo = repo) repo -> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nitpick: I don't think I like breaking after the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The (fun
(module Store : Irmin.Generic_key.S with type repo = repo)
(module Store : Irmin.Generic_key.S with type repo = repo) ->
body) I agree with weird alignment. More indentation ? (fun
(module Store : Irmin.Generic_key.S with type repo = repo)
(module Store : Irmin.Generic_key.S with type repo = repo) ->
body) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think indenting the arguments would be consistent with the functor argument formatting. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agree! Though, that's not possible without huge diffs. I would like to discuss this with more people here: ocaml-ppx/ocamlformat#2397 |
||
let hash = Root.get_hash (module Store) hash in | ||
let c = run (Store.Commit.of_hash repo hash) in | ||
match c with | ||
|
@@ -62,8 +62,8 @@ module Make (I : Cstubs_inverted.INTERNAL) = struct | |
(repo @-> commit_key @-> returning commit) | ||
(fun (type repo) repo hash -> | ||
with_repo' repo commit | ||
(fun (module Store : Irmin.Generic_key.S with type repo = repo) repo | ||
-> | ||
(fun | ||
(module Store : Irmin.Generic_key.S with type repo = repo) repo -> | ||
let hash = Root.get_commit_key (module Store) hash in | ||
let c = run (Store.Commit.of_key repo hash) in | ||
match c with | ||
|
@@ -75,8 +75,8 @@ module Make (I : Cstubs_inverted.INTERNAL) = struct | |
(repo @-> ptr commit @-> uint64_t @-> tree @-> info @-> returning commit) | ||
(fun (type repo) repo parents n tree info -> | ||
with_repo' repo commit | ||
(fun (module Store : Irmin.Generic_key.S with type repo = repo) repo | ||
-> | ||
(fun | ||
(module Store : Irmin.Generic_key.S with type repo = repo) repo -> | ||
let n = UInt64.to_int n in | ||
let parents = | ||
if is_null parents || n = 0 then [] | ||
|
@@ -97,8 +97,8 @@ module Make (I : Cstubs_inverted.INTERNAL) = struct | |
(repo @-> commit @-> returning commit_array) | ||
(fun (type repo) repo commit -> | ||
with_repo' repo commit_array | ||
(fun (module Store : Irmin.Generic_key.S with type repo = repo) repo | ||
-> | ||
(fun | ||
(module Store : Irmin.Generic_key.S with type repo = repo) repo -> | ||
let commit = Root.get_commit (module Store) commit in | ||
let parents = Store.Commit.parents commit in | ||
let parents = | ||
|
@@ -117,8 +117,8 @@ module Make (I : Cstubs_inverted.INTERNAL) = struct | |
(repo @-> commit @-> commit @-> returning bool) | ||
(fun (type repo) repo a b -> | ||
with_repo repo false | ||
(fun (module Store : Irmin.Generic_key.S with type repo = repo) repo | ||
-> | ||
(fun | ||
(module Store : Irmin.Generic_key.S with type repo = repo) repo -> | ||
let a = Root.get_commit (module Store) a in | ||
let b = Root.get_commit (module Store) b in | ||
Irmin.Type.(unstage (equal (Store.commit_t repo))) a b)) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great!
Nitpick questions: It looks like the
Remote : sig...end
could fit on a single line? Theend
is missing an indentation space to indicate that it is within the opening parens?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indenting the
end
one more means indenting the body of thesig
one more too ? This would cause a huge diff.Indenting the
end
but not the body is not so bad:I would like the opinion of more people on this :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally, I think both look sort of strange, but I don't care too much either way. Consistency is more important to me. Are there other scenarios of formatting that enforce either choice? Looking at some of the other formatting changes it seems like perhaps the most consistent is to indent everything by a single space, not just the
end
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nested things are indented 2 + width of the parens, for example in a
if
.I'm not against indenting the
end
but without a strong opinion, I'm tempted to leave it like that.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be more consistent with the "2 space + width of paren" rule to indent this like the following by adding 1 space (width of paren) to both
val
andend
-- essentially format them relative toRemote
instead of(Remote
? The current formatting does not seem to take the paren into consideration (unlike the diff I linked in my prior comment), but maybe in this context of functor arguments the intention is for the opening paren to be considered the first column of the block (?).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be ideal but would cause huge diffs to existing code.
I plan to make more changes to module types after the release, huge changes like that could be accepted in combination of other already large changes.