Skip to content

ocaml-ppx/ocamlformat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

author
Guillaume Petiot
May 26, 2022
838ba9f Â· May 26, 2022
Oct 27, 2021
May 18, 2022
May 18, 2022
May 26, 2022
May 19, 2022
Mar 24, 2022
Mar 10, 2022
May 25, 2022
Feb 3, 2022
May 25, 2022
May 25, 2022
May 26, 2022
Jul 9, 2021
Jul 16, 2021
Aug 28, 2020
Oct 19, 2017
May 26, 2022
Oct 27, 2018
Aug 27, 2021
May 24, 2022
Oct 19, 2017
Oct 20, 2021
May 26, 2022
Mar 24, 2022
May 25, 2022
May 4, 2022
May 25, 2022
May 4, 2022
May 4, 2022
May 25, 2022
Jul 19, 2021

Repository files navigation

Build Status

OCamlFormat

Hello, new user! Welcome! 👋

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.