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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lack of a formatters interface #178

Open
Drowze opened this issue Aug 10, 2022 · 1 comment
Open

Lack of a formatters interface #178

Drowze opened this issue Aug 10, 2022 · 1 comment

Comments

@Drowze
Copy link

Drowze commented Aug 10, 2022

Hello @grodowski 馃憢

First of all, I'd like to say thank you for this great project! I've been using it extensively for the past year on the CI of a few internal repositories and it's quite handy to me and my peers. Great work!

After some time with undercover however, I feel that it lacks a formatter interface. I see on this line a comment that even hints that a formatter interface was planned: https://github.com/grodowski/undercover/blob/master/lib/undercover/result.rb#L63

    # TODO: create a formatter interface instead and add some tests.

That said, this is something that concerns me so I'd like to help 馃槃 I've been actually working a bit on some changes (which you can check here) that aim de-couple the Result from Formatter - thus allowing other formatters to be used.
I would personally like to see this being possible (which I think is exactly how rubocop handle this):

undercover --require $(pwd)/my_custom_formatter.rb --formatter MyCustomFormatter

# or if the formatter is on a gem and the gem is on the gemfile along with undercover:
bundle exec undercover --formtter MyCustomFormatter

I'm a bit concerned though as this would be a slightly big change - so I'd like to ask your opinion before opening my first PR on this project. What do you think @grodowski? Can I go ahead and try to tackle this one? 馃槃

@grodowski
Copy link
Owner

Hey @Drowze! Thank you for the kind words and your willingness to contribute to the project! This formatter TODO is really old and I couldn't find a good reason to get back to it and implement a formatter class.

I went through your changes and think there are two aspects: one being about decoupling Result and Formatter and the other to provide a formatter argument to the CLI.

I have been usually suggesting pronto and pronto-undercover which provides a --formatter option and comes with a suite of handy ones like github_pr already. So what are the benefits of adding a pretty similar interface to undercover itself? Do you have a use case in mind for when this new option would become available?

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