Commit Graph

8 Commits

Author SHA1 Message Date
Ludovic Courtès 900e0fbcc4
lint: Gracefully handle errors from 'connect' & co.
* guix/lint.scm (call-with-networking-fail-safe): Add case for
'system-error' as typically raised by 'connect' & co.
2019-08-31 21:04:09 +02:00
Ludovic Courtès 7d09f2e85f
lint: formatting: Reporters return #f or a warning.
* guix/lint.scm (report-tabulations, report-trailing-white-space)
(report-long-line, report-lone-parentheses): Return #f instead
of *unspecified* when there are no warnings.
(report-formatting-issues): Use 'filter-map' instead of 'map' + 'filter'.
2019-08-30 01:33:45 +02:00
Ludovic Courtès 58d5f280a3
lint: Correct use of 'with-networking-fail-safe'.
Fixes <https://bugs.gnu.org/37160>.
Reported by Jonathan Brielmaier <jonathan.brielmaier@web.de>.

* guix/lint.scm (check-for-updates): Make sure the first argument to
'with-networking-fail-safe' is the whole error message.
2019-08-28 00:27:14 +02:00
Ludovic Courtès 674b9df37d
lint: source: Stop as soon as a valid URL is found.
This restores the behavior of 'guix lint' prior to commit
50fc2384fe.

* guix/lint.scm (check-source)[warnings-for-uris]: Rewrite to stop as
soon as one of URIS is valid.
2019-07-20 01:32:18 +02:00
Ludovic Courtès 6dc28adf72
lint: Remove unused imports.
* guix/lint.scm: Remove now unused (gnu packages) and (guix monads)
imports.
2019-07-20 01:32:17 +02:00
Ludovic Courtès 848ae71ea7
lint: 'source' check no longer complains about unavailable mirrors.
Fixes a regression introduced in
50fc2384fe.

Previously, 'guix lint -c source coreutils' would complain if one of the
mirrors was unavailable.  This is no longer the case.

* guix/lint.scm (check-source)[warnings-for-uris]: Use 'filter-map'.
Remove 'append-map' call.
Use 'append-map' here so that we can meaningfull compare the length or
URIS and that of WARNINGS.
Use '=' to compare lengths.
2019-07-20 01:32:17 +02:00
Christopher Baines 38f3176a57
lint: Separate checkers by dependence on the internet.
I think there are a couple of potential uses for this. It's somewhat a
separation in to what checkers are just checking the contents of the
repository (line length for example), and other checkers which are bringing in
external information which could change.

I'm thinking particularly, about treating network dependent checkers
differently when automatically running them, but this commit also adds a
--no-network flag to guix lint, which selects the checkers that don't access
the network, which could be useful if no network access is available.

* guix/lint.scm (%checkers): Rename to %all-checkers.
(%local-checkers, %network-dependent-checkers): New variables.
* guix/scripts/lint.scm (run-checkers): Make the checkers argument mandatory.
(list-checkers-and-exit): Handle the checkers as an argument.
(%options): Adjust for changes to %checkers, add a --no-network option, and
change how the --list-checkers option is handled.
(guix-lint): Adjust indentation, and update how the checkers are handled.
2019-07-15 22:32:19 +01:00
Christopher Baines f363c836e0
lint: Move the linting code to a different module.
To try and move towards making programatic access to the linting code easier,
this commit separates out the linting script, from the linting functionality
that it uses.

* guix/scripts/lint.scm (emit-warnings): Alter to to not use match-lambda, as
<lint-warning> isn't accessible.
(<lint-warning>, lint-warning, make-lint-warning, lint-warning?,
lint-warning-message, lint-warning-message-text, lint-warning-message-data,
lint-warning-location, package-file, %make-warning make-warning,
<lint-checker>, lint-checker, make-lint-checker, lint-checker?,
lint-checker-name, lint-checker-description, lint-checker-check,
properly-starts-sentance?, starts-with-abbreviation?, %quoted-identifier-rx,
check-description-style, package-input-intersection,
check-inputs-should-be-native, check-inputs-should-not-be-an-input-at-all,
package-name-regexp, check-synopsis-style, probe-uri,
tls-certificate-error-string, validate-uri, check-home-page,
%distro-directory, check-patch-file-names, escape-quotes,
official-gnu-packages*, check-gnu-synopsis+description, origin-uris,
check-source, check-source-file-name, check-source-unstable-tarball,
check-mirror-url, check-github-url, check-derivation, check-license,
call-with-networking-fail-safe, with-networking-fail-safe,
current-vulnerabilities*, package-vulnerabilities, check-vulnerabilities,
check-for-updates, report-tabulations, report-trailing-white-space,
report-long-line, %hanging-paren-rx, report-lone-parantheses,
%formatting-reporters, report-formatting-issues, check-formatting, %checkers):
Move to…
* guix/lint.scm: … here
* po/guix/POTFILES.in: Add guix/lint.scm.
* Makefile.am: Add guix/lint.scm.
* tests/lint.scm: Change to import (guix lint), rather than (guix scripts lint).
2019-07-15 22:32:19 +01:00