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

dune format-dune-file on dune-project is suboptimal #2291

Closed
avsm opened this issue Jun 17, 2019 · 2 comments
Closed

dune format-dune-file on dune-project is suboptimal #2291

avsm opened this issue Jun 17, 2019 · 2 comments
Assignees

Comments

@avsm
Copy link
Member

avsm commented Jun 17, 2019

The results of running dune format-dune-file < dune-project ends up looking a bit terrible:

(lang dune 1.10)

(name github)

(generate_opam_files true)

(license MIT)

(maintainers "Anil Madhavapeddy <[email protected]>")

(authors "Anil Madhavapeddy" "David Sheets" "Andy Ray" "Jeff Hammerbacher"
  "Thomas Gazagnaire" "Rudi Grinberg" "Qi Li" "Jeremy Yallop" "Dave Tucker")

(source
 (github mirage/ocaml-github))

(documentation "https://mirage.github.io/ocaml-github/")

(package
 (name github)
 (tags
  (org:mirage org:xapi-project git))
 (depends
  (ocaml
   (>= 4.03.0))
  (dune
   (>= 1.10))
  (uri
   (>= 1.9.0))
  (cohttp
   (>= 0.99.0))
  (cohttp-lwt
   (>= 0.99))
  (lwt
   (>= 2.4.4))
  (atdgen
   (>= 2.0.0))
  (yojson
   (>= 1.6.0))
  stringext)
 (synopsis "GitHub APIv3 OCaml library")
 (description
   "This library provides an OCaml interface to the\n[GitHub APIv3](https://developer.github.com/v3/) (JSON).\n\nIt is compatible with [MirageOS](https://mirage.io) and also compiles to pure\nJavaScript via [js_of_ocaml](http://ocsigen.org/js_of_ocaml)."))

(package
 (name github-jsoo)
 (tags
  (org:mirage org:xapi-project git))
 (depends
  (ocaml
   (>= 4.03.0))
  (dune
   (>= 1.10))
  (github
   (= :version))
  (cohttp
   (>= 0.99.0))
  (cohttp-lwt-jsoo
   (>= 0.99.0))
  (js_of_ocaml-lwt
   (>= 3.4.0)))
 (synopsis "GitHub APIv3 JavaScript library")
 (description
   "This library provides an OCaml interface to the [GitHub APIv3](https://developer.github.com/v3/)\n(JSON). This library installs the JavaScript version, which uses [js_of_ocaml](http://ocsigen.org/js_of_ocaml)."))

vs the original which was much more compact:

(lang dune 1.10)
(name github)

(generate_opam_files true)

(license MIT)
(maintainers "Anil Madhavapeddy <[email protected]>")
(authors "Anil Madhavapeddy" "David Sheets" "Andy Ray"
  "Jeff Hammerbacher" "Thomas Gazagnaire" "Rudi Grinberg"
  "Qi Li" "Jeremy Yallop" "Dave Tucker")
(source (github mirage/ocaml-github))
(documentation "https://mirage.github.io/ocaml-github/")

(package
 (name github)
 (tags (org:mirage org:xapi-project git))
 (depends
  (ocaml (>= 4.03.0))
  (dune (>= 1.10))
  (uri (>= 1.9.0))
  (cohttp (>= 0.99.0))
  (cohttp-lwt (>= 0.99))
  (lwt (>= 2.4.4))
  (atdgen (>= 2.0.0))
  (yojson (>= 1.6.0))
  stringext)
 (synopsis "GitHub APIv3 OCaml library")
 (description "This library provides an OCaml interface to the
[GitHub APIv3](https://developer.github.com/v3/) (JSON).

It is compatible with [MirageOS](https://mirage.io) and also compiles to pure
JavaScript via [js_of_ocaml](http://ocsigen.org/js_of_ocaml)."))

Some things that might help are:

  • putting each dependency clause on a single line
  • wrapping long strings like description
@emillon
Copy link
Collaborator

emillon commented Aug 22, 2019

Yes, I agree that it's not great for now (fortunately, it's not set up by formatting rules). Some rules we can adapt:

  • this should be formatted as fields in a giant (dune_project) stanza - that would remove all the newlines.
  • lists of strings in maintainers and authors should go one per line
  • each package in (depends) should go on a single line

It would be nice if this was not a second ad-hoc formatter, but we'll see what we can do.

@nojb
Copy link
Collaborator

nojb commented Nov 6, 2022

Should have been fixed by #3928

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

No branches or pull requests

3 participants