From 5432734b00ae14c3a93af358fc7bbf80e3db5ee8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 26 Nov 2015 22:59:06 +0100 Subject: lint: Add "cve" checker. Fixes . * guix/scripts/lint.scm (package-name->cpe-name, package-vulnerabilities) (check-vulnerabilities): New procedures. * guix/scripts/lint.scm (%checkers): Add "cve" checker. * tests/lint.scm ("cve", "cve: one vulnerability"): New tests. * doc/guix.texi (Invoking guix lint): Mention it. --- tests/lint.scm | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tests') diff --git a/tests/lint.scm b/tests/lint.scm index 3f149562d4..50316ade9a 100644 --- a/tests/lint.scm +++ b/tests/lint.scm @@ -512,6 +512,23 @@ requests." (check-source pkg)))) "not reachable: 404"))) +(test-assert "cve" + (mock ((guix scripts lint) package-vulnerabilities (const '())) + (string-null? + (with-warnings (check-vulnerabilities (dummy-package "x")))))) + +(test-assert "cve: one vulnerability" + (mock ((guix scripts lint) package-vulnerabilities + (lambda (package) + (list (make-struct (@@ (guix cve) ) 0 + "CVE-2015-1234" + (list (cons (package-name package) + (package-version package))))))) + (string-contains + (with-warnings + (check-vulnerabilities (dummy-package "pi" (version "3.14")))) + "vulnerable to CVE-2015-1234"))) + (test-assert "formatting: lonely parentheses" (string-contains (with-warnings -- cgit v1.2.3