hi @sconde
Files indexed by the sonar scanner
I see
2020-03-09T13:51:36.7619387Z sonar.projectBaseDir=/home/vsts/work/1/s/redacted
and
2020-03-09T13:51:36.7666720Z B2F834B9-7FC5-4650-A5B4-68D92CA44510.sonar.sources=\
2020-03-09T13:51:36.7667228Z "/home/vsts/work/1/s/redacted/src/redacted.API/Common/APIConstants.cs",\
So the indexed files are in /home/vsts/work/1/s/redacted/src/
.
2020-03-09T13:52:08.7542085Z 13:52:08.753 DEBUG: 'src/redacted.API/DataIngestion/PipelineCreation/AzureSearch/IAzureSearchHelperExtensions.cs' indexed with language 'cs'
The above src
folder is inside /home/vsts/work/1/s/redacted
.
File paths inside the report generated by your code coverage tool
Inside the OpenCover report there are different paths:
2020-03-09T13:52:12.2126721Z 13:52:12.212 DEBUG: Skipping the fileId '1', line '18', vc '0' because file '/home/vsts/work/1/redacted/src/redacted.API/DataIngestion/PipelineCreation/AzureSearch/IAzureSearchHelperExtensions.cs' is not indexed or does not have the supported language.
As you see, the opencover report contains paths inside the folder /home/vsts/work/1/redacted/src/
, without the s
inside (as oposed to the sources).
As far as I can see, it’s exactly the same situation as before . Given the indexed paths are inside /home/vsts/work/1/s/redacted/src/
and the coverage report file contains paths in '/home/vsts/work/1/redacted/src/
- these are two different folders, so the files from the coverage report are not accepted.
Let’s try and find the problem
- Can you collect the coverage report before you do the
sed
operations? - Does the coverage report before you do the
sed
operations contain the path withs
inside? - Can you run the operations on your local machine and debug locally the problem?
The 2 possible problems I see:
- EITHER with your scripts, you move files around during the build process. You run the coverage tool in one folder, then copy the results to the build folder, and because of that the paths are incorrect. You should do all the operations in the same folder, without moving files around.
- OR you run the coverage tool in the same folder where you do the build, but for some reason you modify the paths inside the opencover resulted report and make them incompatible. You should make sure the paths in the opencover report file are consistent with the paths on disk where you do the sonarscanner analysis.