Skip to main content

Module guard

Module guard 

Source
Expand description

The test every consuming repository runs: nothing outside the files it names spells the provider or builds an UpCloud API path.

Lane T3’s nothing_outside_this_module_spells_the_provider was the template: grow_cloud.rs:17 carried its own const API = "https://api.upcloud.com/1.3" for months while the crate’s variable was believed to cover it. A trait nobody is forced through is a suggestion. This scan is what forces it — in each repository, over its own sources.

What counts: a CODE line (not a // comment) before the file’s first #[cfg(test)] that contains one of PATTERNS. A test module may say api.upcloud.com (a redaction test must), and a doc may discuss it.

Constants§

PATTERNS
The spellings that mean “this line talks to UpCloud by itself”: the host, the versioned root, and the path shapes only an API client builds.

Functions§

assert_none
Panic with every offender named — the one-line body of each repository’s guard test.
offenders
Every offending line under roots (recursively, *.rs only), as path:line: text. allowed names files by their path SUFFIX ("src/upcloud_api.rs") whose job it is to spell the provider.
scan
One file’s offending lines.