aconrad / pycobertura

A code coverage diff tool for Cobertura reports
MIT License
114 stars 39 forks source link

Generate a text report for Terminal with Colors (show command) #161

Open ericnordelo opened 1 year ago

ericnordelo commented 1 year ago

I think it would be helpful to have a reporter for Terminal, showing colors depending on the coverage percentage for each covered file.

aconrad commented 1 year ago

I think it would be helpful to have a reporter for Terminal, showing colors depending on the coverage percentage for each covered file.

We do have one, but it's limited to rendering the summary table. It doesn't render the source code. I agree we should provide the full experience. Thanks for reporting.

Do you want to take a stab at it? I could provide some guidance.

ericnordelo commented 1 year ago

Hi @aconrad. I've just seen colors only in the diff command, not in the show command, am I missing something?

gro1m commented 1 year ago

Hi @ericnordelo Which columns would you like to have in color: for Miss and Missing columns or also user-definable for the Cover column?

ericnordelo commented 1 year ago

I'm thinking of color by row, not by column. For example, red row if coverage is under 60 percent, yellow row if coverage is between 60 and 80, and green row if is greater than 80.

Row representing a file or a directory.

aconrad commented 1 year ago

@ericnordelo oh, you are right. We don't show colors for pycobertura show. The main reasoning is that what is considered "good" or "bad" is personal/subjective. In addition, using the coverage percentage (line rate) as a metric to determine if the code is good or not hasn't proven to be a stable metric. You can read more about it in the FAQ: Why is the number of uncovered lines used as the metric to check if code coverage worsened rather than the line rate?