From 20be23c3b67dd181a2c4b468626490a7eb74e492 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 27 Apr 2016 10:05:45 +0200 Subject: lint: Report synopses/descriptions that are not strings. Suggested by John Darrington. * guix/scripts/lint.scm (check-description-style): Emit a warning when DESCRIPTION is not a string. (check-synopsis-style): Likewise. (check-gnu-synopsis+description): Likewise. * tests/lint.scm ("description: not a string", "synopsis: not a string"): New tests. --- tests/lint.scm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests/lint.scm') diff --git a/tests/lint.scm b/tests/lint.scm index 4f0196491d..9bc42990ef 100644 --- a/tests/lint.scm +++ b/tests/lint.scm @@ -138,6 +138,14 @@ requests." (define-syntax-rule (with-warnings body ...) (call-with-warnings (lambda () body ...))) +(test-assert "description: not a string" + (->bool + (string-contains (with-warnings + (let ((pkg (dummy-package "x" + (description 'foobar)))) + (check-description-style pkg))) + "invalid description"))) + (test-assert "description: not empty" (->bool (string-contains (with-warnings @@ -191,6 +199,14 @@ requests." "E.g. Foo, i.e. Bar resp. Baz (a.k.a. DVD).")))) (check-description-style pkg))))) +(test-assert "synopsis: not a string" + (->bool + (string-contains (with-warnings + (let ((pkg (dummy-package "x" + (synopsis #f)))) + (check-synopsis-style pkg))) + "invalid synopsis"))) + (test-assert "synopsis: not empty" (->bool (string-contains (with-warnings -- cgit v1.2.3 From 5c6a062d48e36d6f086c0308d57c65df87b3c518 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 28 Apr 2016 17:48:47 +0200 Subject: lint: 'check-vulnerabilities' follows package replacements. * guix/scripts/lint.scm (check-vulnerabilities): Check the replacement of PACKAGE. * tests/lint.scm ("cve: patched vulnerability in replacement"): New test. --- guix/scripts/lint.scm | 3 ++- tests/lint.scm | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) (limited to 'tests/lint.scm') diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm index a8023a5b1e..c581586ac3 100644 --- a/guix/scripts/lint.scm +++ b/guix/scripts/lint.scm @@ -644,7 +644,8 @@ from ~s: ~a (~s)~%") (() #t) ((vulnerabilities ...) - (let* ((patches (filter-map patch-file-name + (let* ((package (or (package-replacement package) package)) + (patches (filter-map patch-file-name (or (and=> (package-source package) origin-patches) '()))) diff --git a/tests/lint.scm b/tests/lint.scm index 9bc42990ef..1f1b0c95e9 100644 --- a/tests/lint.scm +++ b/tests/lint.scm @@ -559,6 +559,25 @@ requests." (patches (list "/a/b/pi-CVE-2015-1234.patch")))))))))) +(test-assert "cve: patched vulnerability in replacement" + (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-null? + (with-warnings + (check-vulnerabilities + (dummy-package + "pi" (version "3.14") (source (dummy-origin)) + (replacement (dummy-package + "pi" (version "3.14") + (source + (dummy-origin + (patches + (list "/a/b/pi-CVE-2015-1234.patch")))))))))))) + (test-assert "formatting: lonely parentheses" (string-contains (with-warnings -- cgit v1.2.3