rgrinberg / ocamlformat

Auto-formatter for OCaml code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

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

About

Auto-formatter for OCaml code

License:MIT License


Languages

Language:OCaml 87.5%Language:Pawn 8.6%Language:Emacs Lisp 1.0%Language:Standard ML 1.0%Language:Perl 0.7%Language:Raku 0.7%Language:Shell 0.4%Language:Makefile 0.3%