package ocamlformat

  1. Overview
  2. Docs
Auto-formatter for OCaml code

Install

dune-project
 Dependency

Authors

Maintainers

Sources

ocamlformat-0.23.0.tbz
sha256=9bd3e3cfb0da1b2f75eccd468f27ea1b92e6e677bb6129491764957031dedfed
sha512=6da6f56cb4c605a87020dd7511c99b0114d844d7e26c727ffef521390265bc8f1e8a86e0e4ac916d27df56734941957468aa3462ae01991b522e75c42b392597

Description

OCamlFormat is a tool to automatically format OCaml code in a uniform style.

Added to opam-repository:

README

Build Status

OCamlFormat

Hello, new user! Welcome! :wave:

If you are here, you are probably interested in using a formatting tool for your code base, so that you do not have to worry about formatting it by hand, and to speed up code review by focusing on the important parts.

OCamlFormat is probably what you are after!

OCamlFormat works by parsing then outputting again the same OCaml source file in a consistent style.

Read the documentation to learn more about OCamlFormat!

Getting started

Installation

OCamlFormat can be installed with opam:

opam install ocamlformat

Alternatively, see ocamlformat.opam for manual build instructions.

Formatting code!

Setting up your project to use the default profile and the OCamlFormat version you installed (hopefully the last one) in this .ocamlformat file is considered good practice:

profile = default
version = 0.23.0

To manually invoke OCamlformat the general command is:

ocamlformat [OPTION]... [SRC]...

See ocamlformat --help or man ocamlformat for the detail about options.

You can also view it online.

The most common usecase involves using the dune build system, once your project is correctly setup (see Dune's manual) you can reformat your project using:

dune build @fmt

Community

See CONTRIBUTING for how to help out.

License

OCamlFormat is MIT-licensed.

Dependencies (19)

  1. csexp >= "1.4.0"
  2. uutf >= "1.0.1"
  3. uuseg >= "10.0.0"
  4. stdio
  5. re >= "1.7.2"
  6. odoc-parser >= "1.0.0" & < "2.0.0"
  7. ocp-indent
  8. ocaml-version >= "3.3.0" & < "3.6.0"
  9. menhirSdk >= "20201216"
  10. menhirLib >= "20201216"
  11. menhir >= "20201216"
  12. fpath
  13. fix
  14. either
  15. dune-build-info
  16. dune >= "2.8"
  17. cmdliner >= "1.1.0" & < "2.0"
  18. base >= "v0.12.0" & < "v0.17.0"
  19. ocaml >= "4.08" & < "5.2"

Dev Dependencies (4)

  1. odoc with-doc
  2. ocamlformat-rpc-lib with-test & post & = version
  3. dune with-test & < "3.0"
  4. alcotest with-test

Used by (87)

  1. ask
  2. ask-integrator
  3. autofonce
  4. autofonce_config
  5. autofonce_core
  6. autofonce_lib
  7. autofonce_m4
  8. autofonce_misc
  9. autofonce_patch
  10. autofonce_share
  11. awsm-codegen
  12. bastet < "2.0.0"
  13. bitpack_serializer
  14. brisk-reconciler
  15. CamelCase
  16. canary >= "0.0.4"
  17. diff
  18. diskuvbox < "0.2.0"
  19. dream-inertia
  20. drom
  21. drom_lib
  22. drom_toml
  23. dump_ocamlformat
  24. dune_deps_extra
  25. ephemeral
  26. ez_cmdliner >= "0.2.0"
  27. ez_config >= "0.2.0"
  28. ez_file >= "0.2.0" & < "0.5.0"
  29. ez_hash < "0.5.3"
  30. ez_opam_file
  31. ez_search
  32. ez_subst
  33. fromager
  34. guardian >= "0.4.0"
  35. header-check
  36. highway
  37. js_of_ocaml-webgpu >= "0.2"
  38. letters >= "0.2.0" & != "0.3.1"
  39. lunar
  40. melange-fest
  41. melange-fetch >= "0.2.0"
  42. melange-json >= "1.2.0" & < "2.0.0"
  43. melange-radix-icons >= "0.1.0"
  44. melange-str
  45. mlx
  46. module-graph
  47. nel
  48. noCanren
  49. ocaml-lsp-server < "1.9.0"
  50. ocamlmerlin-mlx >= "0.11"
  51. ocp-search
  52. ocplib_stuff >= "0.3.0"
  53. oktree
  54. opam-bin >= "0.9.5"
  55. opam_bin_lib >= "0.9.5"
  56. owi >= "0.2"
  57. pgn_to_tex
  58. pidgin
  59. pidgio
  60. polars
  61. polars_async
  62. ppx_deriving_jsonschema < "0.0.7"
  63. prelude >= "0.4"
  64. primavera
  65. psmt2-frontend >= "0.3.0"
  66. pyml_bindgen >= "0.4.1"
  67. query-json
  68. quickjs >= "0.2.0" & < "0.5.0"
  69. rea < "0.2.0"
  70. react-rules-of-hooks-ppx
  71. red-black-tree
  72. scope
  73. sihl < "0.1.0"
  74. slugline
  75. smtml >= "0.10.0" & < "0.24.0"
  76. solidity-alcotest
  77. solidity-common
  78. solidity-parser
  79. solidity-test
  80. solidity-typechecker
  81. spectrum >= "0.7.0"
  82. styled-ppx
  83. synchronizer
  84. virtfs
  85. yamlx = "0.4.0"
  86. yocaml >= "2.0.0"
  87. zanuda < "1.1.0"

Conflicts

None