Skip to content
This repository has been archived by the owner on Jul 8, 2019. It is now read-only.

LCOV scanner not using sources folder for relative path resolution #181

Open
rbrogan-git opened this issue Nov 6, 2017 · 0 comments
Open

Comments

@rbrogan-git
Copy link

First off thanks for the great plugin. I am using the v1.1 version.
My project structure is as follows:
image

I am using Istanbul for code coverage so it uses relative paths for the source file.
The scanner is executed from the gitroot. It is a project in VSTS.
I am using the sonarqube source setting to restrict the code scanning to project3.

I get the below error:
2017-10-31T19:53:04.3481023Z INFO: Analysing [F:\agentInteractive_work\1\s\project3\coverage\coverage.lcov]
2017-10-31T19:53:04.4574569Z ##[error]WARN: Could not resolve 101 file paths in [F:\agentInteractive_work\1\s\project3\coverage\coverage.lcov], first unresolved path: ClientApp\app\modules\utility.module.ts

So it finds the lcov file but it cannot resolve the sources because it seems to be looking in gitroot for ClientApp but ClientApp is in the project3 folder.

I tried moving files in different places, changing the source to root and several other configurations. But is seems that there was no way to get the source folder "project3" appended to the front of the file name so the scanner could find it.

I looked at the relavent code here. https://github.com/Pablissimo/SonarTsPlugin/blob/master/src/main/java/com/pablissimo/sonar/LCOVParserImpl.java
On line 156 I see the comment that relative paths are considered from the project root.
Can we add a check for project root + source folder + relative path in the loadCurrentFileData method?

I would do a pull request but I am not that familiar with the sonarqube context.fileSystem object model.

Thanks,
Roger

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant