Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ csv = "1"
regex = "1"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
toml = "0.8"
walkdir = "2"
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ Standalone Rust command-line tool with child commands for cntryl.
- `validate-tests`: checks Rust tests for naming and AAA conventions.
- `generate-inventory`: scans tests and benchmarks and writes an inventory report.
- `summarize-benchmarks`: collects benchmark results, compares them to baseline, and writes a report.
- `validate-docs`: validates configured Markdown inventory, links, anchors, and policy text.
- `validate-benchmarks`: validates Cargo benchmark targets against documentation and workflow coverage.
- `check-module-sizes`: checks production Rust module sizes with configured thresholds and allowlists.
- `test-watchdog`: runs integration tests one at a time with per-test timeouts.

## Install

Expand Down Expand Up @@ -36,6 +40,10 @@ Run them from the repository you want to inspect after install:
cntryl-tools validate-tests
cntryl-tools generate-inventory
cntryl-tools summarize-benchmarks
cntryl-tools validate-docs
cntryl-tools validate-benchmarks
cntryl-tools check-module-sizes
cntryl-tools test-watchdog --suite <suite> --timeout 60
```

`validate-tests` runs against the current directory by default, so run it from the repo you want to check.
Expand All @@ -54,6 +62,33 @@ If you are already in the repo you want to inspect, just run the installed comma
cntryl-tools validate-tests
cntryl-tools generate-inventory
cntryl-tools summarize-benchmarks
cntryl-tools validate-docs
cntryl-tools validate-benchmarks
cntryl-tools check-module-sizes
cntryl-tools test-watchdog --suite <suite> --timeout 60
```

## Repository policy

Checks use `.cntryl/repository.toml` when present. The file keeps project policy
out of the shared binary:

```toml
[docs]
required = ["README.md", "docs/README.md"]
forbidden_paths = ["docs/archive/old.md"]
forbidden_text = ["placeholder text"]

[benchmarks]
documentation = ["docs/development/benchmarks.md"]
workflow = ".github/workflows/bench.yml"
not_pr_gate_phrase = "not a pull-request performance gate"

[module_sizes]
warn_lines = 1200
max_lines = 1600
allowlist = ["src/large_provider.rs"]
legacy_allowlist = []
```

`summarize-benchmarks` also accepts `--product-name` and `--report-title` if you want to override the default report branding.
Expand Down
13 changes: 13 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ mod generate_inventory;
mod model;
#[path = "summarize_benchmarks/report.rs"]
mod report;
mod repository_checks;
mod summarize_benchmarks;
#[path = "summarize_benchmarks/sweep.rs"]
mod sweep;
Expand All @@ -34,6 +35,14 @@ enum Commands {
GenerateInventory(generate_inventory::GenerateInventoryArgs),
#[command(name = "summarize-benchmarks")]
SummarizeBenchmarks(summarize_benchmarks::SummarizeBenchmarksArgs),
#[command(name = "validate-docs")]
ValidateDocs(repository_checks::ValidateDocsArgs),
#[command(name = "validate-benchmarks")]
ValidateBenchmarks(repository_checks::ValidateBenchmarksArgs),
#[command(name = "check-module-sizes")]
CheckModuleSizes(repository_checks::CheckModuleSizesArgs),
#[command(name = "test-watchdog")]
TestWatchdog(repository_checks::TestWatchdogArgs),
}

fn main() {
Expand All @@ -42,6 +51,10 @@ fn main() {
Commands::ValidateTests(args) => validate_tests::run(args),
Commands::GenerateInventory(args) => generate_inventory::run(&args),
Commands::SummarizeBenchmarks(args) => summarize_benchmarks::run(args),
Commands::ValidateDocs(args) => repository_checks::validate_docs(args),
Commands::ValidateBenchmarks(args) => repository_checks::validate_benchmarks(args),
Commands::CheckModuleSizes(args) => repository_checks::check_module_sizes(args),
Commands::TestWatchdog(args) => repository_checks::test_watchdog(args),
}
.unwrap_or_else(|error| {
eprintln!("error: {error:#}");
Expand Down
Loading