Skip to main content

Quick Start

This is your first introduction to dunolint - a tool that helps you maintain consistent build configurations across OCaml projects. If you're familiar with dune but new to dunolint, this tutorial will show you the core concepts in under a minute.

Simulating an Existing Project

For this mdx tutorial, let's simulate a typical OCaml project with a simple library:

For the purpose of this compiled documentation (mdx) we've prepared the contents of a simple dune file under the file dune.txt in our repo, we'll copy it as src/dune to make the rest of the test use it. We're also initializing a workspace file to set the project root used during the execution of this document.

$ touch dune-workspace
$ mkdir -p src
$ cat dune.txt > src/dune
$ cat src/dune
(library
(name mylib))

Creating Your First Dunolint Configuration

Say you want all libraries & executables to have code coverage instrumentation.

Create a config file named dunolint:

$ cat dunolint.txt > dunolint
$ cat dunolint
(lang dunolint 1.0)

(rule
(enforce (dune (instrumentation (backend bisect_ppx)))))

Seeing Dunolint in Action

Check what needs to be fixed:

$ dunolint lint --dry-run
dry-run: Would edit file "src/dune":
-1,2 +1,4
(library
!| (name mylib)
!| (instrumentation
!| (backend bisect_ppx)))

Apply the fix:

$ dunolint lint --yes
Editing file "src/dune":
-1,2 +1,4
(library
!| (name mylib)
!| (instrumentation
!| (backend bisect_ppx)))

That's it! In under a minute, you've seen how dunolint enforces consistent build configurations across your entire project - both existing code and anything you add later.

Next Steps