Use filter-map rather than filter and map when processing linters

I guess this is a good change in general, but this seems to avoid a long
stack, which when a linter crashes, and the inferior tries to return the
exception details, and apparently hang the inferior/client as the reply isn't
written/read.
This commit is contained in:
Christopher Baines 2021-05-16 20:54:07 +01:00
parent 2a4b16f5e4
commit da0ee9dff0

View file

@ -474,22 +474,20 @@ WHERE job_id = $1")
(cons (cons source-locale source-message) (cons (cons source-locale source-message)
messages-by-locale)))) messages-by-locale))))
(filter (filter-map
(match-lambda (lambda (package-id)
((package-id . warnings) (let* ((package (hashv-ref %package-table package-id))
(not (null? warnings)))) (warnings
(map (map process-lint-warning
(lambda (package-id) (if (and lint-checker-requires-store?-defined?
(let ((package (hashv-ref %package-table package-id))) (lint-checker-requires-store? checker))
(cons
package-id
(map process-lint-warning
(if (and lint-checker-requires-store?-defined?
(lint-checker-requires-store? checker))
(check package #:store store) (check package #:store store)
(check package)))))) (check package)))))
(list ,@(map inferior-package-id packages))))))) (if (null? warnings)
#f
(cons package-id warnings))))
(list ,@(map inferior-package-id packages))))))
(and (and
(or (inferior-eval '(and (resolve-module '(guix lint) #:ensure #f) (or (inferior-eval '(and (resolve-module '(guix lint) #:ensure #f)