Allow filtering of reports.
This commit is contained in:
parent
286cb96569
commit
31e36f4c6e
|
@ -90,6 +90,7 @@
|
|||
[(log-entry kind msg stx located-stx (? number? pos))
|
||||
(define start (sub1 pos))
|
||||
(define end (+ start (syntax-span stx)))
|
||||
;; When we first create report entries, they have a single sub.
|
||||
(report-entry (list (if (opt-log-entry? l)
|
||||
(opt-report-entry located-stx msg)
|
||||
(missed-opt-report-entry
|
||||
|
|
|
@ -36,6 +36,13 @@
|
|||
(define highlights '())
|
||||
(define color-table #f)
|
||||
|
||||
;; Listof (report-entry -> Bool)
|
||||
;; If any of these predicates return true for a given log entry's
|
||||
;; sub, show it.
|
||||
;; Note: at the point where these are called, report entries have
|
||||
;; a single sub.
|
||||
(define filters (list missed-opt-report-entry? opt-report-entry?))
|
||||
|
||||
(define/private (highlight-entry l)
|
||||
(match l
|
||||
[(report-entry subs start end badness)
|
||||
|
@ -48,7 +55,13 @@
|
|||
(list start end color))]))
|
||||
|
||||
(define/public (add-highlights)
|
||||
(define report (collapse-report (generate-report this)))
|
||||
(define report
|
||||
(collapse-report
|
||||
(for/list ([entry (in-list (generate-report this))]
|
||||
;; At this point, report enties have a single sub.
|
||||
#:when (for/or ([f (in-list filters)])
|
||||
(f (first (report-entry-subs entry)))))
|
||||
entry)))
|
||||
(define max-badness
|
||||
(apply max (cons 0 (map report-entry-badness report))))
|
||||
(unless (= max-badness 0) ; no missed opts, color table code would error
|
||||
|
|
Loading…
Reference in New Issue
Block a user