Skip to main content

check-definition-expectation.yml

Diff-scoped, warn-only heuristic check for the lab’s rule (Ezra, 2026-11-07; psw#513) to write a definition with an expectation operator where one fits: \E{\log \frac{1}{p(X)}}, not \sum_x p(x) \log \frac{1}{p(x)}.

The check flags a #def- div when both conditions hold:

It skips

A definition that holds <!-- check-definition-expectation: allow --> is exempt.

A definition is checked when the pull request adds a line inside it. With no base to diff against, the check skips instead of scanning the whole tree. It only warns by default, because whether an expectation expresses the quantity needs judgement.

Inputs

Input Default Meaning
globs *.qmd Git pathspecs of tracked files to check (recursive)
paths-ignore none Comma or newline separated globs to skip
fail false Fail on a finding; false warns
whole-tree false Check every definition, to measure a corpus
python-version 3.x Python version
runs-on empty (CI_RUNNER variable, else ubuntu-latest) Runner label; a self-hosted label only for a private repository

Usage

Copy examples/check-definition-expectation.yml to .github/workflows/check-definition-expectation.yml.