-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add SonarLint exclusion/inclusion IT (#6884)
- Loading branch information
1 parent
887af4c
commit 9c5192e
Showing
20 changed files
with
221 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<AnalysisInput> | ||
<Rules> | ||
</Rules> | ||
<Settings> | ||
<Setting> | ||
<Key>sonar.cs.ignoreHeaderComments</Key> | ||
<Value>true</Value> | ||
</Setting> | ||
<Setting> | ||
<Key>sonar.vbnet.ignoreHeaderComments</Key> | ||
<Value>true</Value> | ||
</Setting> | ||
<Setting> | ||
<Key>sonar.inclusions</Key> | ||
<Value>**/Included/*.cs</Value> | ||
</Setting> | ||
<Setting> | ||
<Key>sonar.exclusions</Key> | ||
<Value>**/ExcludedByExclusion.cs,**/ExcludedByExclusion2.cs</Value> | ||
</Setting> | ||
<Setting> | ||
<Key>sonar.global.exclusions</Key> | ||
<Value>**/ExcludedByGlobalExclusion.cs</Value> | ||
</Setting> | ||
<!-- Test parameters --> | ||
<Setting> | ||
<Key>sonar.test.inclusions</Key> | ||
<Value>**/IncludedTest/*.cs</Value> | ||
</Setting> | ||
<Setting> | ||
<Key>sonar.test.exclusions</Key> | ||
<Value>**/ExcludedByExclusionTest.cs</Value> | ||
</Setting> | ||
<Setting> | ||
<Key>sonar.global.test.exclusions</Key> | ||
<Value>**/ExcludedByGlobalExclusionTest.cs</Value> | ||
</Setting> | ||
</Settings> | ||
</AnalysisInput> |
17 changes: 17 additions & 0 deletions
17
analyzers/its/expected/SonarLintExclusions/SonarLintExclusions--net7.0-S2094.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"issues": [ | ||
{ | ||
"id": "S2094", | ||
"message": "Remove this empty class, write its code or make it an "interface".", | ||
"location": { | ||
"uri": "sources\SonarLintExclusions\SonarLintExclusions\Included\Included.cs", | ||
"region": { | ||
"startLine": 3, | ||
"startColumn": 18, | ||
"endLine": 3, | ||
"endColumn": 26 | ||
} | ||
} | ||
} | ||
] | ||
} |
9 changes: 9 additions & 0 deletions
9
analyzers/its/expected/SonarLintExclusions/SonarLintExclusions--net7.0-S3990.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"issues": [ | ||
{ | ||
"id": "S3990", | ||
"message": "Provide a 'CLSCompliant' attribute for assembly 'SonarLintExclusions'.", | ||
"location": null | ||
} | ||
] | ||
} |
9 changes: 9 additions & 0 deletions
9
analyzers/its/expected/SonarLintExclusions/SonarLintExclusions--net7.0-S3992.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"issues": [ | ||
{ | ||
"id": "S3992", | ||
"message": "Provide a 'ComVisible' attribute for assembly 'SonarLintExclusions'.", | ||
"location": null | ||
} | ||
] | ||
} |
17 changes: 17 additions & 0 deletions
17
analyzers/its/expected/SonarLintExclusions/SonarLintExclusionsTest--net7.0-S2699.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"issues": [ | ||
{ | ||
"id": "S2699", | ||
"message": "Add at least one assertion to this test case.", | ||
"location": { | ||
"uri": "sources\SonarLintExclusions\SonarLintExclusionsTest\IncludedTest\IncludedTest.cs", | ||
"region": { | ||
"startLine": 8, | ||
"startColumn": 21, | ||
"endLine": 8, | ||
"endColumn": 32 | ||
} | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
analyzers/its/sources/SonarLintExclusions/SonarLintExclusions.sln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.6.33417.168 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SonarLintExclusions", "SonarLintExclusions\SonarLintExclusions.csproj", "{F5D0F2AC-2BED-42AA-B219-674F970E8400}" | ||
EndProject | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SonarLintExclusionsTest", "SonarLintExclusionsTest\SonarLintExclusionsTest.csproj", "{0F14329D-7A71-489B-BB85-2B257A866429}" | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{1CF8B86B-6A00-4E05-931E-F278FCFDF1CF}" | ||
ProjectSection(SolutionItems) = preProject | ||
global.json = global.json | ||
EndProjectSection | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{F5D0F2AC-2BED-42AA-B219-674F970E8400}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{F5D0F2AC-2BED-42AA-B219-674F970E8400}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{F5D0F2AC-2BED-42AA-B219-674F970E8400}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{F5D0F2AC-2BED-42AA-B219-674F970E8400}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{0F14329D-7A71-489B-BB85-2B257A866429}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{0F14329D-7A71-489B-BB85-2B257A866429}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{0F14329D-7A71-489B-BB85-2B257A866429}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{0F14329D-7A71-489B-BB85-2B257A866429}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {9FA0AE0B-19EB-4F4F-A69E-5AB50EE8240E} | ||
EndGlobalSection | ||
EndGlobal |
4 changes: 4 additions & 0 deletions
4
...yzers/its/sources/SonarLintExclusions/SonarLintExclusions/Included/ExcludedByExclusion.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
namespace SonarLintExclusions | ||
{ | ||
public class ExcludedByExclusion { } // S2094 | ||
} |
4 changes: 4 additions & 0 deletions
4
...zers/its/sources/SonarLintExclusions/SonarLintExclusions/Included/ExcludedByExclusion2.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
namespace SonarLintExclusions | ||
{ | ||
public class ExcludedByExclusion2 { } // S2094 | ||
} |
4 changes: 4 additions & 0 deletions
4
...its/sources/SonarLintExclusions/SonarLintExclusions/Included/ExcludedByGlobalExclusion.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
namespace SonarLintExclusions | ||
{ | ||
public class ExcludedByGlobalExclusion { } // S2094 | ||
} |
4 changes: 4 additions & 0 deletions
4
analyzers/its/sources/SonarLintExclusions/SonarLintExclusions/Included/Included.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
namespace SonarLintExclusions | ||
{ | ||
public class Included { } // S2094 | ||
} |
4 changes: 4 additions & 0 deletions
4
analyzers/its/sources/SonarLintExclusions/SonarLintExclusions/NotIncluded.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
namespace SonarLintExclusions | ||
{ | ||
public class NotIncluded { } // S2094 | ||
} |
8 changes: 8 additions & 0 deletions
8
analyzers/its/sources/SonarLintExclusions/SonarLintExclusions/SonarLintExclusions.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<SonarUnknownProjectType>true</SonarUnknownProjectType> | ||
</PropertyGroup> | ||
|
||
</Project> |
10 changes: 10 additions & 0 deletions
10
...urces/SonarLintExclusions/SonarLintExclusionsTest/IncludedTest/ExcludedByExclusionTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
namespace SonarLintExclusionsTest | ||
{ | ||
[TestClass] | ||
public class ExcludedByExclusionTest | ||
{ | ||
[TestMethod] | ||
public void TestMethod1() { } | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...SonarLintExclusions/SonarLintExclusionsTest/IncludedTest/ExcludedByGlobalExclusionTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
namespace SonarLintExclusionsTest | ||
{ | ||
[TestClass] | ||
public class ExcludedByGlobalExclusionTest | ||
{ | ||
[TestMethod] | ||
public void TestMethod1() { } | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...zers/its/sources/SonarLintExclusions/SonarLintExclusionsTest/IncludedTest/IncludedTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
namespace SonarLintExclusionsTest | ||
{ | ||
[TestClass] | ||
public class IncludedTest | ||
{ | ||
[TestMethod] | ||
public void TestMethod1() { } | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
analyzers/its/sources/SonarLintExclusions/SonarLintExclusionsTest/NotIncludedTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
namespace SonarLintExclusionsTest | ||
{ | ||
[TestClass] | ||
public class NotIncludedTest | ||
{ | ||
[TestMethod] | ||
public void TestMethod1() { } | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...rs/its/sources/SonarLintExclusions/SonarLintExclusionsTest/SonarLintExclusionsTest.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<IsPackable>false</IsPackable> | ||
<SonarUnknownProjectType>true</SonarUnknownProjectType> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" /> | ||
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" /> | ||
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"sdk": { | ||
"version": "7.0.100", | ||
"rollForward": "latestMinor" | ||
} | ||
} |