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

The option --show-uncovered does not show the correct line numbers #283

Open
simon-bennett-aql opened this issue Jun 23, 2022 · 3 comments

Comments

@simon-bennett-aql
Copy link

The following command produces different output between the console and the html report.
diff-cover --show-uncovered --html-report diff-report.html coverage.xml

Specifically, the line number is correct in diff-report.html, but incorrect in the terminal output.

-------------
Diff Coverage
Diff: origin/main...HEAD, staged and unstaged changes
-------------
someFile1 (53.8%): Missing lines 221-225,234-239,241
someFile2 (100%)
someFile3 (100%)
someFile4 (87.5%): Missing lines 100-102
someFile5 (72.0%): Missing lines 18-28,30,34-35
-------------
Total:   109 lines
Missing: 29 lines
Coverage: 73%
-------------

--- someFile1 ---

0001:  <-- line numbers are incorrectly numbered as starting from 0001, not 217 which is where they start in the html doc.
0002: 
0003:   
0004: 
0005: 
0006: 
0007: 
0008: 
0009: 
0010: 
0011: 
0012: 
0013: 

Indicative HTML report:
image

@GertBurger
Copy link

This issue is plaguing us also so I had quick look.

It seems that pygment's TerminalFormatter (https://pygments.org/docs/formatters/#TerminalFormatter) is being used in Snippet.terminal() to format the lines for a terminal (colours et al).

This formatter however doesn't support the linenostart option being passed to it, resulting in line 1 always being the starting number.

@mvynhb
Copy link

mvynhb commented Jul 7, 2023

@GertBurger
Is there any progress on this? Would be great to have lines on Markdown and terminal templates if possible.

@GertBurger
Copy link

Not that I know of, the last I heard was what you saw in my PR on pygments.

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

3 participants