pycobertura icon indicating copy to clipboard operation
pycobertura copied to clipboard

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

Open ericnordelo opened this issue 2 years ago • 5 comments

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

ericnordelo avatar Oct 18 '22 12:10 ericnordelo

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.

aconrad avatar Oct 18 '22 13:10 aconrad

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

ericnordelo avatar Oct 18 '22 15:10 ericnordelo

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

gro1m avatar Oct 22 '22 22:10 gro1m

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.

ericnordelo avatar Oct 22 '22 23:10 ericnordelo

@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?

aconrad avatar Oct 24 '22 18:10 aconrad