OCaml: Add linting recipe, aliases and group comments to justfile

This commit is contained in:
Juno Takano 2025-04-17 08:23:48 -03:00
commit ce3859f62c

View file

@ -8,68 +8,110 @@ dependencies := \
_default:
@just --list
# DEV
# Build and execute
[group('dev')]
exec *args:
execute *args:
dune exec tori -- {{ args }}
alias e := execute
# Build and execute on file changes
[group('dev')]
exec-watch *args:
execute-watch *args:
dune exec --watch tori -- {{ args }}
alias ew := execute-watch
# Run tests on file changes
[group('dev')]
test-watch:
dune test --watch
alias tw := test-watch
# Format check on file changes
[group('dev')]
format-watch:
find . -regex '.*\.mli?$' | entr -c -- dune fmt --preview
alias fw := format-watch
# BUILD
# Build project with Dune
[group('build')]
build:
dune build
alias b := build
# Cleanup build artifacts
[group('build')]
clean:
dune clean
alias cl := clean
# Clean, build, run checks and tests with coverage
[group('build')]
full-build: clean check cover
alias fb := full-build
# CHECKS
# Check formatting and run tests with coverage
[group('checks')]
check: lint format-check cover
alias c := check
# Generate coverage files and report
[group('checks')]
cover : clean build
cover: clean build
find . -name '*.coverage' -exec rm -v '{}' ';'
dune runtest --instrument-with bisect_ppx --force
bisect-ppx-report html
bisect-ppx-report summary
# Clean, build, run checks and tests with coverage
[group('checks')]
full-build: clean check cover
# Check formatting and run tests with coverage
[group('checks')]
check: format-check cover
alias co := cover
# Run tests
[group('checks')]
test : build
test: build
dune test
alias t := test
# Lint with semgrep
[group('checks')]
lint:
semgrep scan --error
alias l := lint
# Format all files
[group('checks')]
format:
dune fmt
dune promote
alias f := format
# Check formatting without changing files
[group('checks')]
format-check:
dune fmt --preview
alias fck := format-check
# UNGROUPED
# Show system, compiler and tooling information
info:
@echo OCaml version: $(ocamlc --version)