Add lint-warning-count-by-lint-checker-for-revision
To return counts of lint warnings, grouped by lint checker for a specific revision.
This commit is contained in:
parent
6b9977f62e
commit
75f2c19fc8
1 changed files with 25 additions and 1 deletions
|
|
@ -1,8 +1,10 @@
|
|||
(define-module (guix-data-service model lint-checker)
|
||||
#:use-module (srfi srfi-1)
|
||||
#:use-module (ice-9 match)
|
||||
#:use-module (squee)
|
||||
#:use-module (guix-data-service model utils)
|
||||
#:export (lint-checkers->lint-checker-ids))
|
||||
#:export (lint-checkers->lint-checker-ids
|
||||
lint-warning-count-by-lint-checker-for-revision))
|
||||
|
||||
(define (lint-checkers->lint-checker-ids conn lint-checkers-data)
|
||||
(insert-missing-data-and-return-all-ids
|
||||
|
|
@ -13,3 +15,25 @@
|
|||
(description . ,quote-string)
|
||||
(network_dependent . ,value->sql-boolean))
|
||||
lint-checkers-data))
|
||||
|
||||
(define (lint-warning-count-by-lint-checker-for-revision conn commit-hash)
|
||||
(define query
|
||||
"
|
||||
SELECT lint_checkers.name, lint_checkers.description,
|
||||
lint_checkers.network_dependent, revision_data.count
|
||||
FROM lint_checkers
|
||||
INNER JOIN (
|
||||
SELECT lint_checker_id, COUNT(*)
|
||||
FROM lint_warnings
|
||||
WHERE id IN (
|
||||
SELECT lint_warning_id
|
||||
FROM guix_revision_lint_warnings
|
||||
INNER JOIN guix_revisions
|
||||
ON guix_revision_lint_warnings.guix_revision_id = guix_revisions.id
|
||||
WHERE commit = $1
|
||||
)
|
||||
GROUP BY lint_checker_id
|
||||
) AS revision_data ON lint_checkers.id = revision_data.lint_checker_id
|
||||
ORDER BY count DESC")
|
||||
|
||||
(exec-query conn query (list commit-hash)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue