kibit
kibit copied to clipboard
Proposal to improve reporters
trafficstars
- Replace
kibit.reporters/name-to-reporterwith 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.
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?
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.