Contributing

Development setup

This page sets up the tools you need to work on adocfmt and shows the commands that build, test and lint it.

Install the tools

mise installs the tools in the versions that mise.toml pins. Install mise and activate it in your shell, as its getting started guide describes. Then run this once in your clone:

mise install
mise run setup

mise run setup installs the Asciidoctor gem that the tests run with and the Git hooks that lefthook.yml defines. It also makes git blame skip the commits in .git-blame-ignore-revs, which only reformat.

Build

go build ./...

Build the IntelliJ plugin and check it against IntelliJ IDEA 2026.2 and the latest release:

intellij-plugin/gradlew --project-dir intellij-plugin build verifyPlugin

The first run downloads both IDEs, about 1 GB each.

Test

go test ./...

The full run loads Asciidoctor from Ruby, so it needs the gem that mise run setup installs. To run only the tests that need no Asciidoctor, add -short:

go test -short ./...

The testing strategy describes what the tests check.

Tip
After mise run setup, every push runs go test ./…​ first.

Lint

Lint the Go code:

golangci-lint run

Format the Go code:

golangci-lint fmt

Check the formatting of the Java code; spotlessApply instead of spotlessCheck formats it:

intellij-plugin/gradlew --project-dir intellij-plugin spotlessCheck

Lint the shell scripts:

find . -name '*.sh' -not -path './.git/*' -exec shellcheck {} +

Lint the GitHub workflows:

go tool -modfile=tools/actionlint/go.mod actionlint

Check the formatting of the documentation:

mise run check-docs
Tip
After mise run setup, every commit runs these linters first and checks its message.

Build the website

The website is built from docs/ with Hugo, which go tool builds from the module in tools/hugo. Build it and serve it at http://localhost:8080/adocfmt/:

go run ./tools/build-website --serve

The build downloads Pagefind, Mermaid and highlight.js in the versions that website/package-lock.json pins, so you do not need npm. It fails when the front matter of a page does not match its title or lacks a field.

Check the links of the built website:

go tool -modfile=tools/htmltest/go.mod htmltest --conf website/htmltest.yml

View the source on GitHub