Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal to improve reporters #157

Open
jpb opened this issue Apr 21, 2016 · 2 comments
Open

Proposal to improve reporters #157

jpb opened this issue Apr 21, 2016 · 2 comments

Comments

@jpb
Copy link
Contributor

jpb commented Apr 21, 2016

  • 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 Automatic replacement of suggestions #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.

@danielcompton
Copy link
Member

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
Copy link
Contributor Author

jpb commented Apr 24, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants