kibit icon indicating copy to clipboard operation
kibit copied to clipboard

Proposal to improve reporters

Open jpb opened this issue 9 years ago • 2 comments
trafficstars

  • Replace kibit.reporters/name-to-reporter with a multi-method to allow for different formats to be defined outside of the project
  • Separate the format of the reporters from the contents to allow reporting for #155 to reuse the same reporters with different copy

Something like:

(defmulti report (fn [format prefix infix check-map] format))

(defmethod report :cowsay [_ prefix infix {:keys [file line expr alt]}]
  (printf "
   ________________________________________
 /                                         \
|  At %s:%s:                               |
|  %s:                                     |
|  %s                                      |
|  %s:                                     |
|  %s                                      |
 \                                         /
  ----------------------------------------
         \   ^__^
          \  (oo)\_______
             (__)\       )\/\
                 ||----w |
                 ||     ||" file line prefix expr infix alt))

(report format "Consider using" "instead of" check-map)

If I get a 👍 I'll send a PR over.

jpb avatar Apr 21 '16 04:04 jpb

I like this idea. What would be the mechanics people would use to define other reporters? Create a lein plugin which registers the multi method?

danielcompton avatar Apr 21 '16 05:04 danielcompton

Yes - I think additional formatters would need to be provided as a lein plugin, unless there is another way to have the code loaded at the correct time.

I'll see if I can send a PR over this week.

jpb avatar Apr 24 '16 23:04 jpb