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

Bug: Unable to process a file in xen-api #2057

Closed
psafont opened this issue Mar 29, 2022 · 3 comments · Fixed by #2478
Closed

Bug: Unable to process a file in xen-api #2057

psafont opened this issue Mar 29, 2022 · 3 comments · Fixed by #2478

Comments

@psafont
Copy link

psafont commented Mar 29, 2022

Ocamlformat 0.21.0 is unable to format the file ocaml/xapi/xapi_session.mlfrom the repository https://github.com/xapi-project/xen-api when formatting with the custom .ocamlformat (which contains deprecated options)
Ocamlformat prints the following message:

File "dune-project", line 3, characters 0-32:
3 | (formatting (enabled_for ocaml))
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Warning: option `indicate-multiline-delimiters`: value `closing-on-separate-line` is deprecated since version 0.20.0. It will be removed by version 1.0.0.
Warning: option `if-then-else`: value `fit-or-vertical` is deprecated since version 0.20.0. It will be removed by version 1.0.0.
Warning: break-struct: This option is deprecated since version 0.20.0. It will be removed by version 1.0.0.
Warning: option `indicate-multiline-delimiters`: value `closing-on-separate-line` is deprecated since version 0.20.0. It will be removed by version 1.0.0.
Warning: option `if-then-else`: value `fit-or-vertical` is deprecated since version 0.20.0. It will be removed by version 1.0.0.
Warning: break-struct: This option is deprecated since version 0.20.0. It will be removed by version 1.0.0.
ocamlformat: Cannot process "ocaml/xapi/xapi_session.ml".
  Please report this bug at https://github.com/ocaml-ppx/ocamlformat/issues.
  BUG: formatting did not stabilize after 10 iterations.

How to Reproduce
Steps to reproduce the behavior:

  • Create a new switch with ocaml 4.14.0, the latest dune and ocamlformat 0.21.0
  • Clone the xen-api repository
  • run dune build @fmt
@psafont
Copy link
Author

psafont commented Jun 6, 2022

Tested with ocamlformat 0.22.4: still happening:

dune build @fmt --auto-promote
File "dune-project", line 3, characters 0-32:
3 | (formatting (enabled_for ocaml))
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ocamlformat: Cannot process "ocaml/xapi/xapi_session.ml".
  Please report this bug at https://github.com/ocaml-ppx/ocamlformat/issues.
  BUG: formatting did not stabilize after 10 iterations.

@gpetiot
Copy link
Collaborator

gpetiot commented Jun 8, 2022

I've tried a few things but nothing that would fix this without breaking the comments in other places. Here is a minimal snippet to reproduce the bug if someone has some time to have a look:

let _ =
  List.filter
    (fun s ->
       ((* 3.1. the sid of the authenticated user *)
         foooooooooooooooooooooooooooooo
         || (* 3.2. any sids of the group that authenticated the user *)
         (* TODO: better to look up the membership closure *)
         fooooooooooooooooooooooooooo
       )
    )

@psafont
Copy link
Author

psafont commented Jun 9, 2022

I'll change the weird code, but that won't change any instances where this might happen ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants