Repository navigation
Library report and history
audit returns an AuditReport. Every type is Serialize and Deserialize, and the JSON form follows schema/report.schema.json (sitevet::report_schema() returns the same schema as a string).
| Field | Type | Notes |
|---|---|---|
score |
u8 |
Overall, 0 to 100 |
categories |
Vec<CategoryScore> |
category, score, pass, fail, warn counts |
pages |
Vec<PageResult> |
In crawl order |
site |
SiteResult |
Site-wide findings and measurements |
blocked |
Vec<BlockedUrl> |
URLs robots.txt kept sitevet from, with the matching rule |
skipped_rules |
Vec<SkippedRule> |
Rules that did not run and why, such as "needs browser or psi_key" |
changes |
Option<ReportDiff> |
Set when the CLI ran with --baseline
|
start_url, final_url, generated_at, duration_ms, options, sitevet_version, schema_version
|
Run details. options never contains the PageSpeed key |
PageResult has url, final_url, title (the <title> text; none in reports saved before 0.6.0), status (0 when the fetch failed), error, depth, redirect_chain, response_ms, html_bytes, truncated, language (declared, detected and the detection confidence), score, findings and metrics.
for page in &report.pages {
let failing = page.findings.iter().filter(|f| f.status == sitevet::Status::Fail);
for f in failing {
println!("{} {} {}: {}", page.url, f.rule_id, f.title, f.message);
}
}Finding has rule_id, category, title, status (Pass, Fail, Warn, Info), severity (Error, Warning, Info), message, details, evidence, fix and key. key stays the same for the same issue across runs, which is what the diff matches on.
Metric has id, category, label, status (Ok, Warn, Bad, Missing, or none), note and body. The body is a value or a table:
use sitevet::{MetricBody, MetricCell};
for m in &page.metrics {
match &m.body {
MetricBody::Value { value: Some(MetricCell::Number(n)), unit } => println!("{}: {n} {}", m.label, unit.as_deref().unwrap_or("")),
MetricBody::Table { columns, rows, total } => println!("{}: {} of {total} rows, columns {columns:?}", m.label, rows.len()),
_ => {}
}
}Keep a fallback arm: MetricBody and MetricCell are #[non_exhaustive].
report.site.findings holds SiteFindings: a finding plus the urls it affects, such as the pages in a duplicate title group. report.site.metrics holds the link graph, click depth, duplicate groups, near-duplicate pairs, the redirect map, the sitemap lists and the tech stack across pages.
let html = sitevet::render(&report, sitevet::Format::Html); // one self-contained file
let md = sitevet::render(&report, sitevet::Format::Markdown);
let json = sitevet::render(&report, sitevet::Format::Json); // pretty-printedlet d = sitevet::diff(&older, &newer);
println!("score {:+}, {} fixed, {} new", d.score_change, d.fixed.len(), d.new_failures.len());ReportDiff also has categories (before and after per category), pages_added, pages_removed and not_compared: findings whose checks ran in only one of the two reports.
With the history feature, History is the same SQLite store the CLI uses:
use sitevet::History;
let history = History::open(None)?; // SITEVET_HOME or the OS data folder; Some(path) for your own
let id = history.save(&report)?; // returns the new run ID
for run in history.list(Some("https://example.com"), 20)? {
println!("{} {} score {} ({} pages)", run.id, run.started_at, run.score, run.pages);
}
let old = history.load(id)?; // the full AuditReport back
history.delete(id)?;
history.prune(10)?; // keep the 10 newestReports are stored zstd-compressed, a few hundred KB for a 100-page run. A database written by a newer sitevet opens read-only. Nothing breaks.
sitevet is MIT licensed. Source, issues and releases: github.com/Abdulkader-Safi/sitevet.
Getting started
CLI
Library
Reference