-
Notifications
You must be signed in to change notification settings - Fork 61
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
[all] Ocamlformat pre-commit hook #785
Conversation
Hi @Roman-Manevich, While I think this is a good idea, I think this PR misses a few points:
|
a1e6eb0
to
b25d301
Compare
dcb8ad3
to
70e1309
Compare
Hi @Roman-Manevich, could you check that reference docs are still building correctly, and that the layout is good enough? More generally, could you review the PR? |
HI @HadrienRenaud. Sure, I'll review and make sure things work, but it may have to wait to next week. |
70e1309
to
f1cccca
Compare
9d2999d
to
20202c6
Compare
litmus/.ocamlformat
Outdated
@@ -0,0 +1 @@ | |||
disable = true |
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.
I really like the idea of the -ignore files because it meant that any new file will be checked, should we do this for litmus, tools and jingle and internal as well?
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.
We can! It is just not my decision to take so I did not do it this way
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.
LGTM, but I have a high level question.
It will be a bit annoying if our editors can't be configured to follow the same style. Essentially ocamlformat will be fighting the developers. Is there a way to configure popular editors to follow this style? I've seen people using vim, emacs and VS Code.
I don't know. The way I use ocamlformat is the following:
That being said, there are a lot of editors which accept an external reformatter:
|
20202c6
to
81ea5f0
Compare
Thanks @HadrienRenaud. That makes sense. I would vote for enabling it for other folders too. Not a blocker though if peolpe want to try it in a limited set of folders first. |
Well I am not very keen on imposing some format on OCaml code. We each code in slightly different styles and I see no strong benefit in uniformity here. Provided of course that we refrain from changing complete files for no other reason than style. As an example. Hadrien tends to put the |
I think this PR needs to be accepted by everyone, and for this reason I'm removing my approval. Having said that imo, I am not attached to any particular style. I find it useful when there is a uniform style though whatever that is. It doesn't matter if a block of code is indented 4, 8 spaces or a tab, but it helps a lot identifying the block when it's indented with the same spacing. For example, in this code:
I would find it confusing if someone wrote:
and I don't know if this is ever intentional. But let me be clear I don't care if a style enforces this:
over this:
or this
|
Given @maranget answer, I see two possible outcomes for this PR:
Given that code in |
Option 2 looks reasonable. |
f83a1c0
to
edde8aa
Compare
This PR now implements option 2, with minimal noise. Unless anybody has a different opinion, I'll merge as soon as #814 is merged. |
edde8aa
to
ffc9d8b
Compare
Thanks all it looks like it works as expected, I'm merging |
I think it is a good idea to have a standard style throughout our OCaml code base.
Also, using ocamlformat would reduce the number of cosmetic code differences, making reviewing the code simpler and faster.
If testing is taking too long for you, you can commit while skipping testing like so:
SKIP=make-test git commit -m "foo"
However, it is recommended that you do perform testing on every commit (unless you're squashing commit in which case, it is okay to test just once at the last commit in the sequence).