Health report
The Health score is a single 0–100 number that summarizes your project’s overall quality across the categories present in the analysis results. It is used by the --min-health flag to gate CI pipelines.
How the score is calculated
Section titled “How the score is calculated”Health is computed in two stages:
1. Category score
Section titled “1. Category score”For each active category (SEO, Performance), svelte-vitals computes an independent score:
- Every route starts at 100.
- Each failing finding deducts points based on severity:
critical→ −15 per routewarning→ −5 per routeinfo→ −1 per route
- Deductions are taken once per (route, rule) pair — duplicates take the maximum deduction, not a sum.
- Route scores are averaged to produce the category’s headline score.
- If any critical finding is present, the headline score is capped at 79.
2. Weighted Health
Section titled “2. Weighted Health”Health averages the category scores using per-category weights. By default every present category has equal weight (1). With just SEO and Performance present, for example:
Health = (SEO_score × w_seo + Performance_score × w_perf) / (w_seo + w_perf)The formula shows two categories for brevity — the same weighted average runs over all categories present in the results, up to five (SEO, Performance, Correctness, Security, Architecture).
Set weights with the --weights flag or the config file’s weights field — see Config file for both. For example, to make SEO count double:
svelte-vitals --weights seo=2Only categories present in the results are included. If your project has no images, no Performance rules fire, the Performance category produces no results, and Health is based solely on SEO. Performance only appears when the project has images that trigger Performance rules.
The result is rounded to the nearest integer.
--min-health gate
Section titled “--min-health gate”Fail the run (exit code 1) when the Health score falls below a threshold:
svelte-vitals --min-health 80This is useful as a CI gate separate from --fail-on:
--fail-onreacts to individual finding severity.--min-healthreacts to the aggregate weighted score.
Both can be used together.
Example output
Section titled “Example output”Health: 85 (SEO: 90 · Performance: 75)When only SEO rules fire:
Health: 90 (SEO: 90)Per-route breakdown
Section titled “Per-route breakdown”Add --by-route to see the score for every individual route alongside the site-wide Health:
svelte-vitals --by-route