clj-commons / kibit

There's a function for that!
1.76k stars 135 forks source link

Proposal to improve reporters #157

Open jpb opened 8 years ago

jpb commented 8 years ago

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.

danielcompton commented 8 years ago

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?

jpb commented 8 years ago

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.