Skip to content
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

Update ocp-indent to ocamlformat and replace action with rule stanza #13

Merged
merged 2 commits into from
Apr 12, 2021

Conversation

shubhamkumar13
Copy link
Contributor

@shubhamkumar13 shubhamkumar13 commented Apr 12, 2021

What this PR attempts to do:

  • replace ocp-indent to ocamlformat (mentioned in Put a sample ocamlformat too #10)

  • Update the dune version to 2.8. This change generated the following error when running make.

File "test/dune", line 12, characters 1-41:
12 |  (action (run %{deps} -q --color=always)))
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: 'action' was deleted in version 2.0 of the dune language. Use a rule
stanza with the alias field instead
make: *** [Makefile:8: build] Error 1
  • Modify the dune file in test/dune to use a rule stanza.

  • Add a fmt target in the Makefile to format the files using ocamlformat

…create a fmt target to format the files using ocamlformat and also update the foramtting of each file
where SUBCOMMAND is one of:\n\
%s\n\n\
For help on a specific subcommand, try:\n\
\ %s SUBCOMMAND --help\n"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's happening here with the leading backslash?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll let you take a look in case it's a bug with ocamlformat that needs reporting or something.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You know what, nevermind. I'll just fix it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I didn't notice this 😅, Thanks for fixing this!

test_sub1
test_sub2
))
(libraries alcotest test_sub1 test_sub2))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like to have one thing per line so that the diff make sense when we add/remove items later.

Copy link
Contributor Author

@shubhamkumar13 shubhamkumar13 Apr 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was something that was auto-generated by ocamlformat and as we are going to use ocamlformat in the future I thought leaving the formatted code in would be better here

let tests =
[
("string", `Quick, test_string); ("string, hasty", `Quick, test_string_hasty);
]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a fan of this formatting style for lists but I'll get used to it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was autogenerated by ocamlformat :D

@@ -1,2 +0,0 @@
#use "topfind";;
open Printf;;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intent of .ocamlinit was to have these commands loaded when running utop locally. Also, it's a stub letting the user know they can add their own #require ... or open directives for working with the project. Now I see opam installs a ~/.ocamlinit containing #use "topfind";;. Is this why you removed it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I thought this file would be redundant

@mjambon
Copy link
Owner

mjambon commented Apr 12, 2021

Thanks a lot for the contribution! I haven't used ocamlformat just yet, so this is very much appreciated.

@mjambon mjambon merged commit 33085fa into mjambon:master Apr 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants