You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The resolveRemotePaths cannot resolve every path correctly.
To Reproduce
Steps to reproduce the behaviour:
I have a python application, which generated a corbuleta xml report, which was successfully parsed and imported by the extension
The application runs on a docker container, and is copied to an absolute path '/app'
I set the 'resolveRemotePath' setting to ['/app', '']
I am trying to display the coverage
Expected behaviour
The coverage is rendered.
Outcome
The extensions fails to resolve any path, but does not give a warning or error.
I actually found the cause of the bug. The path is resolved with the following function:
sectionfinder.ts:81
private resolveFileName(fileName: string): string {
let potentialFileName = fileName;
const remoteLocalPaths = this.configStore.remotePathResolve;
if (remoteLocalPaths) {
const remoteFragment = remoteLocalPaths[0];
const localFragment = remoteLocalPaths[1];
const paths = fileName.split(remoteFragment);
// If we have a length of two we have a match and can swap the paths
// Note: this is because split will give us an array of two with the first element
// being an empty string and the second being the project path.
if (paths.length === 2) {
potentialFileName = localFragment + paths[1];
}
}
return potentialFileName;
}
In my case, i had a path /app/src/app/my_module.py which should be resolved to src/app/my_module.py.
With remotePathResolve set to ['/app', ''], the '/app' substring is matched two times by .split, causing the
file name resolution to fail.
I could fix the issue by changing the setting to ' ['/app'/src, 'src']', but i had to go through the source code to figure this one out.
Desktop (please complete the following information):
OS: Ubuntu 20.04 64bit
Extension Version v2.9.1
VSCode Version 1.66.2 x64
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
der-schick96
changed the title
resolveRemotePath not working for every path
remotePathResolve not working for every path
Apr 29, 2022
@der-schick96 Thanks for the ticket and the investigation!
Very interesting bug, I agree with your thinking around the issue living in the resolveFileName as well.
I will try to put in some time to make a failing test for this function, that uses the scenario you mentioned above, but in the meantime you can use the workaround you found.
Describe the bug
The resolveRemotePaths cannot resolve every path correctly.
To Reproduce
Steps to reproduce the behaviour:
Expected behaviour
The coverage is rendered.
Outcome
The extensions fails to resolve any path, but does not give a warning or error.
I actually found the cause of the bug. The path is resolved with the following function:
In my case, i had a path /app/src/app/my_module.py which should be resolved to src/app/my_module.py.
With remotePathResolve set to ['/app', ''], the '/app' substring is matched two times by .split, causing the
file name resolution to fail.
I could fix the issue by changing the setting to ' ['/app'/src, 'src']', but i had to go through the source code to figure this one out.
Desktop (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: