Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.1
-
Fix Version/s: 1.2
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
In .Net, it is possible to add a source file as a link (file is visible in Visual Studio but kept at the original location). When the project is analysed in sonar, the source files are not imported but the violations are there. So it's impossible to know where the violation was found.
In the project file (csproj) the source file is referenced like this:
<ItemGroup>
...
<Compile Include="..\..\..\CrmCommon\AbstractFactory.cs">
<Link>CrmCommon\AbstractFactory.cs</Link>
</Compile>
...
</ItemGroup>
ie: In visual studio I have a folder called CrmCommon that contains the file AbstractFactory.cs, but its location on disk is ..\..\..\CrmCommon\AbstractFactory.cs relative to the project.
We use this functionality to "embed" common code within an Assembly as it is deployed within a database and it needs to be self-contained.
Also it is not possible to exclude the files either (I thought I might at least get rid of the violations if I cannot see where they come from). I tried general patterns like */CrmCommon/.cs without success.
Thanks
I checked out the source code to see if I could fix the problem and submit a patch, and I'm surprised to find a test that makes sure linked resources are ignored.
ModelFactoryTest.testSolutionWithLinks
Is there a reason for this?
I mean for me it makes more sense to include all resources including linked resources. Then if you don't want to see it (it may be part of another sonar project), then simply exclude it.
Cheers