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
1 changed files with 13 additions and 15 deletions

View File

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