From 40a7d4e58ba05f39bf11edab68de6d3ae9c43306 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 19 Aug 2015 11:22:07 +0200 Subject: lint: Add 'formatting' checker. * guix/scripts/lint.scm (report-tabulations, report-trailing-white-space, report-long-line, report-formatting-issues, check-formatting): New procedures. (%formatting-reporters): New variable. (%checkers): Add 'formatting' checker. * tests/lint.scm ("formatting: tabulation", "formatting: trailing white space", "formatting: long line", "formatting: alright"): New tests. * doc/guix.texi (Invoking guix lint): Mention the 'formatting' checker. --- tests/lint.scm | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'tests/lint.scm') diff --git a/tests/lint.scm b/tests/lint.scm index 2807eba1cc..5d56420966 100644 --- a/tests/lint.scm +++ b/tests/lint.scm @@ -420,6 +420,32 @@ requests." (check-source pkg)))) "not reachable: 404"))) +(test-assert "formatting: tabulation" + (string-contains + (with-warnings + (check-formatting (dummy-package "leave the tab here: "))) + "tabulation")) + +(test-assert "formatting: trailing white space" + (string-contains + (with-warnings + ;; Leave the trailing white space on the next line! + (check-formatting (dummy-package "x"))) + "trailing white space")) + +(test-assert "formatting: long line" + (string-contains + (with-warnings + (check-formatting + (dummy-package "x" ;here is a stupid comment just to make a long line + ))) + "too long")) + +(test-assert "formatting: alright" + (string-null? + (with-warnings + (check-formatting (dummy-package "x"))))) + (test-end "lint") -- cgit v1.2.3