vscode-coverage-gutters: Unable to get coverage to display

I can’t get coverage-gutters to render the gutters. After having done some tracing, I think the issue is in/around renderer.findIntersect(), as it always return “”.

Information about my setup:

  • VS Code: 1.23.0 (OSX 10.13.4)
  • Coverage Gutters: 2.0.0
  • python: 2.7.14
  • python coverage: 4.5.1
  • pytest: 3.5.1
  • pytest-cov: 2.5.1
  • I’m generating cov.xml via pytest --cov=myprojectname --cov-report=xml:cov.xml

Snippet of cov.xml:

<coverage branch-rate="0" branches-covered="0" branches-valid="0" complexity="0" line-rate="0.7871" lines-covered="196" lines-valid="249" timestamp="1525805187668" version="4.5.1">
	<!-- Generated by coverage.py: https://coverage.readthedocs.io -->
	<!-- Based on https://raw.githubusercontent.com/cobertura/web/master/htdocs/xml/coverage-04.dtd -->
	<sources>
		<source>/Users/justfalter/code/myprojectname/myprojectname</source>
	</sources>
	<packages>
		<package branch-rate="0" complexity="0" line-rate="0.7871" name=".">
			<classes>
				<class branch-rate="0" complexity="0" filename="messages.py" line-rate="0.9691" name="messages.py">
					<methods/>
					<lines>
						<line hits="1" number="3"/>
						<line hits="1" number="4"/>
						<line hits="1" number="5"/>
						<line hits="1" number="7"/>
					</lines>
				</class>
			</classes>
		</package>
	</packages>
</coverage>

For example, findTopSectionForEditor calls findIntersect(base: editorFile, comparee: sectionFile):

  • editorFile: ###users###justfalter###code###myprojectname###myprojectname###messages.py
  • sectionFile: messages.py

subInt ends up being messages.py, here: https://github.com/ryanluker/vscode-coverage-gutters/blob/f06458d0ae307118fe6ea54e2efa187dc6bc08e7/src/renderer.ts#L140

But the function always seems to return “” here: https://github.com/ryanluker/vscode-coverage-gutters/blob/f06458d0ae307118fe6ea54e2efa187dc6bc08e7/src/renderer.ts#L142-L144

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 3
  • Comments: 21 (16 by maintainers)

Commits related to this issue

Most upvoted comments

@ryanluker You are correct.

The output is based on, and intended to be compatible with, https://github.com/davglass/lcov-parse This is from https://github.com/vokal/cobertura-parse

lcov-parse is taking it’s file attribute from lcov’s SF part (SF:<absolute path to the source file>)

            case 'SF':
                item.file = parts.slice(1).join(':').trim();

The clean solution is to update cobertura-parse and extend paths to absolute paths. But I also see benefits of adding switch in this project for allowing less strict path matching.

Since I recently made small update in cobertura-parse I will make PR with absolute paths update later today.