guix-devel/guix/scripts
Christopher Baines 50fc2384fe
scripts: lint: Handle warnings with a record type.
Rather than emiting warnings directly to a port, have the checkers return the
warning or warnings.

This makes it easier to use the warnings in different ways, for example,
loading the data in to a database, as you can work with the <lint-warning>
records directly, rather than having to parse the output to determine the
package and location.

* guix/scripts/lint.scm (<lint-warning>): New record type.
(lint-warning): New macro.
(lint-warning?, lint-warning-package, lint-warning-message,
lint-warning-location, package-file, make-warning): New procedures.
(call-with-accumulated-warnings, with-accumulated-warnings): Remove.
(emit-warning): Rename to emit-warnings, and switch to displaying multiple
warnings.
(check-description-style)[check-not-empty-description, check-texinfo-markup,
check-trademarks, check-quotes, check-proper-start,
check-end-of-sentence-space]: Switch to generating a list of warnings, and
using make-warning, rather than emit-warning.
(check-inputs-should-be-native, check-inputs-should-not-be-an-input-at-all):
Switch to generating a list of warnings, and using make-warning, rather than
emit-warning.
(check-synopsis): Switch to generating a list of warnings, and using
make-warning, rather than emit-warning.
[check-not-empty]: Remove, this is handled in the match clause
to avoid other warnings being emitted.
[check-final-period, check-start-article, check-synopsis-length,
check-proper-start, check-start-with-package-name, check-texinfo-markup]:
Switch to generating a list of warnings, and using make-warning, rather than
emit-warning.
[checks]: Remove check-not-empty.
(validate-uri, check-home-page, check-patch-file-names,
check-gnu-synopsis+description): Switch to generating a list of warnings, and
using make-warning, rather than emit-warning.
(check-source): Switch to generating a list of warnings, and using
make-warning, rather than emit-warning.
[try-uris]: Remove.
[warnings-for-uris]: New procedure, replacing try-uris.
(check-source-file-name, check-source-unstable-tarball, check-mirror-url,
check-github-url, check-derivation, check-vulnerabilities, check-for-updates,
report-tabulations, report-trailing-white-space, report-long-line,
report-lone-parentheses, report-formatting-issues, check-formatting): Switch
to generating a list of warnings, and using make-warning, rather than
emit-warning.
(run-checkers): Call emit-warnings on the warnings returned from the checker.
* tests/lint.scm (string-match-or-error, single-lint-warning-message): New
procedures.
(call-with-warnings, with-warnings): Remove.
("description: not a string", "description: not empty", "description: invalid
Texinfo markup", "description: does not start with an upper-case letter",
"description: may start with a digit", "description: may start with lower-case
package name", "description: two spaces after end of sentence", "description:
end-of-sentence detection with abbreviations", "description: may not contain
trademark signs: ™", "description: may not contain trademark signs: ®",
"description: suggest ornament instead of quotes", "synopsis: not a string",
"synopsis: not empty", "synopsis: valid Texinfo markup", "synopsis: does not
start with an upper-case letter", "synopsis: may start with a digit",
"synopsis: ends with a period", "synopsis: ends with 'etc.'", "synopsis:
starts with 'A'", "synopsis: starts with 'a'", "synopsis: starts with 'an'",
"synopsis: too long", "synopsis: start with package name", "synopsis: start
with package name prefix", "synopsis: start with abbreviation", "inputs:
pkg-config is probably a native input", "inputs: glib:bin is probably a native
input", "inputs: python-setuptools should not be an input at all (input)",
"inputs: python-setuptools should not be an input at all (native-input)",
"inputs: python-setuptools should not be an input at all (propagated-input)",
"patches: file names", "patches: file name too long", "patches: not found",
"derivation: invalid arguments", "license: invalid license", "home-page: wrong
home-page", "home-page: invalid URI", "home-page: host not found", "home-page:
Connection refused", "home-page: 200", "home-page: 200 but short length",
"home-page: 404", "home-page: 301, invalid", "home-page: 301 -> 200",
"home-page: 301 -> 404", "source-file-name", "source-file-name: v prefix",
"source-file-name: bad checkout", "source-file-name: good checkout",
"source-file-name: valid", "source-unstable-tarball",
"source-unstable-tarball: source #f", "source-unstable-tarball: valid",
"source-unstable-tarball: package named archive", "source-unstable-tarball:
not-github", "source-unstable-tarball: git-fetch", "source: 200", "source: 200
but short length", "source: 404", "source: 301 -> 200", "source: 301 -> 404",
"mirror-url", "mirror-url: one suggestion", "github-url", "github-url: one
suggestion", "github-url: already the correct github url", "cve", "cve: one
vulnerability", "cve: one patched vulnerability", "cve: known safe from
vulnerability", "cve: vulnerability fixed in replacement version", "cve:
patched vulnerability in replacement", "formatting: lonely parentheses",
"formatting: alright"): Change test-assert to test-equal, and adjust to work
with the changes above.
("formatting: tabulation", "formatting: trailing white space", "formatting:
long line"): Use string-match-or-error rather than string-contains.
2019-07-15 22:32:18 +01:00
..
container
import import: opam: Add recursive option. 2019-01-07 22:05:43 +01:00
system ui: Add 'display-search-results' and use it. 2019-06-27 11:14:41 +02:00
archive.scm Avoid name clash with 'build' from (guix store) and (guix status). 2019-02-11 23:23:28 +01:00
authenticate.scm Switch to Guile-Gcrypt. 2018-09-04 17:25:11 +02:00
build.scm guix build: '--log-file' no longer returns several log files. 2019-06-23 19:53:03 +02:00
challenge.scm substitute: Select the best compression methods. 2019-06-02 22:01:57 +02:00
container.scm scripts: Add missing -V option to commands that document it. 2018-07-07 18:10:31 +02:00
copy.scm Avoid name clash with 'build' from (guix store) and (guix status). 2019-02-11 23:23:28 +01:00
deploy.scm Add 'guix deploy'. 2019-07-06 02:10:04 -04:00
describe.scm describe: Provide a hint when origin detection fails. 2019-04-28 22:57:06 +02:00
download.scm scripts: Fix typo. 2019-01-17 17:58:35 +01:00
edit.scm edit: Use 'specification->location' to read information from the cache. 2019-01-15 20:24:09 +01:00
environment.scm scripts: environment: Add --no-cwd. 2019-07-08 10:33:20 -04:00
gc.scm guix gc: Correctly handle '--delete-generations' with no arguments. 2019-07-11 23:13:26 +02:00
graph.scm graph: Use 'derivation-input-derivation'. 2019-06-27 11:14:41 +02:00
hash.scm guix hash: Fix version and help messages 2018-11-28 10:39:58 +01:00
import.scm guix: Add opam importer. 2018-07-10 10:11:01 +02:00
install.scm guix package: Add 'install', 'remove', and 'upgrade' aliases. 2019-04-29 10:13:44 +02:00
lint.scm scripts: lint: Handle warnings with a record type. 2019-07-15 22:32:18 +01:00
offload.scm syscalls: Add 'with-file-lock' macro. 2019-06-05 23:10:36 +02:00
pack.scm pack: 'squashfs' backend records the profile's search paths. 2019-07-04 18:05:02 +02:00
package.scm guix gc: Correctly handle '--delete-generations' with no arguments. 2019-07-11 23:13:26 +02:00
perform-download.scm perform-download: Optionally report a "download-progress" trace. 2018-09-27 23:21:53 +02:00
processes.scm processes: Gracefully handle daemons without clients. 2019-04-29 21:54:10 +02:00
publish.scm publish: Work around Guile 2.2.5 (web server) bug. 2019-06-24 17:50:08 +02:00
pull.scm guix gc: Correctly handle '--delete-generations' with no arguments. 2019-07-11 23:13:26 +02:00
refresh.scm refresh: Update the source code URL. 2019-03-27 14:59:42 +01:00
remove.scm guix package: Add 'install', 'remove', and 'upgrade' aliases. 2019-04-29 10:13:44 +02:00
repl.scm Add (guix repl). 2019-07-04 18:05:02 +02:00
search.scm guix package: Add 'guix search' alias. 2019-04-29 12:19:24 +02:00
size.scm size: Optimize dependency size computation. 2019-04-07 11:36:00 +02:00
substitute.scm substitute: Select the best compression methods. 2019-06-02 22:01:57 +02:00
system.scm guix gc: Correctly handle '--delete-generations' with no arguments. 2019-07-11 23:13:26 +02:00
upgrade.scm guix package: Add 'install', 'remove', and 'upgrade' aliases. 2019-04-29 10:13:44 +02:00
weather.scm substitute: Select the best compression methods. 2019-06-02 22:01:57 +02:00