Ludovic Courtès
14d6ca3e4d
lint: Do not leak file descriptors for TLS connections.
...
Partially fixes <http://bugs.gnu.org/20145 >.
* guix/scripts/lint.scm (probe-uri): Use 'close-connection' instead of
'close-port'.
2016-03-17 23:53:53 +01:00
Ludovic Courtès
4ce783a2f9
lint: cve: Gracefully handle HTTP errors.
...
* guix/scripts/lint.scm (current-vulnerabilities*): New procedure.
(package-vulnerabilities): Use it.
2016-03-04 11:48:52 +01:00
Ludovic Courtès
937690f909
lint: derivation: Disable grafts, but check replacements.
...
* guix/scripts/lint.scm (check-derivation): Pass #:graft? #f. When
'package-replacement' exists, compute its derivation.
2016-03-03 09:46:17 +01:00
Mathieu Lirzin
f3044a4b7b
lint: Rewrite 'check-patch-file-names'.
...
* guix/scripts/lint.scm (check-patch-file-names): Improve clarity by
reversing the logic.
2016-01-28 16:31:38 +01:00
Mathieu Lirzin
90ca918668
lint: Remove an unneeded clause in 'check-patch-file-names'.
...
* guix/scripts/lint.scm (check-patch-file-names): Don't check if patches
start with the package full name since matching the package name (which
is a prefix of the full name) is sufficient.
2016-01-28 16:31:38 +01:00
Ludovic Courtès
f888c0b120
lint: cve: Catch host name lookup errors.
...
* guix/scripts/lint.scm (package-vulnerabilities): Catch
'getaddrinfo-error'.
2016-01-06 15:54:12 +01:00
Ludovic Courtès
c5b303c57f
lint: The CPE name of GRUB is "grub2".
...
Reported by Leo Famulari.
* guix/scripts/lint.scm (package-name->cpe-name): Add "grub".
2015-12-20 22:34:22 +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
862d2479f6
ftp-client: Default port for 'ftp-open' is now "ftp".
...
* guix/ftp-client.scm (ftp-open): Change default #:port to "ftp".
* guix/scripts/lint.scm (probe-uri): Remove 'port' parameter to
'ftp-open'.
2015-11-22 14:35:28 +01:00
Ludovic Courtès
bd7e1ffae6
lint: Have connections time out after 3 seconds.
...
* guix/scripts/lint.scm (probe-uri): Add #:timeout parameter. Pass it
to 'open-connection-for-uri' and 'ftp-open'.
(validate-uri): Pass #:timeout 3 to 'probe-uri'.
2015-11-12 23:47:01 +01:00
Alex Kost
e04741f160
lint: Export 'run-checkers'.
...
* guix/scripts/lint.scm (run-checkers): Export. Make 'checkers'
argument optional.
2015-10-09 16:17:45 +03:00
Mathieu Lirzin
cd8b7cfb3f
lint: Fix 'check-texinfo-markup'.
...
Fixes a regression introduced in 5d8d8f3
.
* guix/scripts/lint.scm (check-description-style): When no exception is
thrown in 'check-texinfo-markup', return the rendered description.
2015-09-28 00:23:12 +02:00
Mathieu Lirzin
5d8d8f3b0a
lint: Improve 'check-texinfo-markup'.
...
* guix/scripts/lint.scm (check-description-style): Set 'field' parameter
when emitting a warning in 'check-texinfo-markup'. Catch any error
that may occur in during the 'texi->plain-text' conversion. This is a
followup to commit 2748ee3
.
2015-09-26 15:10:13 +02:00
Mathieu Lirzin
23464bfd99
lint: Accept '`' character.
...
* guix/scripts/lint.scm (properly-starts-sentence?): Match Texinfo
highlighting commands as a sentence start.
2015-09-24 22:55:59 +02:00
Mathieu Lirzin
2748ee3bcf
lint: Check non-translated package descriptions.
...
* guix/ui.scm (texi->plain-text): Export.
* guix/scripts/lint.scm (check-description-style): Use it instead of
'package-description-string'.
2015-09-24 22:46:20 +02: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
Alex Kost
88981dd3e2
Add (guix scripts).
...
* guix/ui.scm: Add missing copyright lines.
(args-fold*, environment-build-options, %default-argument-handler,
parse-command-line): Move to ...
* guix/scripts.scm: ...here. New file.
* guix/scripts/archive.scm: Use it.
* guix/scripts/build.scm: Likewise.
* guix/scripts/download.scm: Likewise.
* guix/scripts/edit.scm: Likewise.
* guix/scripts/environment.scm: Likewise.
* guix/scripts/gc.scm: Likewise.
* guix/scripts/graph.scm: Likewise.
* guix/scripts/hash.scm: Likewise.
* guix/scripts/import/cpan.scm: Likewise.
* guix/scripts/import/cran.scm: Likewise.
* guix/scripts/import/elpa.scm: Likewise.
* guix/scripts/import/gem.scm: Likewise.
* guix/scripts/import/gnu.scm: Likewise.
* guix/scripts/import/hackage.scm: Likewise.
* guix/scripts/import/nix.scm: Likewise.
* guix/scripts/import/pypi.scm: Likewise.
* guix/scripts/lint.scm: Likewise.
* guix/scripts/package.scm: Likewise.
* guix/scripts/publish.scm: Likewise.
* guix/scripts/pull.scm: Likewise.
* guix/scripts/refresh.scm: Likewise.
* guix/scripts/size.scm: Likewise.
* guix/scripts/system.scm: Likewise.
* tests/ui.scm (with-environment-variable, "parse-command-line",
"parse-command-line and --no options"): Move to ...
* tests/scripts.scm: ...here. New file.
* Makefile.am (MODULES): Add guix/scripts.scm.
(SCM_TESTS): Add tests/scripts.scm.
* po/guix/POTFILES.in: Add guix/scripts.scm.
2015-09-18 21:42:06 +03: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
Alex Kost
521a11e0a6
guix lint: Export checkers and <lint-checker> accessors.
...
* guix/scripts/lint.scm (%checkers, lint-checker, lint-checker?,
lint-checker-name, lint-checker-description, lint-checker-check):
Export.
2015-08-30 18:26:01 +03: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
69b4ffcfbd
Fix typos in translatable strings.
...
Reported by Anders Jonsson <anders.jonsson@norsjovallen.se>.
* gnu/packages/backup.scm, gnu/packages/databases.scm,
gnu/packages/linux.scm, gnu/packages/perl.scm,
gnu/packages/web.scm, guix/scripts/lint.scm,
guix/scripts/publish.scm: Fix typos in translatable strings.
2015-07-23 09:42:23 +02:00
Alex Kost
663d0733c8
guix lint: Remove duplicated module lines.
...
* guix/scripts/lint.scm (guix): Remove duplicated lines for using
'srfi-34' and 'srfi-35' modules. These lines were introduced twice by
commits b210b35
and 002c57c
.
2015-07-13 10:20:34 +03:00
Alex Kost
2a4e2e4b01
guix: Clean up --help messages.
...
* guix/scripts/import.scm (show-help): Add newline before a list of
importers.
* guix/scripts/lint.scm (show-help): Split a long description line.
* guix/scripts/package.scm (show-help): Improve docstrings for --install
and --remove options.
* guix/scripts/system.scm (show-help): Format actions the same way as
guix commands and importers are formatted.
2015-06-08 11:46:05 +03:00
Ludovic Courtès
2b5115f8ba
lint: source: Warn only when all the URIs are unreachable.
...
* guix/scripts/lint.scm (call-with-accumulated-warnings): New procedure.
(with-accumulated-warnings): New macro.
(check-source): Add 'try-uris' and use it. Emit warnings only upon
failure.
2015-05-31 23:25:46 +02:00
Ludovic Courtès
91a0b9cc0b
lint: 'validate-uri' really returns #f on failure.
...
* guix/scripts/lint.scm (validate-uri): Always return #f on failure.
2015-05-31 23:13:09 +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
661c99a434
lint: Report details about FTP errors.
...
* guix/scripts/lint.scm (probe-uri) <'ftp>: Pass more information about
failures alongside 'ftp-response.
(validate-uri) <ftp-response>: Handle it, and adjust "not reachable"
message accordingly.
2015-03-19 13:00:21 +01:00
Ludovic Courtès
284fe31394
lint: Change misleading variable name.
...
* guix/scripts/lint.scm (probe-uri) <'ftp>: Rename 'port' to 'conn'.
2015-03-19 13:00:20 +01: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
Cyril Roelandt
c9815b5deb
lint: handle FTP URIs.
...
* guix/scripts/lint.scm (probe-uri): handle FTP URIs.
2015-02-10 00:24:30 +01:00
Ludovic Courtès
8fbf530260
lint: Fix argument parsing when several packages are specified.
...
* guix/scripts/lint.scm (%options) <--checkers>: Remove 'arg-handler'
parameter, and return a single value.
(guix-lint)[parse-options]: Remove 'arg-handler' parameter from
handlers. Remove second seed to 'args-fold*'.
* tests/guix-lint.sh: Add test.
2015-01-28 14:00:58 +01:00
Ludovic Courtès
06aac933e1
guix lint: Make the 'source' checker happy if at least one URI is valid.
...
Before that it would check all the URIs of each package.
* guix/scripts/lint.scm (validate-uri): Really return #f on failure and
#t otherwise.
(check-source): Replace 'for-each' with 'any'.
2015-01-26 00:19:33 +01:00
Cyril Roelandt
17a7b75c0f
lint: add 'source' checker.
...
* guix/scripts/lint.scm (validate-uri?): New procedure.
(%checkers): Add 'source' checker
2015-01-25 18:34:51 +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
c79c6e598a
lint: Report on the package being checked.
...
* guix/scripts/lint.scm (run-checkers): Check
whether (current-error-port) is a tty, and print the package being
checked and the checker currently running when it is.
2014-12-28 18:21:53 +01:00
Ludovic Courtès
a3bf096945
lint: Add 'home-page' checker.
...
* guix/build/download.scm (open-connection-for-uri): Export.
* guix/scripts/lint.scm (probe-uri, check-home-page): New procedures.
(%checkers): Add 'home-page' checker.
2014-12-28 17:57:36 +01:00
Ludovic Courtès
8b9019a6a9
lint: Fix typos in checker descriptions.
...
* guix/scripts/lint.scm (%checkers): "file names" (two words), and
"synopses" (plural).
2014-11-19 22:52:30 +01:00
Ludovic Courtès
db6dcf816f
lint: Use localized checker descriptions.
...
* guix/scripts/lint.scm (list-checkers-and-exit): Wrap
'lint-checker-description' call in (_ ...).
2014-11-19 22:52:30 +01:00
Ludovic Courtès
836f02bf52
lint: Correctly internationalize warning messages.
...
* guix/scripts/lint.scm (emit-warning): Remove '_' call for format
string.
(check-description-style, check-inputs-should-be-native,
check-synopsis-style, check-patches, check-gnu-synopsis+description):
Wrap message in (_ ...).
2014-11-19 22:52:30 +01:00
Ludovic Courtès
f4d5bca39e
lint: Change checker names to be symbols.
...
* guix/scripts/lint.scm (%checkers): Change 'name' fields to be
symbols.
(%options): Adjust "-c" option handler accordingly.
2014-11-19 22:52:30 +01:00
Ludovic Courtès
37627ffa89
lint: Fold 'sync-descriptions' script as 'gnu-description' lint checker.
...
* build-aux/sync-descriptions.scm: Remove. Move payload to...
* guix/scripts/lint.scm: ... here.
(escape-quotes, official-gnu-packages*,
check-gnu-synopsis+description): New procedures.
(%checkers): Add 'gnu-descriptions'.
* Makefile.am (EXTRA_DIST): Remove build-aux/sync-descriptions.scm.
(sync-descriptions): Use 'guix lint'.
2014-11-19 22:52:28 +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
105c260f00
lint: Skip starting-article test for the synopses of GNU packages.
...
* guix/scripts/lint.scm (check-synopsis-style)[check-start-article]:
Change to (const #t) when PACKAGE matches 'gnu-package?'.
2014-11-07 17:52:11 +01:00
Ludovic Courtès
431e5f5a3e
lint: Tolerate sentences that start with a parenthesis or a quote.
...
* guix/scripts/lint.scm (properly-starts-sentence?): Add (, ", and ' as
valid beginnings.
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
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
Eric Bavier
c04b82ffce
guix: lint: Use if/when consistently.
...
* guix/scripts/lint.scm (check-synopsis-style): Replace single-branch
uses of if with when.
(check-patches): Same
2014-10-26 13:03:53 -05:00
Eric Bavier
86a4126348
guix: lint: Use string-suffix? and string-prefix? where appropriate.
...
* guix/scripts/lint.scm (check-synopsis): Use string-suffix? and
string-prefix? in place of string-take and string=?.
2014-10-26 13:03:53 -05:00
Cyril Roelandt
dd7c013d4b
guix lint: add the --checkers option.
...
* guix/scripts/lint.scm: add the "--checkers" option.
* doc/guix.texi (Invoking guix lint): Document it.
* tests/guix-lint.sh: New file
* Makefile.am (SCM_TESTS): Add it.
2014-10-16 00:50:27 +02: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
Cyril Roelandt
90d104ba82
guix lint: make sure check-patches retrieves patch names.
...
* guix/lint (check-patches): Test the output of origin-patches.
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