Skip to content

feat(scraper): add YAML-driven RWEB best practices analysis - #160

Merged
vvatelot merged 3 commits into
mainfrom
feat/scraper-rweb-best-practices
Oct 1, 2026
Merged

vvatelot merged 3 commits into
mainfrom
feat/scraper-rweb-best-practices

Conversation

@vvatelot

@vvatelot vvatelot commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

Static Badge

Summary

  • Add a best_practices brick with a YAML-configured rule engine and checker registry (no JS port from GreenIT-Analysis)
  • Wire optional analysis into EcoindexScraper via best_practices=True|Path, exposing get_best_practices() after scrape
  • Ship a first RWEB-aligned rule set (0047, 0082, 0042, 0031) with official titles, descriptions, tiers, URLs, and fail thresholds, plus GreenIT-style warn levels

Test plan

  • PYTHONPATH=components:bases .venv/bin/pytest test/components/ecoindex/best_practices/ -q
  • uv run camoufox fetch (if needed)
  • uv run development/best_practices_scraper.py and check EcoIndex + RWEB rule statuses
  • Confirm EcoindexScraper(url=...).get_page_analysis() still works with best_practices disabled (default)

Made with Cursor

Introduce a best_practices brick that evaluates a first set of RWEB rules
alongside EcoIndex metrics, without changing the existing analysis contract.

Co-authored-by: Cursor <cursoragent@cursor.com>
vvatelot and others added 2 commits October 1, 2026 16:36
Polylith check requires projects that ship EcoindexScraper to also declare the new best_practices dependency brick.

Co-authored-by: Cursor <cursoragent@cursor.com>
Path bootstrap must run before importing EcoindexScraper so local polylith bricks win over site-packages.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown

Coverage PR 160

Branch coverage •
FileStmtsMissCoverMissing
components/ecoindex/best_practices
   __init__.py40100% 
   context.py90100% 
   engine.py46296%54, 89
   models.py590100% 
   registry.py170100% 
components/ecoindex/best_practices/rules
   __init__.py30100% 
   dom.py14193%26
   network.py110100% 
components/ecoindex/scraper
   scrap.py1404667%97, 105, 108–109, 111, 123, 140, 143, 147–148, 159–167, 170–176, 178–180, 182, 189–190, 194, 197–198, 201–207, 210, 251–252, 254
TOTAL194455272% 

@vvatelot
vvatelot merged commit fc35e42 into main Oct 1, 2026
6 checks passed
@vvatelot
vvatelot deleted the feat/scraper-rweb-best-practices branch October 1, 2026 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant