Documentation
¶
Overview ¶
Package fixturetest runs each rule against its fire/pass fixture trees and asserts findings match declared expectations exactly (spec §7).
isolate.go — a fixture for a process-bound rule is judged in its own repository (#28).
The {{root}}/{{repo}} tokens stop a rule NAMING a tree outside itself. They do not stop git. Git discovers a repository by walking UP from the working directory, and a fixture tree has no .git, so a detector that runs `git rev-parse` inside one finds whatever repository encloses the corpus — and a `--default-range` arm then judges the real branch's commits, which is how a pass fixture came to fail for a commit that was never in it. No argv mentions that channel, so no argv rule can close it.
It closes here instead: the arm is copied into a temp directory, that copy is `git init`-ed with one commit, and the copy is what the engine evaluates. Discovery stops at the fixture, and a `..` from the fixture root lands in an empty temp parent rather than in a repository.
Only rules that SPAWN A PROCESS are isolated. A declarative rule reads the files the walk handed it and cannot ask git anything, so copying its fixtures would buy nothing and cost a tree copy per arm across a corpus where those are almost all of them.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EvalIn ¶
func EvalIn(r *config.Rule, dir, repo string, workers int) ([]finding.Finding, *scan.FileSet, error)
EvalIn evaluates one rule over the fixture tree rooted at dir, returning its findings together with the walked FileSet. The caller passes a rule whose checker is already the one it wants exercised (see runFixture's Fresh below); EvalIn owns only what a fixture run must not inherit from the repo, so that policy lives in exactly one place rather than once per caller.
scan.ignore is repo-scoped: its globs are repo-root-relative, but this walk's root is the fixture dir, an unrelated path namespace. Applying them here would be a namespace collision — a fixture that happens to contain vendor/ must still be checked. The same holds for scan.gitignore, and more sharply: the paths a consumer's .gitignore covers (build/, .dart_tool/, node_modules/) are exactly the ones fixture trees like to use, so a repo-level prune would blind fire fixtures that live there — and a fire fixture that stops firing reports as a passing rule. Pinned by TestFixtureRunsAreScanIgnoreFree + TestFixtureRunsAreGitignoreFree.
Second consumer: lint's prefilter-load-bearing fixture differential (#133), which evaluates a rule and its prefilter-stripped twin over these same trees. It needs the identical walk semantics — a repo-level prune there would hide exactly the fire fixture that proves a prefilter load-bearing.
func Run ¶
func Run(cfg *config.Config, allRuleIDs []string, root string, workers int, w io.Writer) (int, error)
Run evaluates every rule's fixtures under root/.formwork/fixtures and writes verdicts to w. It returns the number of failing verdicts (rules whose fixtures misbehaved, plus fixture dirs matching no rule id). Infrastructure problems (unreadable dirs, bad manifests, un-refreshable rules, symlinked fixture trees) return an error instead — never a silent pass.
allRuleIDs is the FULL corpus id set, collected before any --rule scoping narrows cfg: the orphan check must know every legitimate fixture-dir name, or a scoped run would read sibling rules' fixtures as orphans (#58). A dir matching no id in that full set is still a FAIL finding; it does not abort the run (#9).
Types ¶
This section is empty.