package ocamlformat

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

Install

Dune Dependency

Authors

Maintainers

Sources

ocamlformat-0.22.4.tbz
sha256=eb54de2b81ac7cc2e68d81a7dc80b391a81b737fcfa3ef969ea91bdad6c9c060
sha512=2bdeb9abc5757176040f641b22c59ac2b038c3bc1c42ddf86422b80cb90278fbe8ca05d0f788be0375a632bb6584b8d165d07f9f84686c2174208a8c20324b13

Description

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

Published: 26 May 2022

README

README.md

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.22.4

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"
  18. base >= "v0.12.0"
  19. ocaml >= "4.08" & < "5.0.0"

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 (61)

  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. diff
  17. diskuvbox < "0.1.2"
  18. dream-inertia
  19. drom
  20. drom_lib
  21. drom_toml
  22. dump_ocamlformat
  23. dune_deps_extra
  24. ez_cmdliner >= "0.2.0"
  25. ez_config >= "0.2.0"
  26. ez_file >= "0.2.0"
  27. ez_hash < "0.5.3"
  28. ez_opam_file
  29. ez_search
  30. ez_subst
  31. fromager
  32. header-check
  33. js_of_ocaml-webgpu >= "0.2"
  34. letters >= "0.2.0" & != "0.3.1"
  35. melange-fest
  36. melange-json >= "1.2.0" & < "2.0.0"
  37. melange-radix-icons >= "0.1.0"
  38. mlx
  39. module-graph
  40. noCanren >= "0.3.0~alpha1"
  41. ocaml-lsp-server < "1.9.0"
  42. ocp-search
  43. ocplib_stuff >= "0.3.0"
  44. opam-bin >= "0.9.5"
  45. opam_bin_lib >= "0.9.5"
  46. owi >= "0.2"
  47. polars
  48. polars_async
  49. ppx_deriving_jsonschema
  50. prelude >= "0.4"
  51. psmt2-frontend >= "0.3.0"
  52. rea < "0.2.0"
  53. red-black-tree
  54. sihl < "0.1.0"
  55. solidity-alcotest
  56. solidity-common
  57. solidity-parser
  58. solidity-test
  59. solidity-typechecker
  60. styled-ppx
  61. yocaml >= "2.0.0"

Conflicts

None

OCaml

Innovation. Community. Security.