cve-bin-tool
cve-bin-tool copied to clipboard
perf(scanner,test): speed up language tests (lazy DB, short-circuit, smaller fixtures)
What’s in this PR
-
Lazy CVE DB: Initialize
CVEDBonly when binary checkers are used (language-only scans don’t create a DB). -
Language short-circuit: If the filename is a known language fixture (e.g.,
pom.xml,package-lock.json,PKG-INFO), skip the expensive file-type subprocess checks and callparse(...)directly. -
Smaller fixtures: Shrink
test/language_data/fail_pom.xmlandfail-package-lock.jsonto minimal valid samples; behaviour unchanged (these are none_found tests).
Before vs After (on my machine)
-
test_language_package_none_found (fail_pom.xml): 0.18s → 0.13s
Notes
- No functional changes; assertions remain identical.
- Checker loading is cached; DB is now lazy; language path avoids subprocess calls.
- Closes #4321
Hi 👋, this PR is part of Hacktoberfest. If it looks good, could you please add the hacktoberfest-accepted label or review it? 🙏 Thanks!
I don't think this PR actually does what your comment above says, but it looks harmless so I've set the tests to run anyhow.