Skip to content

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

@avsm

Description

@avsm

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 <anil@recoil.org>")

(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 <anil@recoil.org>")
(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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions