From ce3859f62c9f46d7cc321ac4277253887b79dcc9 Mon Sep 17 00:00:00 2001 From: jutty Date: Thu, 17 Apr 2025 08:23:48 -0300 Subject: [PATCH] OCaml: Add linting recipe, aliases and group comments to justfile --- ocaml/.justfile | 64 ++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 53 insertions(+), 11 deletions(-) diff --git a/ocaml/.justfile b/ocaml/.justfile index e2d0168..6cdc060 100644 --- a/ocaml/.justfile +++ b/ocaml/.justfile @@ -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)