Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit e6166ca

Browse files
committed
Set rulesets and code analysis and suppress some special cases
1 parent 7c20770 commit e6166ca

File tree

9 files changed

+57
-38
lines changed

9 files changed

+57
-38
lines changed

common/build.targets

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@
55
<Compile Include="$(SolutionDir)common\SolutionInfo.cs">
66
<Link>Properties\SolutionInfo.cs</Link>
77
</Compile>
8-
<None Include="$(SolutionDir)common\GitHub.ruleset">
9-
<Link>Properties\GitHub.ruleset</Link>
8+
<None Include="$(SolutionDir)common\codeanalysis-release.ruleset">
9+
<Link>Properties\codeanalysis-release.ruleset</Link>
10+
</None>
11+
<None Include="$(SolutionDir)common\codeanalysis-debug.ruleset">
12+
<Link>Properties\codeanalysis-debug.ruleset</Link>
1013
</None>
1114
</ItemGroup>
1215

common/codeanalysis-small.ruleset renamed to common/codeanalysis-debug.ruleset

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,18 @@
9494

9595
<!-- link demand -->
9696
<Rule Id="CA2123" Action="None" />
97+
98+
<!-- disposable -->
99+
<Rule Id="CA1001" Action="None" />
100+
101+
<!-- no we like our event handler signatures thankyouverymuch -->
102+
<Rule Id="CA1009" Action="None" />
103+
104+
<!-- calling TryParse without using its return value is not a crime, Microsoft -->
105+
<Rule Id="CA1806" Action="None" />
106+
107+
<!-- we're returning arrays from properties -->
108+
<Rule Id="CA1819" Action="None" />
97109
</Rules>
98110
<Rules AnalyzerId="Microsoft.CodeAnalysis.CSharp.Features" RuleNamespace="Microsoft.CodeAnalysis.CSharp.Features">
99111
<Rule Id="IDE0001" Action="None" />

common/codeanalysis-full.ruleset renamed to common/codeanalysis-release.ruleset

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,21 @@
8080
<Rule Id="CA2227" Action="None" />
8181
<Rule Id="CA2235" Action="None" />
8282
<Rule Id="IDE001" Action="None" />
83+
84+
<!-- link demand -->
85+
<Rule Id="CA2123" Action="None" />
86+
87+
<!-- disposable -->
88+
<Rule Id="CA1001" Action="None" />
89+
90+
<!-- no we like our event handler signatures thankyouverymuch -->
91+
<Rule Id="CA1009" Action="None" />
92+
93+
<!-- calling TryParse without using its return value is not a crime, Microsoft -->
94+
<Rule Id="CA1806" Action="None" />
95+
96+
<!-- we're returning arrays from properties -->
97+
<Rule Id="CA1819" Action="None" />
8398
</Rules>
8499
<Rules AnalyzerId="Microsoft.CodeAnalysis.CSharp.Features" RuleNamespace="Microsoft.CodeAnalysis.CSharp.Features">
85100
<Rule Id="IDE0001" Action="None" />

common/properties.props

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,15 @@
1212
<UnityDir Condition="$(UnityDir) == '' and Exists('\Applications\Unity\Unity.app\Contents\Managed\UnityEditor.dll')">\Applications\Unity\Unity.app\Contents\Managed\</UnityDir>
1313
<BuildConfig Condition=" '$(BuildConfig)' == '' ">Debug</BuildConfig>
1414
</PropertyGroup>
15+
16+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17+
<CodeAnalysisRuleSet>$(SolutionDir)\common\codeanalysis-debug.ruleset</CodeAnalysisRuleSet>
18+
</PropertyGroup>
19+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
20+
<CodeAnalysisRuleSet>$(SolutionDir)\common\codeanalysis-release.ruleset</CodeAnalysisRuleSet>
21+
</PropertyGroup>
22+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'dev|AnyCPU'">
23+
<CodeAnalysisRuleSet>$(SolutionDir)\common\codeanalysis-debug.ruleset</CodeAnalysisRuleSet>
24+
</PropertyGroup>
25+
1526
</Project>

src/GitHub.Api/GitHub.Api.csproj

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
<NuGetPackageImportStamp>
1818
</NuGetPackageImportStamp>
1919
<OutputPath>..\UnityExtension\Assets\Editor\build\</OutputPath>
20+
<RunCodeAnalysis>true</RunCodeAnalysis>
21+
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
22+
<CodeAnalysisIgnoreGeneratedCode>true</CodeAnalysisIgnoreGeneratedCode>
2023
</PropertyGroup>
2124
<Import Project="..\..\common\properties.props" />
2225
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@@ -26,21 +29,13 @@
2629
<DefineConstants>DEBUG;TRACE</DefineConstants>
2730
<ErrorReport>prompt</ErrorReport>
2831
<WarningLevel>4</WarningLevel>
29-
<RunCodeAnalysis>true</RunCodeAnalysis>
30-
<CodeAnalysisRuleSet>$(SolutionDir)\common\codeanalysis-full.ruleset</CodeAnalysisRuleSet>
31-
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
32-
<CodeAnalysisIgnoreGeneratedCode>true</CodeAnalysisIgnoreGeneratedCode>
3332
</PropertyGroup>
3433
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
3534
<DebugType>pdbonly</DebugType>
3635
<Optimize>true</Optimize>
3736
<DefineConstants>TRACE</DefineConstants>
3837
<ErrorReport>prompt</ErrorReport>
3938
<WarningLevel>4</WarningLevel>
40-
<RunCodeAnalysis>true</RunCodeAnalysis>
41-
<CodeAnalysisRuleSet>$(SolutionDir)\common\codeanalysis-small.ruleset</CodeAnalysisRuleSet>
42-
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
43-
<CodeAnalysisIgnoreGeneratedCode>true</CodeAnalysisIgnoreGeneratedCode>
4439
<BuildConfid>Release</BuildConfid>
4540
</PropertyGroup>
4641
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'dev|AnyCPU'">
@@ -50,10 +45,6 @@
5045
<DefineConstants>TRACE;DEBUG;DEVELOPER_BUILD</DefineConstants>
5146
<ErrorReport>prompt</ErrorReport>
5247
<WarningLevel>4</WarningLevel>
53-
<RunCodeAnalysis>true</RunCodeAnalysis>
54-
<CodeAnalysisRuleSet>$(SolutionDir)\common\codeanalysis-small.ruleset</CodeAnalysisRuleSet>
55-
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
56-
<CodeAnalysisIgnoreGeneratedCode>true</CodeAnalysisIgnoreGeneratedCode>
5748
</PropertyGroup>
5849
<PropertyGroup>
5950
<BuildConfig Condition=" '$(BuildConfig)' == '' ">Debug</BuildConfig>
@@ -109,6 +100,7 @@
109100
<Compile Include="Git\Tasks\GitVersionTask.cs" />
110101
<Compile Include="Git\TreeData.cs" />
111102
<Compile Include="Git\ValidateGitInstallResult.cs" />
103+
<Compile Include="GlobalSuppressions.cs" />
112104
<Compile Include="Helpers\AssemblyResources.cs" />
113105
<Compile Include="Authentication\IKeychain.cs" />
114106
<Compile Include="Authentication\Keychain.cs" />

src/GitHub.Api/GlobalSuppressions.cs

2.35 KB
Binary file not shown.

src/GitHub.Logging/GitHub.Logging.csproj

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,45 +11,35 @@
1111
<AssemblyName>GitHub.Logging</AssemblyName>
1212
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
1313
<FileAlignment>512</FileAlignment>
14+
<OutputPath>..\UnityExtension\Assets\Editor\build\</OutputPath>
15+
<RunCodeAnalysis>true</RunCodeAnalysis>
16+
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
17+
<CodeAnalysisIgnoreGeneratedCode>true</CodeAnalysisIgnoreGeneratedCode>
1418
</PropertyGroup>
19+
<Import Project="..\..\common\properties.props" />
1520
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1621
<PlatformTarget>AnyCPU</PlatformTarget>
1722
<DebugSymbols>true</DebugSymbols>
1823
<DebugType>full</DebugType>
1924
<Optimize>false</Optimize>
20-
<OutputPath>bin\Debug\</OutputPath>
2125
<DefineConstants>DEBUG;TRACE</DefineConstants>
2226
<ErrorReport>prompt</ErrorReport>
23-
<WarningLevel>4</WarningLevel>
24-
<RunCodeAnalysis>true</RunCodeAnalysis>
25-
<CodeAnalysisRuleSet>$(SolutionDir)\common\codeanalysis-full.ruleset</CodeAnalysisRuleSet>
2627
</PropertyGroup>
2728
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2829
<PlatformTarget>AnyCPU</PlatformTarget>
2930
<DebugType>pdbonly</DebugType>
3031
<Optimize>true</Optimize>
31-
<OutputPath>bin\Release\</OutputPath>
3232
<DefineConstants>TRACE</DefineConstants>
3333
<ErrorReport>prompt</ErrorReport>
3434
<WarningLevel>4</WarningLevel>
35-
<RunCodeAnalysis>true</RunCodeAnalysis>
36-
<CodeAnalysisRuleSet>$(SolutionDir)\common\codeanalysis-small.ruleset</CodeAnalysisRuleSet>
37-
<BuildConfid>Release</BuildConfid>
38-
</PropertyGroup>
39-
<PropertyGroup>
40-
<StartupObject />
4135
</PropertyGroup>
4236
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'dev|AnyCPU'">
4337
<PlatformTarget>AnyCPU</PlatformTarget>
4438
<DebugSymbols>true</DebugSymbols>
4539
<DebugType>full</DebugType>
4640
<Optimize>false</Optimize>
47-
<OutputPath>bin\Debug\</OutputPath>
4841
<DefineConstants>DEBUG;TRACE;DEVELOPER_BUILD</DefineConstants>
4942
<ErrorReport>prompt</ErrorReport>
50-
<WarningLevel>4</WarningLevel>
51-
<RunCodeAnalysis>true</RunCodeAnalysis>
52-
<CodeAnalysisRuleSet>$(SolutionDir)\common\codeanalysis-small.ruleset</CodeAnalysisRuleSet>
5343
</PropertyGroup>
5444
<PropertyGroup>
5545
<BuildConfig Condition=" '$(BuildConfig)' == '' ">Debug</BuildConfig>
@@ -65,15 +55,13 @@
6555
<ItemGroup>
6656
<Compile Include="Extensions\ExceptionExtensions.cs" />
6757
<Compile Include="FileLogAdapter.cs" />
58+
<Compile Include="GlobalSuppressions.cs" />
6859
<Compile Include="ILogging.cs" />
6960
<Compile Include="LogAdapterBase.cs" />
7061
<Compile Include="LogFacade.cs" />
7162
<Compile Include="Logging.cs" />
7263
<Compile Include="MultipleLogAdapter.cs" />
7364
<Compile Include="Properties\AssemblyInfo.cs" />
74-
<Compile Include="$(SolutionDir)common\SolutionInfo.cs">
75-
<Link>Properties\SolutionInfo.cs</Link>
76-
</Compile>
7765
<Compile Include="ConsoleLogAdapter.cs" />
7866
</ItemGroup>
7967
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
@@ -84,4 +72,5 @@
8472
<Target Name="AfterBuild">
8573
</Target>
8674
-->
75+
<Import Project="..\..\common\build.targets" />
8776
</Project>
1.73 KB
Binary file not shown.

src/UnityExtension/Assets/Editor/GitHub.Unity/GitHub.Unity.csproj

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
<FileAlignment>512</FileAlignment>
1414
<OutputPath>$(SolutionDir)\unity\TestProject\Assets\Plugins\GitHub\Editor\</OutputPath>
1515
<IntermediateOutputPath>..\..\..\obj\</IntermediateOutputPath>
16+
<RunCodeAnalysis>true</RunCodeAnalysis>
17+
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
18+
<CodeAnalysisIgnoreGeneratedCode>true</CodeAnalysisIgnoreGeneratedCode>
1619
</PropertyGroup>
1720
<Import Project="..\..\..\..\..\common\properties.props" />
1821
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@@ -22,8 +25,6 @@
2225
<DefineConstants>DEBUG;TRACE</DefineConstants>
2326
<ErrorReport>prompt</ErrorReport>
2427
<WarningLevel>4</WarningLevel>
25-
<RunCodeAnalysis>true</RunCodeAnalysis>
26-
<CodeAnalysisRuleSet>$(SolutionDir)\common\codeanalysis-full.ruleset</CodeAnalysisRuleSet>
2728
<LangVersion>4</LangVersion>
2829
</PropertyGroup>
2930
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
@@ -32,8 +33,6 @@
3233
<DefineConstants>TRACE</DefineConstants>
3334
<ErrorReport>prompt</ErrorReport>
3435
<WarningLevel>4</WarningLevel>
35-
<RunCodeAnalysis>true</RunCodeAnalysis>
36-
<CodeAnalysisRuleSet>$(SolutionDir)\common\codeanalysis-small.ruleset</CodeAnalysisRuleSet>
3736
<BuildConfid>Release</BuildConfid>
3837
</PropertyGroup>
3938
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'dev|AnyCPU'">
@@ -43,8 +42,6 @@
4342
<DefineConstants>DEBUG;TRACE;DEVELOPER_BUILD</DefineConstants>
4443
<ErrorReport>prompt</ErrorReport>
4544
<WarningLevel>4</WarningLevel>
46-
<RunCodeAnalysis>true</RunCodeAnalysis>
47-
<CodeAnalysisRuleSet>$(SolutionDir)\common\codeanalysis-small.ruleset</CodeAnalysisRuleSet>
4845
<LangVersion>4</LangVersion>
4946
</PropertyGroup>
5047
<ItemGroup>

0 commit comments

Comments
 (0)