Commit Graph

38 Commits

Author SHA1 Message Date
David Craven 99fe215cc1
lint: 'inputs-should-be-native' checks for intltool, itstool and glib:bin.
* guix/scripts/lint.scm (check-inputs-should-be-native): Warn when intltool,
itstool or glib:bin isn't a native-input.
* tests/lint.scm (inputs: glib:bin is probably a native input): Add test.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2016-07-24 19:54:15 +02:00
Ludovic Courtès bfcb3d767b
lint: 'validate-uri' reports suspiciously small 200 responses.
* guix/scripts/lint.scm (validate-uri): Upon 200 http-response, check
the 'response-content-length' and emit a warning when it is <= 1000.
* tests/lint.scm (call-with-http-server): Add 'data' parameter.
(with-http-server): Likewise.
(%long-string): New variable.
("home-page: 200"): Pass %LONG-STRING to 'with-http-server'.
("home-page: 404", "source: 200", "source: 404"): Likewise.
("home-page: 200 but short length"): New test.
("source: 200 but short length"): New test.
2016-07-13 00:50:05 +02:00
Ludovic Courtès 5c6a062d48
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.
2016-04-28 18:03:01 +02:00
Ludovic Courtès 20be23c3b6
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.
2016-04-27 11:57:48 +02:00
Mathieu Lirzin a9edb211e7 build: Add a Guile custom test driver using SRFI-64.
Before that '.log' files for scheme tests were fragmented and not
included in test-suite.log.  This unifies the semantics of SRFI-64 API
with Automake test suite.

* build-aux/test-driver.scm: New file.
* Makefile.am (SCM_LOG_DRIVER, AM_SCM_LOG_DRIVER_FLAGS): New variables.
(SCM_LOG_COMPILER, AM_SCM_LOG_FLAGS): Delete variables.
(AM_TESTS_ENVIRONMENT): Set GUILE_AUTO_COMPILE to 0.
* test-env.in: Silence guix-daemon.
* doc/guix.texi (Running the Test Suite): Describe how to display the
detailed results.  Bug reports require only 'test-suite.log' file.
* tests/base32.scm, tests/build-utils.scm, tests/builders.scm,
tests/challenge.scm, tests/cpan.scm, tests/cpio.scm, tests/cran.scm,
tests/cve.scm, tests/derivations.scm, tests/elpa.scm,
tests/file-systems.scm, tests/gem.scm, tests/gexp.scm,
tests/gnu-maintenance.scm, tests/grafts.scm, tests/graph.scm,
tests/gremlin.scm, tests/hackage.scm, tests/hash.scm,
tests/import-utils.scm, tests/lint.scm, tests/monads.scm, tests/nar.scm,
tests/packages.scm, tests/pk-crypto.scm, tests/pki.scm,
tests/profiles.scm, tests/publish.scm, tests/pypi.scm,
tests/records.scm, tests/scripts-build.scm, tests/scripts.scm,
tests/services.scm, tests/sets.scm, tests/size.scm, tests/snix.scm,
tests/store.scm, tests/substitute.scm, tests/syscalls.scm,
tests/system.scm, tests/ui.scm, tests/union.scm, tests/upstream.scm,
tests/utils.scm: Don't exit at the end of test groups.
* tests/containers.scm: Likewise.  Use 'test-skip' instead of exiting
with error code 77.
2016-04-03 14:19:09 +02:00
Mathieu Lirzin 052d53df1f tests: Use 'dummy-origin' for lint tests when possible.
* guix/tests/lint.scm ("patches: file names", "patches: not found"): Use
'dummy-origin'.  'sha256' field was wrongly set to a string instead of a
bytevector.
2016-01-28 16:31:38 +01:00
Ludovic Courtès c74f0cb2b8 tests: Prevent 'http_proxy' from breaking Web server tests.
* tests/lint.scm: Add call to 'unsetenv' to remove 'http_proxy'.
* tests/publish.scm: Likewise.
2016-01-22 00:02:52 +01:00
Ludovic Courtès 4e70fe4d0e lint: Do not report already-patched vulnerabilities.
* guix/scripts/lint.scm (patch-file-name): New procedure.
(check-vulnerabilities): Use it to filter out patched vulnerabilities.
* tests/lint.scm ("cve: one patched vulnerability"): New test.
2015-11-28 16:15:31 +01:00
Ludovic Courtès 5432734b00 lint: Add "cve" checker.
Fixes <http://bugs.gnu.org/21289>.

* 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.
2015-11-26 23:04:19 +01:00
Ludovic Courtès e0566f12f8 lint: Report lonely parentheses.
* guix/scripts/lint.scm (%hanging-paren-rx): New variable.
  (report-lone-parentheses): New procedure.
  (%formatting-reporters): Use it.
* tests/lint.scm ("formatting: lonely parentheses"): New test.
2015-09-18 21:54:04 +02:00
Mathieu Lirzin 3500e659f1 lint: Add 'check-texinfo-markup' checker.
* guix/script/lint.scm (check-description-style): Check for invalid
  Texinfo markup.
* tests/lint.scm: Test it.
2015-09-15 19:01:23 +02:00
Eric Bavier 50f5c46d06 guix: lint: Check for meaningful origin file names.
* guix/scripts/lint.scm (check-source-file-name): New procedure.
  (%checkers): Add 'source-file-name' checker.
* tests/lint.scm ("source-file-name", "source-file-name: v prefix")
  ("source-file-name: valid", "source-file-name: bad checkout")
  ("source-file-name: good checkout"): New tests.
* doc/guix.texi (Invoking guix lint): Mention file name check.
2015-09-14 18:03:33 -05:00
Ludovic Courtès 52b9efe337 lint: Add 'license' checker.
* guix/scripts/lint.scm (check-license): New procedure.
  (%checkers): Add 'license' checker.
* tests/lint.scm ("license: invalid license"): New test.
2015-09-06 12:36:15 +02:00
Ludovic Courtès 40a7d4e58b 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.
2015-08-19 11:39:17 +02:00
Ludovic Courtès 002c57c6f7 lint: Add a 'derivation' checker.
* guix/scripts/lint.scm (check-derivation): New procedure.
  (%checkers): Add 'derivation' checker.
* tests/lint.scm ("derivation: invalid arguments"): New test.
2015-04-13 00:02:59 +02:00
Ludovic Courtès b210b35d61 lint: Report patches that cannot be found.
* guix/scripts/lint.scm (check-patch-file-names): Wrap body in 'guard'.
* tests/lint.scm ("patches: not found"): New test.
2015-04-10 10:27:46 +02:00
Ludovic Courtès 56b1b74c90 lint: Rename 'check-patches' to 'check-patch-file-names'.
* guix/scripts/lint.scm (check-patches): Rename to...
  (check-patch-file-names): ... this.  Rename 'filename' to 'file'.
  (%checkers): Adjust accordingly.
* tests/lint.scm ("patches: file names"): Likewise.
2015-04-10 10:11:59 +02:00
Ludovic Courtès 4e7b6b4838 tests: Fix module name for 'lint'.
* tests/lint.scm: Change module name to 'test-lint'.
2015-03-31 22:23:57 +02:00
Ludovic Courtès 950d2ea414 lint: Add tests for the 'source' checker.
* guix/scripts/lint.scm (check-source): Export.
* tests/lint.scm (%null-sha256): New procedure.
  ("source: 200", "source: 404"): New tests.
2015-03-05 22:17:36 +01:00
Ludovic Courtès 754e5be2d5 tests: Fix import.
* tests/lint.scm: Use 'url-fetch' from (guix download), not (guix build
  download), although this was actually harmless here.
2015-03-05 22:17:36 +01:00
Ludovic Courtès 4655005e24 tests: Properly synchronize threads in the 'home-page' lint tests.
* tests/lint.scm (%http-server-lock, %http-server-ready): New
  variables.
  (http-open): New procedure.
  (stub-http-server): Use it.
  (call-with-http-server): Wrap body in 'with-mutex'.  Call
  'wait-condition-variable' after 'make-thread'.
2015-01-13 11:09:05 +01:00
Ludovic Courtès 05f0607bfc tests: Add missing copyright line.
* tests/lint.scm: Add missing copyright line for commit 907c98ac and
  others.
2015-01-07 22:33:21 +01:00
Ludovic Courtès 4fbf4ca552 tests: Make the 'lint' tests slightly more concise.
* tests/lint.scm (with-warnings): New macro.
  Replace all uses of 'call-with-warnings' with the corresponding
  'with-warnings' form.
2014-12-29 21:19:13 +01:00
Ludovic Courtès 8b385969cf tests: Factorize the 'dummy-package' macro.
* guix/tests.scm (dummy-package): New macro.
* tests/lint.scm (dummy-package): Remove.
* tests/packages.scm (dummy-package): Remove.
2014-12-29 21:18:12 +01:00
Ludovic Courtès 907c98acbb lint: Add tests for the 'home-page' checker.
Suggested by Cyril Roelandt <tipecaml@gmail.com>.

* tests/lint.scm (%http-server-port, %http-server-socket, %local-url,
  stub-http-server): New variables.
  (http-write, call-with-http-server): New procedures.
  (with-http-server): New macro.
  ("home-page: wrong home-page", "home-page: invalid URI", "home-page:
  host not found", "home-page: Connection refused", "home-page: 200",
  "home-page: 404"): New tests.
* guix/scripts/lint.scm (check-home-page): Export.
2014-12-29 21:17:36 +01:00
Ludovic Courtès 15a6d433ff lint: Allow synopses that start with an abbreviation.
* guix/scripts/lint.scm (starts-with-abbreviation?): New procedure.
  (check-synopsis-style)[check-start-with-package-name]: Use it.
* tests/lint.scm ("synopsis: start with abbreviation"): New test.
2014-11-07 17:52:11 +01:00
Ludovic Courtès 17854ef91d lint: Improve check for synopses starting with package name.
* guix/scripts/lint.scm (package-name-regexp): New procedure.
  (check-synopsis-style)[check-start-with-package-name]: Use it instead
  of 'string-prefix-ci?'.
* tests/lint.scm ("synopsis: start with package name prefix"): New test.
2014-11-07 17:52:11 +01:00
Ludovic Courtès b1e666835e lint: Simplify no-warnings tests.
* tests/lint.scm ("description: may start with a digit"): Replace
  (not (string-contains exp str)) with (string-null? exp).
  ("description: may start with lower-case package name"): Likewise.
  ("description: end-of-sentence detection with abbreviations"):
  Likewise.
  ("synopsis: may start with a digit"): Likewise.
  ("synopsis: ends with 'etc.'"): Likewise.
2014-11-07 17:52:11 +01:00
Eric Bavier 3c42965b1e guix: lint: Make exception for package name starting description.
* guix/scripts/lint.scm (check-description-style): Exception for
  upper-case rule if the description starts with the package name.
* tests/lint.scm: Test it.
2014-10-26 13:03:53 -05:00
Eric Bavier 903581f971 guix: lint: Allow digits at start of synopsis or description.
* guix/scripts/lint.scm (start-with-capital-letter?): Rename too...
  (properly-starts-sentence?): Rewrite with regex and add digits.
  (check-description-style, check-synopsis-style): Use it.
* tests/lint.scm: Add tests.
2014-10-26 13:03:53 -05:00
Eric Bavier 334c43e354 guix: lint: Check for empty synopses and descriptions.
* guix/scripts/lint.scm (check-description-style,
  check-synopsis-style): New emptiness checks.
* tests/lint.scm: Test them.
2014-10-26 13:03:53 -05:00
Eric Bavier 574e847b8e guix: lint: Check for proper end-of-sentence space.
* guix/scripts/lint.scm (start-with-capital-letter?): Handle empty
  strings.
  (check-description-style): New check for end-of-sentence space.
* tests/lint.scm: Test it.
2014-10-26 13:03:53 -05:00
Cyril Roelandt 3c762a13bf guix lint: make sure synopses do not start with the package name.
* guix/scripts/lint.scm (check-start-with-package-name): New method.
* tests/lint.scm ("synopsis: start with package name"): New test.
2014-10-08 03:08:20 +02:00
Cyril Roelandt a00ffdaa17 guix lint: Make sure a synopsis cannot start with a lower-case article.
* guix/scripts/lint.scm (check-start-article): use "string-ci=?" instead of
  "string=?".
* tests/lint.scm ("synopsis: starts with 'a'",
  "synopsis: starts with 'an'"): New tests.
2014-10-08 03:08:19 +02:00
Cyril Roelandt 8202a51313 guix lint: check whether descriptions and synopses start with an upper-case letter.
* guix/scripts/lint.scm (check-description-style,
  check-synopsis-start-upper-case): New methods.
* tests/lint.scm ("description: does not start with an upper-case letter",
  "synopsis: does not start with an upper-case letter"): New tests.
2014-10-08 03:08:19 +02:00
Cyril Roelandt 5622953de1 guix lint: Make sure synopses are not too long.
* guix/scripts/lint.scm (check-synopsis-length): New procedure.
* tests/lint.scm ("synopsis: too long"): New test.
2014-10-08 03:08:19 +02:00
Ludovic Courtès b002e9d08e guix lint: Remove "guix lint: " prefix from warnings.
This allows editors to parse warnings correctly.

* guix/scripts/lint.scm (emit-warning): Use 'format' instead of
  'warning', to avoid the "guix lint: " prefix in messages.
* tests/lint.scm (call-with-warnings): Indent.
2014-09-03 15:43:07 +02:00
Cyril Roelandt b4f5e0e87c scripts: add guix lint
* guix/scripts/lint.scm: New file. Defines a 'lint' tool for Guix packages.
* tests/lint.scm: New file.
* Makefile.am (MODULES, SCM_TESTS): Add them.
* po/guix/Makevars: Update appropriately.
* po/guix/POTFILES.in: Update appropriately.
* doc/guix.texi: Document "guix lint".
2014-09-03 02:07:07 +02:00