package ocamlformat

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

Install

Dune Dependency

Authors

Maintainers

Sources

ocamlformat-0.21.0.tbz
sha256=2a1817f6bc581ff0cce9f0aa9687b897b02726e2ab75749ee98d57637057332d
sha512=db47f843bfc5a438d43f7c482cde86bd13f05a6825e2a0afa80614b651a88ae8b3805cca45da6bcf9189e741e0c79d38652b0bc47efe636c1502a66676dcb28e

Description

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

Published: 28 Feb 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.

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.21.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 (18)

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

Dev Dependencies (3)

  1. odoc with-doc
  2. dune with-test & < "3.0"
  3. alcotest with-test

Used by (65)

  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. jsoo-react
  35. letters >= "0.2.0" & != "0.3.1"
  36. melange-fest
  37. melange-json >= "1.2.0" & < "2.0.0"
  38. melange-radix-icons >= "0.1.0"
  39. mlx
  40. module-graph
  41. noCanren >= "0.3.0~alpha1"
  42. OCanren
  43. ocaml-lsp-server < "1.9.0"
  44. ocamlformat-rpc = "0.21.0"
  45. ocp-search
  46. ocplib_stuff >= "0.3.0"
  47. opam-bin >= "0.9.5"
  48. opam_bin_lib >= "0.9.5"
  49. owi >= "0.2"
  50. polars
  51. polars_async
  52. ppx_deriving_jsonschema
  53. prelude >= "0.4"
  54. psmt2-frontend >= "0.3.0"
  55. rea < "0.2.0"
  56. red-black-tree
  57. sihl < "0.1.0"
  58. solidity-alcotest
  59. solidity-common
  60. solidity-parser
  61. solidity-test
  62. solidity-typechecker
  63. styled-ppx
  64. tezt >= "3.1.0" & < "4.1.0"
  65. yocaml >= "2.0.0"

Conflicts

None

OCaml

Innovation. Community. Security.