-
Notifications
You must be signed in to change notification settings - Fork 20
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
Adding Markdown printer #145
Adding Markdown printer #145
Conversation
Hi @skv0zsneg Amazing. Thanks a lot! This is a contribution I (and I guess many others) have been waiting for forever. The bad news are: I won't be able to do a thorough review in the next couple of weeks, but things should clear up mid october. Please do not hesitate to ping me if I have not reviewed the PR by then. Is this ok with you?
This is a surprisingly sensitive topic 😄. Some of our users desperately want print, others want logging to better control the output location (although: yes, I am aware we're still mostly using root logger). I am thus I but unsure what to decide here. I am more and more tending towards having two parameters, one defining the format (text, markdown, ...) of the output, and the other one the location (path on fs, print, logging, ...). Maybe that's a bit much though for now - if you could do that as part of this PR, I'd be happy with having only @HunterMcGushion any thoughts?
Agreed. My suggestion above would fix that, though... Again, thanks for opening the PR! |
Thank you for answering! Alright, I'll tag you here in the middle of October 🫡 About my questions - OK then, I'll add format defining ( |
@skv0zsneg, this looks fantastic! Thank you for putting all this together. I've got a couple minor comments that I'll make as I do my full review, but overall I love it! Thank you, @MiWeiss, for the quick response. I believe we can provide different formatters to In any case, thank you both! And again, amazing work @skv0zsneg! Please expect some review comments over the coming days as I have time. |
@HunterMcGushion thank you for answering! I'm glad for helping this project <3 |
… printer. Change a little output style. Add more tests and fix some of them.
@HunterMcGushion @MiWeiss |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @skv0zsneg
Thanks so much, and sorry for the delay. I started my review. Didn't get to finish it completely yet, and still want to test everything, but I still thought I'd leave you some comments.
(* i do not expect many more comments from myself on that though, I'm quite excited for the feature. However, with @HunterMcGushion now also reviewing I'm only a sidekick-reviewer anyways :-D).
@MiWeiss, can you remind me when someone has specifically wanted to use print instead of logging?
Hmmm... Well, no. I believe it had something to do with the standard formatting of logs and lazyness (aka convenience) of not having to change logging options (which is kind-of annoying when using a cli :-) ). Like, in some settings, INFO logs are suppressed by default. However, now that you're asking, I am not sure anymore, though (might have been my imagination, might have happend in a different library :-) ). Feel free to make your choice! If we ever wanted to change it, it doesn't have to be in this PR, imo.
docstr_coverage/cli.py
Outdated
"--output", | ||
type=click.Choice(["stdout", "file"]), | ||
default="stdout", | ||
help="Format of output", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't really the "format" of the output (that comes from the --format
option. Maybe output target/location/destination. I can't really think of the right word. But this option is used to specify "where" to save the output rather than how to format the output
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You right. I think the destination
with combination of choices (stdout
, file
) clearly saying about param appointment.
Maby change --output
to --destination
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's a good idea. I like --destination
@skv0zsneg, @MiWeiss, do we really need three different printer classes when the inheritance is as straightforward as it is here? It's just |
@HunterMcGushion, sorry for delay! The main reason for this type of class inheritance is the possible future features. For example, the project will need a web server (for some reason, idk), and it needs to have tools for rendering HTML results. So, you can just inherit from the printer and, using simple data structures, get a rendered HTML page. If you think that this reason is weak, I can change inheritance. |
Thanks again, @skv0zsneg! We may need to do some refactoring down the road, but I'll approve/merge once this change is made. |
Hello!
In case of issue #133 and not answered question #133 (comment) and not active PR #134 I took the initiative to implement markdown printer and refactor printers.
I recreated
LegacyPrinter
and addedMarkdownPrinter
by adding base classPrinter
inprinters.py
. Rendered Markdown output look like this:While developing, I got some questions:
logging
. I guess it needs tests intest_coverage.py
. In my realization, I use data structures created withdataclasses
maybe tests can be refactored by using them, and we'll could replacelogging
withprint
?-o
flag saves coverage stat results in the appropriate file with standard output in the terminal?I don't write all unit tests beacuse of questions above. I hope these changes will help the project.