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.

OCaml

Innovation. Community. Security.