Skip to content

Commit

Permalink
Add custom analysis rulesets
Browse files Browse the repository at this point in the history
  • Loading branch information
jnyrup committed Apr 25, 2018
1 parent 418842b commit d876340
Show file tree
Hide file tree
Showing 20 changed files with 106 additions and 2 deletions.
48 changes: 48 additions & 0 deletions Rules.ruleset
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="Rules for Fluent Assertions" Description="Code analysis rules for Fluent Assertions." ToolsVersion="15.0">
<IncludeAll Action="Warning" />
<Rules AnalyzerId="Microsoft.CodeAnalysis.CSharp" RuleNamespace="Microsoft.CodeAnalysis.CSharp">
<Rule Id="CS0162" Action="Error" />
<Rule Id="CS0183" Action="Error" />
<Rule Id="CS0184" Action="Error" />
<Rule Id="CS0464" Action="Error" />
<Rule Id="CS0472" Action="Error" />
<Rule Id="CS0652" Action="Error" />
<Rule Id="CS0659" Action="Error" />
<Rule Id="CS0728" Action="Error" />
<Rule Id="CS1717" Action="Error" />
<Rule Id="CS1718" Action="Error" />
<Rule Id="CS1720" Action="Error" />
</Rules>
<Rules AnalyzerId="Microsoft.CodeAnalysis.CSharp.Features" RuleNamespace="Microsoft.CodeAnalysis.CSharp.Features">
<Rule Id="IDE0035" Action="Error" />
<Rule Id="IDE0007" Action="None" />
</Rules>
<Rules AnalyzerId="Microsoft.CodeAnalysis.Features" RuleNamespace="Microsoft.CodeAnalysis.Features">
<Rule Id="IDE0010" Action="Warning" />
<Rule Id="IDE0033" Action="Info" />
</Rules>
<Rules AnalyzerId="Roslynator.CSharp.Analyzers" RuleNamespace="Roslynator.CSharp.Analyzers">
<Rule Id="RCS1080" Action="None" />
<Rule Id="RCS1102" Action="None" />
<Rule Id="RCS1119" Action="None" />
<Rule Id="RCS1141" Action="None" />
<Rule Id="RCS1142" Action="None" />
<Rule Id="RCS1171" Action="Hidden" />
</Rules>
<Rules AnalyzerId="U2UConsult.CodeAnalyzers" RuleNamespace="U2UConsult.CodeAnalyzers">
<Rule Id="U2U1000" Action="None" />
<Rule Id="U2U1001" Action="None" />
<Rule Id="U2U1002" Action="None" />
<Rule Id="U2U1003" Action="None" />
<Rule Id="U2U1010" Action="None" />
<Rule Id="U2U1022" Action="None" />
<Rule Id="U2U1101" Action="None" />
<Rule Id="U2U1103" Action="None" />
<Rule Id="U2U1104" Action="None" />
<Rule Id="U2U1105" Action="None" />
<Rule Id="U2U1108" Action="None" />
<Rule Id="U2U1201" Action="Hidden" />
<Rule Id="U2U1202" Action="None" />
</Rules>
</RuleSet>
1 change: 1 addition & 0 deletions Src/FluentAssertions/FluentAssertions.csproj
Expand Up @@ -7,6 +7,7 @@
<NoWarn>1701;1702;1705;1591;1574;1572;1573;419</NoWarn>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<CodeAnalysisRuleSet>..\..\Rules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net45'">
<DefineConstants>NET45</DefineConstants>
Expand Down
25 changes: 25 additions & 0 deletions TestRules.ruleset
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="Rules for Fluent Assertions" Description="Code analysis rules for Fluent Assertions." ToolsVersion="15.0">
<Include Path="Rules.ruleset" Action="Default" />
<Rules AnalyzerId="Microsoft.CodeAnalysis.CSharp" RuleNamespace="Microsoft.CodeAnalysis.CSharp">
</Rules>
<Rules AnalyzerId="Microsoft.CodeAnalysis.CSharp.Features" RuleNamespace="Microsoft.CodeAnalysis.CSharp.Features">
</Rules>
<Rules AnalyzerId="Microsoft.CodeAnalysis.Features" RuleNamespace="Microsoft.CodeAnalysis.Features">
</Rules>
<Rules AnalyzerId="Roslynator.CSharp.Analyzers" RuleNamespace="Roslynator.CSharp.Analyzers">
<Rule Id="RCS1079" Action="None" />
<Rule Id="RCS1118" Action="None" />
<Rule Id="RCS1163" Action="None" />
<Rule Id="RCS1170" Action="None" />
<Rule Id="RCS1194" Action="None" />
<Rule Id="RCS1213" Action="None" />
</Rules>
<Rules AnalyzerId="U2UConsult.CodeAnalyzers" RuleNamespace="U2UConsult.CodeAnalyzers">
<Rule Id="U2U1005" Action="None" />
<Rule Id="U2U1018" Action="None" />
<Rule Id="U2U1019" Action="None" />
<Rule Id="U2U1020" Action="None" />
<Rule Id="U2U1200" Action="None" />
</Rules>
</RuleSet>
1 change: 1 addition & 0 deletions Tests/AssemblyA/AssemblyA.csproj
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net45;netstandard1.3</TargetFrameworks>
<CodeAnalysisRuleSet>..\..\Rules.ruleset</CodeAnalysisRuleSet>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions Tests/AssemblyB/AssemblyB.csproj
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net45;netstandard1.3</TargetFrameworks>
<CodeAnalysisRuleSet>..\..\Rules.ruleset</CodeAnalysisRuleSet>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion Tests/Net45.Specs/Net45.Specs.csproj
Expand Up @@ -4,7 +4,7 @@
<AssemblyName>FluentAssertions.Net45.Specs</AssemblyName>
<RootNamespace>FluentAssertions.Net45.Specs</RootNamespace>
<DefineConstants>$(DefineConstants);NET45</DefineConstants>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSet>..\..\TestRules.ruleset</CodeAnalysisRuleSet>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Tests/Net47.Specs/Net47.Specs.csproj
Expand Up @@ -4,7 +4,7 @@
<AssemblyName>FluentAssertions.Net47.Specs</AssemblyName>
<RootNamespace>FluentAssertions.Net47.Specs</RootNamespace>
<DefineConstants>$(DefineConstants);NET47</DefineConstants>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSet>..\..\TestRules.ruleset</CodeAnalysisRuleSet>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions Tests/NetCore.Specs/NetCore.Specs.csproj
Expand Up @@ -3,6 +3,7 @@
<TargetFramework>netcoreapp1.1</TargetFramework>
<AssemblyName>FluentAssertions.NetCore.Specs</AssemblyName>
<RootNamespace>FluentAssertions.NetCore.Specs</RootNamespace>
<CodeAnalysisRuleSet>..\..\TestRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="FakeItEasy" Version="4.5.1" />
Expand Down
1 change: 1 addition & 0 deletions Tests/NetCore13.Specs/NetCore13.Specs.csproj
Expand Up @@ -4,6 +4,7 @@
<AssemblyName>FluentAssertions.NetCore13.Specs</AssemblyName>
<RootNamespace>FluentAssertions.NetCore13.Specs</RootNamespace>
<DefineConstants>NETSTANDARD1_3</DefineConstants>
<CodeAnalysisRuleSet>..\..\TestRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="FakeItEasy" Version="4.5.1" />
Expand Down
1 change: 1 addition & 0 deletions Tests/NetCore20.Specs/NetCore20.Specs.csproj
Expand Up @@ -3,6 +3,7 @@
<TargetFramework>netcoreapp2.0</TargetFramework>
<AssemblyName>FluentAssertions.NetCore20.Specs</AssemblyName>
<RootNamespace>FluentAssertions.NetCore20.Specs</RootNamespace>
<CodeAnalysisRuleSet>..\..\TestRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="FakeItEasy" Version="4.5.1" />
Expand Down
1 change: 1 addition & 0 deletions Tests/TestFrameworks/MSTestV2.Specs/MSTestV2.Specs.csproj
Expand Up @@ -3,6 +3,7 @@
<TargetFramework>netcoreapp1.1</TargetFramework>
<RootNamespace>MSTestV2.Specs</RootNamespace>
<AssemblyName>MSTestV2.Specs</AssemblyName>
<CodeAnalysisRuleSet>..\..\..\TestRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Src\FluentAssertions\FluentAssertions.csproj" />
Expand Down
1 change: 1 addition & 0 deletions Tests/TestFrameworks/MSpec.Specs/MSpec.Specs.csproj
Expand Up @@ -3,6 +3,7 @@
<TargetFrameworks>netcoreapp1.1</TargetFrameworks>
<RootNamespace>MSpec.Specs</RootNamespace>
<AssemblyName>MSpec.Specs</AssemblyName>
<CodeAnalysisRuleSet>Rules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Src\FluentAssertions\FluentAssertions.csproj" />
Expand Down
16 changes: 16 additions & 0 deletions Tests/TestFrameworks/MSpec.Specs/Rules.ruleset
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="Rules for Fluent Assertions" Description="Code analysis rules for Fluent Assertions." ToolsVersion="15.0">
<Include Path="..\..\..\TestRules.ruleset" Action="Default" />
<Rules AnalyzerId="Microsoft.CodeAnalysis.CSharp" RuleNamespace="Microsoft.CodeAnalysis.CSharp">
</Rules>
<Rules AnalyzerId="Microsoft.CodeAnalysis.CSharp.Features" RuleNamespace="Microsoft.CodeAnalysis.CSharp.Features">
</Rules>
<Rules AnalyzerId="Microsoft.CodeAnalysis.Features" RuleNamespace="Microsoft.CodeAnalysis.Features">
</Rules>
<Rules AnalyzerId="Roslynator.CSharp.Analyzers" RuleNamespace="Roslynator.CSharp.Analyzers">
<Rule Id="RCS1018" Action="None" />
<Rule Id="RCS1169" Action="None" />
</Rules>
<Rules AnalyzerId="U2UConsult.CodeAnalyzers" RuleNamespace="U2UConsult.CodeAnalyzers">
</Rules>
</RuleSet>
Expand Up @@ -3,6 +3,7 @@
<TargetFramework>net451</TargetFramework>
<RootNamespace>NSpec.Specs</RootNamespace>
<AssemblyName>NSpec.Specs</AssemblyName>
<CodeAnalysisRuleSet>..\..\..\TestRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Src\FluentAssertions\FluentAssertions.csproj" />
Expand Down
Expand Up @@ -3,6 +3,7 @@
<TargetFramework>net451</TargetFramework>
<RootNamespace>NSpec2.Specs</RootNamespace>
<AssemblyName>NSpec2.Specs</AssemblyName>
<CodeAnalysisRuleSet>..\..\..\TestRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Src\FluentAssertions\FluentAssertions.csproj" />
Expand Down
Expand Up @@ -3,6 +3,7 @@
<TargetFramework>net451</TargetFramework>
<RootNamespace>NSpec3.Specs</RootNamespace>
<AssemblyName>NSpec3.Specs</AssemblyName>
<CodeAnalysisRuleSet>..\..\..\TestRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Src\FluentAssertions\FluentAssertions.csproj" />
Expand Down
Expand Up @@ -3,6 +3,7 @@
<TargetFramework>net451</TargetFramework>
<RootNamespace>NUnit2.Specs</RootNamespace>
<AssemblyName>NUnit2.Specs</AssemblyName>
<CodeAnalysisRuleSet>..\..\..\TestRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Src\FluentAssertions\FluentAssertions.csproj" />
Expand Down
1 change: 1 addition & 0 deletions Tests/TestFrameworks/NUnit3.Specs/NUnit3.Specs.csproj
Expand Up @@ -3,6 +3,7 @@
<TargetFramework>netcoreapp1.1</TargetFramework>
<RootNamespace>NUnit3.Specs</RootNamespace>
<AssemblyName>NUnit3.Specs</AssemblyName>
<CodeAnalysisRuleSet>..\..\..\TestRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Src\FluentAssertions\FluentAssertions.csproj" />
Expand Down
Expand Up @@ -3,6 +3,7 @@
<TargetFramework>net451</TargetFramework>
<RootNamespace>XUnit.Specs</RootNamespace>
<AssemblyName>XUnit.Specs</AssemblyName>
<CodeAnalysisRuleSet>..\..\..\TestRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Src\FluentAssertions\FluentAssertions.csproj" />
Expand Down
1 change: 1 addition & 0 deletions Tests/TestFrameworks/XUnit2.Specs/XUnit2.Specs.csproj
Expand Up @@ -3,6 +3,7 @@
<TargetFramework>netcoreapp1.1</TargetFramework>
<RootNamespace>XUnit2.Specs</RootNamespace>
<AssemblyName>XUnit2.Specs</AssemblyName>
<CodeAnalysisRuleSet>..\..\..\TestRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Src\FluentAssertions\FluentAssertions.csproj" />
Expand Down

0 comments on commit d876340

Please sign in to comment.