Assertions over the shape and contents of git commits, run as a linter.
mix presubmit loads a change set — a commit, the staged index, or the
working tree — parses the Elixir it changed into a structural description,
and runs the rules in .presubmit.exs against it. See
Mix.Tasks.Presubmit for the command line and Presubmit.RuleSet
for writing rules.
Programmatic use:
commit = Presubmit.load(source: :auto)
report = Presubmit.Runner.run(commit, Presubmit.Config.load!().rules)
Summary
Types
@type source() :: :auto | :head | :staged | :worktree | {:rev, String.t()}
Functions
@spec load(keyword()) :: Presubmit.Commit.t()
Loads a change set.
Options
:repo— repository path (default: the current directory).:source—:head(default),{:rev, rev},:staged,:worktree, or:auto, which is:worktreewhen anything on disk differs fromHEADand:headotherwise.:message— raw message text to attach to a:stagedor:worktreechange set (from acommit-msghook, say), cleaned as git would.:base— tree-ish to measure a:stagedor:worktreechange set against instead ofHEAD("HEAD^"while amending).
The concrete source :auto would pick for opts[:repo] right now.