Credence.RuleScaffold
(credence v0.8.0)
Copy Markdown
Pure templates for a new rule and its test files. files/2 returns
[{path, content}] for a type — no disk I/O — so it is testable in memory and
reused by both the Mix task (mix credence.gen.rule) that writes the files and
the pin (Credence.GeneratorMetaTest) that proves the output passes every
structural gate.
The emitted tests are intentionally red: each carries a real positive /
transform assertion that fails against the inert stub, alongside the negative /
fixpoint / attribution shapes the structural gates require — so the gates pass
while the rule is unmistakably unfinished. Single-line fixtures are plain "…"
strings in canonical form (the test healer's convention) and use parseable
placeholders (foo(bar) / baz(qux)), so the parser never crashes on them at
runtime; fix tests compare with confirm_fix/2.
Templates carry __TQ__ for a """ heredoc delimiter (so the template strings
themselves — e.g. moduledocs — don't nest heredocs) and __RULE_MODULE__ /
__TEST_MODULE__ / __RULE__ / __SNAKE__ name slots, all filled by render/3
from Credence.RuleName.
Summary
Functions
File plans ([{path, content}]) for a new name rule of type.
Functions
@spec files(String.t(), Credence.RuleName.rule_type()) :: [{String.t(), String.t()}]
File plans ([{path, content}]) for a new name rule of type.