ocamlformat

Auto-formatter for OCaml code
README

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.

Install
Published
26 May 2022
Sources
ocamlformat-0.22.4.tbz
sha256=eb54de2b81ac7cc2e68d81a7dc80b391a81b737fcfa3ef969ea91bdad6c9c060
sha512=2bdeb9abc5757176040f641b22c59ac2b038c3bc1c42ddf86422b80cb90278fbe8ca05d0f788be0375a632bb6584b8d165d07f9f84686c2174208a8c20324b13
Dependencies
odoc
with-doc
csexp
>= "1.4.0"
uutf
>= "1.0.1"
uuseg
>= "10.0.0"
re
>= "1.7.2"
odoc-parser
>= "1.0.0" & < "2.0.0"
ocamlformat-rpc-lib
with-test & post & = version
ocaml-version
>= "3.3.0"
menhirSdk
>= "20201216"
menhirLib
>= "20201216"
menhir
>= "20201216"
dune
with-test & < "3.0"
dune
>= "2.8"
cmdliner
>= "1.1.0"
base
>= "v0.12.0"
alcotest
with-test
ocaml
>= "4.08" & < "5.0.0"
Reverse Dependencies