OCaml: Add linting recipe, aliases and group comments to justfile
This commit is contained in:
parent
1eb0818463
commit
ce3859f62c
1 changed files with 53 additions and 11 deletions
|
|
@ -8,68 +8,110 @@ dependencies := \
|
||||||
_default:
|
_default:
|
||||||
@just --list
|
@just --list
|
||||||
|
|
||||||
|
|
||||||
|
# DEV
|
||||||
|
|
||||||
# Build and execute
|
# Build and execute
|
||||||
[group('dev')]
|
[group('dev')]
|
||||||
exec *args:
|
execute *args:
|
||||||
dune exec tori -- {{ args }}
|
dune exec tori -- {{ args }}
|
||||||
|
|
||||||
|
alias e := execute
|
||||||
|
|
||||||
# Build and execute on file changes
|
# Build and execute on file changes
|
||||||
[group('dev')]
|
[group('dev')]
|
||||||
exec-watch *args:
|
execute-watch *args:
|
||||||
dune exec --watch tori -- {{ args }}
|
dune exec --watch tori -- {{ args }}
|
||||||
|
|
||||||
|
alias ew := execute-watch
|
||||||
|
|
||||||
# Run tests on file changes
|
# Run tests on file changes
|
||||||
[group('dev')]
|
[group('dev')]
|
||||||
test-watch:
|
test-watch:
|
||||||
dune test --watch
|
dune test --watch
|
||||||
|
|
||||||
|
alias tw := test-watch
|
||||||
|
|
||||||
# Format check on file changes
|
# Format check on file changes
|
||||||
[group('dev')]
|
[group('dev')]
|
||||||
format-watch:
|
format-watch:
|
||||||
find . -regex '.*\.mli?$' | entr -c -- dune fmt --preview
|
find . -regex '.*\.mli?$' | entr -c -- dune fmt --preview
|
||||||
|
|
||||||
|
alias fw := format-watch
|
||||||
|
|
||||||
|
# BUILD
|
||||||
|
|
||||||
# Build project with Dune
|
# Build project with Dune
|
||||||
[group('build')]
|
[group('build')]
|
||||||
build:
|
build:
|
||||||
dune build
|
dune build
|
||||||
|
|
||||||
|
alias b := build
|
||||||
|
|
||||||
# Cleanup build artifacts
|
# Cleanup build artifacts
|
||||||
[group('build')]
|
[group('build')]
|
||||||
clean:
|
clean:
|
||||||
dune 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
|
# Generate coverage files and report
|
||||||
[group('checks')]
|
[group('checks')]
|
||||||
cover : clean build
|
cover: clean build
|
||||||
find . -name '*.coverage' -exec rm -v '{}' ';'
|
find . -name '*.coverage' -exec rm -v '{}' ';'
|
||||||
dune runtest --instrument-with bisect_ppx --force
|
dune runtest --instrument-with bisect_ppx --force
|
||||||
bisect-ppx-report html
|
bisect-ppx-report html
|
||||||
bisect-ppx-report summary
|
bisect-ppx-report summary
|
||||||
|
|
||||||
# Clean, build, run checks and tests with coverage
|
alias co := cover
|
||||||
[group('checks')]
|
|
||||||
full-build: clean check cover
|
|
||||||
|
|
||||||
# Check formatting and run tests with coverage
|
|
||||||
[group('checks')]
|
|
||||||
check: format-check cover
|
|
||||||
|
|
||||||
# Run tests
|
# Run tests
|
||||||
[group('checks')]
|
[group('checks')]
|
||||||
test : build
|
test: build
|
||||||
dune test
|
dune test
|
||||||
|
|
||||||
|
alias t := test
|
||||||
|
|
||||||
|
# Lint with semgrep
|
||||||
|
[group('checks')]
|
||||||
|
lint:
|
||||||
|
semgrep scan --error
|
||||||
|
|
||||||
|
alias l := lint
|
||||||
|
|
||||||
# Format all files
|
# Format all files
|
||||||
[group('checks')]
|
[group('checks')]
|
||||||
format:
|
format:
|
||||||
dune fmt
|
dune fmt
|
||||||
dune promote
|
dune promote
|
||||||
|
|
||||||
|
alias f := format
|
||||||
|
|
||||||
# Check formatting without changing files
|
# Check formatting without changing files
|
||||||
[group('checks')]
|
[group('checks')]
|
||||||
format-check:
|
format-check:
|
||||||
dune fmt --preview
|
dune fmt --preview
|
||||||
|
|
||||||
|
alias fck := format-check
|
||||||
|
|
||||||
|
|
||||||
|
# UNGROUPED
|
||||||
|
|
||||||
# Show system, compiler and tooling information
|
# Show system, compiler and tooling information
|
||||||
info:
|
info:
|
||||||
@echo OCaml version: $(ocamlc --version)
|
@echo OCaml version: $(ocamlc --version)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue