Display counts of lint warnings on the revision page

This commit is contained in:
Christopher Baines 2019-08-31 12:42:54 +01:00
parent 75f2c19fc8
commit 3a79449974
2 changed files with 34 additions and 3 deletions

View file

@ -41,6 +41,7 @@
#:use-module (guix-data-service model derivation)
#:use-module (guix-data-service model build-status)
#:use-module (guix-data-service model build)
#:use-module (guix-data-service model lint-checker)
#:use-module (guix-data-service jobs load-new-guix-revision)
#:use-module (guix-data-service web render)
#:use-module (guix-data-service web sxml)
@ -105,7 +106,9 @@
(derivations-counts
(count-packages-derivations-in-revision conn commit-hash))
(jobs-and-events
(select-jobs-and-events-for-commit conn commit-hash)))
(select-jobs-and-events-for-commit conn commit-hash))
(lint-warning-counts
(lint-warning-count-by-lint-checker-for-revision conn commit-hash)))
(case (most-appropriate-mime-type
'(application/json text/html)
mime-types)
@ -118,7 +121,13 @@
`((system . ,system)
(target . ,target)
(derivation_count . ,derivation_count))))
derivations-counts))))
derivations-counts)))
(lint_warning_counts . ,(map (match-lambda
((name description network-dependent count)
`(,name . ((description . ,description)
(network_dependent . ,(string=? network-dependent "t"))
(count . ,(string->number count))))))
lint-warning-counts)))
#:extra-headers http-headers-for-unchanging-content))
(else
(render-html
@ -128,6 +137,7 @@
git-repositories-and-branches
derivations-counts
jobs-and-events
lint-warning-counts
#:path-base path-base
#:header-text header-text)
#:extra-headers http-headers-for-unchanging-content)))))

View file

@ -450,9 +450,29 @@
'())))))
jobs-and-events)))))
(define (view-revision/lint-warning-counts lint-warning-counts)
`((h3 "Lint warnings")
(table
(@ (class "table"))
(thead
(tr
(th "Linter")
(th "Count")))
(tbody
,@(map (match-lambda
((name description network-dependent count)
`(tr
(td (span (@ (style "font-family: monospace; display: block;"))
,name)
(p (@ (style "margin: 6px 0 0px;"))
,description))
(td ,count))))
lint-warning-counts)))))
(define* (view-revision commit-hash packages-count
git-repositories-and-branches derivations-count
jobs-and-events
lint-warning-counts
#:key (path-base "/revision/")
header-text)
(layout
@ -481,7 +501,8 @@
'()
(view-revision/git-repositories git-repositories-and-branches
commit-hash))
,@(view-revision/jobs-and-events jobs-and-events))
,@(view-revision/jobs-and-events jobs-and-events)
,@(view-revision/lint-warning-counts lint-warning-counts))
(div
(@ (class "col-md-6"))
(h3 "Derivations")