Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Add code analyzers #11

Merged
merged 1 commit into from
May 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add code analyzers
  • Loading branch information
nbarbettini committed May 15, 2018
commit 7c10ccb6e6be3f170942672b791afb8208c88fa6
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@

<ItemGroup>
<ProjectReference Include="..\Okta.AspNet.Abstractions\Okta.AspNet.Abstractions.csproj" />
<PackageReference Include="AsyncUsageAnalyzers" Version="1.0.0-alpha003" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.0-beta007" />
<AdditionalFiles Include="..\stylecop.json" />
</ItemGroup>

<PropertyGroup>
<CodeAnalysisRuleSet>..\OktaSdk.Tests.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>

</Project>
7 changes: 7 additions & 0 deletions Okta.AspNet.Abstractions/Okta.AspNet.Abstractions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@
<ItemGroup>
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="5.2.2" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="5.2.2" />
<PackageReference Include="AsyncUsageAnalyzers" Version="1.0.0-alpha003" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.0-beta007" />
<AdditionalFiles Include="..\stylecop.json" />
</ItemGroup>

<PropertyGroup>
<CodeAnalysisRuleSet>..\OktaSdk.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<AdditionalFiles Include="..\stylecop.json" />
<None Include="Web.Debug.config">
<DependentUpon>Web.config</DependentUpon>
</None>
Expand All @@ -186,8 +187,17 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\AsyncUsageAnalyzers.1.0.0-alpha003\analyzers\dotnet\AsyncUsageAnalyzers.dll" />
<Analyzer Include="..\packages\StyleCop.Analyzers.1.1.0-beta007\analyzers\dotnet\cs\StyleCop.Analyzers.CodeFixes.dll" />
<Analyzer Include="..\packages\StyleCop.Analyzers.1.1.0-beta007\analyzers\dotnet\cs\StyleCop.Analyzers.dll" />
<Analyzer Include="..\packages\xunit.analyzers.0.8.0\analyzers\dotnet\cs\xunit.analyzers.dll" />
</ItemGroup>
<PropertyGroup>
<CodeAnalysisRuleSet>..\OktaSdk.Tests.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
Expand Down
2 changes: 2 additions & 0 deletions Okta.AspNet.WebApi.IntegrationTest/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="AsyncUsageAnalyzers" version="1.0.0-alpha003" targetFramework="net461" developmentDependency="true" />
<package id="Microsoft.AspNet.WebApi" version="5.2.4" targetFramework="net461" />
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.4" targetFramework="net461" />
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.4" targetFramework="net461" />
Expand All @@ -14,6 +15,7 @@
<package id="Microsoft.Owin.Testing" version="4.0.0" targetFramework="net461" />
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net461" />
<package id="Owin" version="1.0" targetFramework="net461" />
<package id="StyleCop.Analyzers" version="1.1.0-beta007" targetFramework="net461" developmentDependency="true" />
<package id="System.IdentityModel.Tokens.Jwt" version="5.2.1" targetFramework="net461" />
<package id="System.Net.Http" version="4.3.3" targetFramework="net461" />
<package id="System.Security.Cryptography.Algorithms" version="4.3.1" targetFramework="net461" />
Expand Down
7 changes: 7 additions & 0 deletions Okta.AspNet/Okta.AspNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@

<ItemGroup>
<ProjectReference Include="..\Okta.AspNet.Abstractions\Okta.AspNet.Abstractions.csproj" />
<PackageReference Include="AsyncUsageAnalyzers" Version="1.0.0-alpha003" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.0-beta007" />
<AdditionalFiles Include="..\stylecop.json" />
</ItemGroup>

<PropertyGroup>
<CodeAnalysisRuleSet>..\OktaSdk.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AsyncUsageAnalyzers" Version="1.0.0-alpha003" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.5" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="2.0.2" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.0.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.2" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.0-beta007" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="Xunit.AspNetCore.Integration" Version="1.0.3" />
<PackageReference Include="xunit.runner.console" Version="2.3.1" />
Expand All @@ -24,8 +26,13 @@
<ItemGroup>
<ProjectReference Include="..\Okta.AspNet.Abstractions\Okta.AspNet.Abstractions.csproj" />
<ProjectReference Include="..\Okta.AspNetCore\Okta.AspNetCore.csproj" />
<AdditionalFiles Include="..\stylecop.json" />
</ItemGroup>

<PropertyGroup>
<CodeAnalysisRuleSet>..\OktaSdk.Tests.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>

<ItemGroup>
<Content Update="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="AsyncUsageAnalyzers" Version="1.0.0-alpha003" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.5" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.2" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.0-beta007" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="Xunit.AspNetCore.Integration" Version="1.0.3" />
<PackageReference Include="xunit.runner.console" Version="2.3.1" />
Expand All @@ -26,6 +28,11 @@
<ItemGroup>
<ProjectReference Include="..\Okta.AspNet.Abstractions\Okta.AspNet.Abstractions.csproj" />
<ProjectReference Include="..\Okta.AspNetCore\Okta.AspNetCore.csproj" />
<AdditionalFiles Include="..\stylecop.json" />
</ItemGroup>

<PropertyGroup>
<CodeAnalysisRuleSet>..\OktaSdk.Tests.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>

</Project>
7 changes: 7 additions & 0 deletions Okta.AspNetCore/Okta.AspNetCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@

<ItemGroup>
<ProjectReference Include="..\Okta.AspNet.Abstractions\Okta.AspNet.Abstractions.csproj" />
<PackageReference Include="AsyncUsageAnalyzers" Version="1.0.0-alpha003" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.0-beta007" />
<AdditionalFiles Include="..\stylecop.json" />
</ItemGroup>

<PropertyGroup>
<CodeAnalysisRuleSet>..\OktaSdk.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>

</Project>
124 changes: 124 additions & 0 deletions OktaSdk.Tests.ruleset
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="Okta SDK Tests" Description=" " ToolsVersion="10.0">
<Rules AnalyzerId="AsyncUsageAnalyzers" RuleNamespace="AsyncUsageAnalyzers">
<Rule Id="AvoidAsyncSuffix" Action="Error" />
<Rule Id="AvoidAsyncVoid" Action="Error" />
<Rule Id="UseAsyncSuffix" Action="None" />
<Rule Id="UseConfigureAwait" Action="None" />
</Rules>

<Rules AnalyzerId="Microsoft.Analyzers.ManagedCodeAnalysis" RuleNamespace="Microsoft.Rules.Managed">
<Rule Id="CA1001" Action="Warning" />
<Rule Id="CA1009" Action="Warning" />
<Rule Id="CA1016" Action="Warning" />
<Rule Id="CA1033" Action="Warning" />
<Rule Id="CA1049" Action="Warning" />
<Rule Id="CA1060" Action="Warning" />
<Rule Id="CA1061" Action="Warning" />
<Rule Id="CA1063" Action="Warning" />
<Rule Id="CA1065" Action="Warning" />
<Rule Id="CA1301" Action="Warning" />
<Rule Id="CA1400" Action="Warning" />
<Rule Id="CA1401" Action="Warning" />
<Rule Id="CA1403" Action="Warning" />
<Rule Id="CA1404" Action="Warning" />
<Rule Id="CA1405" Action="Warning" />
<Rule Id="CA1410" Action="Warning" />
<Rule Id="CA1415" Action="Warning" />
<Rule Id="CA1821" Action="Warning" />
<Rule Id="CA1900" Action="Warning" />
<Rule Id="CA1901" Action="Warning" />
<Rule Id="CA2002" Action="Warning" />
<Rule Id="CA2100" Action="Warning" />
<Rule Id="CA2101" Action="Warning" />
<Rule Id="CA2108" Action="Warning" />
<Rule Id="CA2111" Action="Warning" />
<Rule Id="CA2112" Action="Warning" />
<Rule Id="CA2114" Action="Warning" />
<Rule Id="CA2116" Action="Warning" />
<Rule Id="CA2117" Action="Warning" />
<Rule Id="CA2122" Action="Warning" />
<Rule Id="CA2123" Action="Warning" />
<Rule Id="CA2124" Action="Warning" />
<Rule Id="CA2126" Action="Warning" />
<Rule Id="CA2131" Action="Warning" />
<Rule Id="CA2132" Action="Warning" />
<Rule Id="CA2133" Action="Warning" />
<Rule Id="CA2134" Action="Warning" />
<Rule Id="CA2137" Action="Warning" />
<Rule Id="CA2138" Action="Warning" />
<Rule Id="CA2140" Action="Warning" />
<Rule Id="CA2141" Action="Warning" />
<Rule Id="CA2146" Action="Warning" />
<Rule Id="CA2147" Action="Warning" />
<Rule Id="CA2149" Action="Warning" />
<Rule Id="CA2200" Action="Warning" />
<Rule Id="CA2202" Action="Warning" />
<Rule Id="CA2207" Action="Warning" />
<Rule Id="CA2212" Action="Warning" />
<Rule Id="CA2213" Action="Warning" />
<Rule Id="CA2214" Action="Warning" />
<Rule Id="CA2216" Action="Warning" />
<Rule Id="CA2220" Action="Warning" />
<Rule Id="CA2229" Action="Warning" />
<Rule Id="CA2231" Action="Warning" />
<Rule Id="CA2232" Action="Warning" />
<Rule Id="CA2235" Action="Warning" />
<Rule Id="CA2236" Action="Warning" />
<Rule Id="CA2237" Action="Warning" />
<Rule Id="CA2238" Action="Warning" />
<Rule Id="CA2240" Action="Warning" />
<Rule Id="CA2241" Action="Warning" />
<Rule Id="CA2242" Action="Warning" />
</Rules>

<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
<Rule Id="SA0001" Action="None" />
<Rule Id="SA1000" Action="Error" />
<Rule Id="SA1001" Action="Error" />
<!-- Restore after C# 7 support is added -->
<Rule Id="SA1008" Action="None" />
<Rule Id="SA1021" Action="Error" />
<Rule Id="SA1022" Action="Error" />
<Rule Id="SA1100" Action="Error" />
<Rule Id="SA1101" Action="None"/>
<Rule Id="SA1106" Action="Error" />
<Rule Id="SA1111" Action="Error" />
<Rule Id="SA1112" Action="Error" />
<Rule Id="SA1119" Action="Error" />
<Rule Id="SA1121" Action="Error" />
<Rule Id="SA1122" Action="Error" />
<Rule Id="SA1133" Action="Error" />
<Rule Id="SA1201" Action="None"/>
<Rule Id="SA1202" Action="None"/>
<Rule Id="SA1300" Action="Error" />
<Rule Id="SA1302" Action="Error" />
<Rule Id="SA1303" Action="Error" />
<Rule Id="SA1304" Action="Error" />
<Rule Id="SA1305" Action="Warning" />
<Rule Id="SA1309" Action="None" />
<Rule Id="SA1311" Action="Error" />
<Rule Id="SA1400" Action="Error" />
<Rule Id="SA1401" Action="Error" />
<Rule Id="SA1402" Action="Error" />
<Rule Id="SA1403" Action="Error" />
<Rule Id="SA1404" Action="Error" />
<Rule Id="SA1405" Action="Error" />
<Rule Id="SA1406" Action="Error" />
<Rule Id="SA1407" Action="Error" />
<Rule Id="SA1408" Action="Error" />
<Rule Id="SA1410" Action="Error" />
<Rule Id="SA1411" Action="Error" />
<Rule Id="SA1412" Action="Warning" />
<Rule Id="SA1503" Action="Error" />
<Rule Id="SA1512" Action="None" />
<Rule Id="SA1515" Action="None" />
<Rule Id="SA1600" Action="None" />
<Rule Id="SA1603" Action="Error" />
<Rule Id="SA1609" Action="Warning" />
<Rule Id="SA1633" Action="Warning" /> <!-- Back to Error after MSBuild bug fix (.NET Core 2.0) -->
<Rule Id="SA1636" Action="Error" />
<Rule Id="SA1642" Action="Error" />
<Rule Id="SA1643" Action="Error" />
</Rules>
</RuleSet>
123 changes: 123 additions & 0 deletions OktaSdk.ruleset
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="New Rule Set" Description=" " ToolsVersion="10.0">
<Rules AnalyzerId="AsyncUsageAnalyzers" RuleNamespace="AsyncUsageAnalyzers">
<Rule Id="AvoidAsyncSuffix" Action="Error" />
<Rule Id="AvoidAsyncVoid" Action="Error" />
<Rule Id="UseAsyncSuffix" Action="Error" />
<Rule Id="UseConfigureAwait" Action="Error" />
</Rules>

<Rules AnalyzerId="Microsoft.Analyzers.ManagedCodeAnalysis" RuleNamespace="Microsoft.Rules.Managed">
<Rule Id="CA1001" Action="Warning" />
<Rule Id="CA1009" Action="Warning" />
<Rule Id="CA1016" Action="Warning" />
<Rule Id="CA1033" Action="Warning" />
<Rule Id="CA1049" Action="Warning" />
<Rule Id="CA1060" Action="Warning" />
<Rule Id="CA1061" Action="Warning" />
<Rule Id="CA1063" Action="Warning" />
<Rule Id="CA1065" Action="Warning" />
<Rule Id="CA1301" Action="Warning" />
<Rule Id="CA1400" Action="Warning" />
<Rule Id="CA1401" Action="Warning" />
<Rule Id="CA1403" Action="Warning" />
<Rule Id="CA1404" Action="Warning" />
<Rule Id="CA1405" Action="Warning" />
<Rule Id="CA1410" Action="Warning" />
<Rule Id="CA1415" Action="Warning" />
<Rule Id="CA1821" Action="Warning" />
<Rule Id="CA1900" Action="Warning" />
<Rule Id="CA1901" Action="Warning" />
<Rule Id="CA2002" Action="Warning" />
<Rule Id="CA2100" Action="Warning" />
<Rule Id="CA2101" Action="Warning" />
<Rule Id="CA2108" Action="Warning" />
<Rule Id="CA2111" Action="Warning" />
<Rule Id="CA2112" Action="Warning" />
<Rule Id="CA2114" Action="Warning" />
<Rule Id="CA2116" Action="Warning" />
<Rule Id="CA2117" Action="Warning" />
<Rule Id="CA2122" Action="Warning" />
<Rule Id="CA2123" Action="Warning" />
<Rule Id="CA2124" Action="Warning" />
<Rule Id="CA2126" Action="Warning" />
<Rule Id="CA2131" Action="Warning" />
<Rule Id="CA2132" Action="Warning" />
<Rule Id="CA2133" Action="Warning" />
<Rule Id="CA2134" Action="Warning" />
<Rule Id="CA2137" Action="Warning" />
<Rule Id="CA2138" Action="Warning" />
<Rule Id="CA2140" Action="Warning" />
<Rule Id="CA2141" Action="Warning" />
<Rule Id="CA2146" Action="Warning" />
<Rule Id="CA2147" Action="Warning" />
<Rule Id="CA2149" Action="Warning" />
<Rule Id="CA2200" Action="Warning" />
<Rule Id="CA2202" Action="Warning" />
<Rule Id="CA2207" Action="Warning" />
<Rule Id="CA2212" Action="Warning" />
<Rule Id="CA2213" Action="Warning" />
<Rule Id="CA2214" Action="Warning" />
<Rule Id="CA2216" Action="Warning" />
<Rule Id="CA2220" Action="Warning" />
<Rule Id="CA2229" Action="Warning" />
<Rule Id="CA2231" Action="Warning" />
<Rule Id="CA2232" Action="Warning" />
<Rule Id="CA2235" Action="Warning" />
<Rule Id="CA2236" Action="Warning" />
<Rule Id="CA2237" Action="Warning" />
<Rule Id="CA2238" Action="Warning" />
<Rule Id="CA2240" Action="Warning" />
<Rule Id="CA2241" Action="Warning" />
<Rule Id="CA2242" Action="Warning" />
</Rules>

<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
<Rule Id="SA1000" Action="Error" />
<Rule Id="SA1001" Action="Error" />
<!-- Restore after C# 7 support is added -->
<Rule Id="SA1008" Action="None" />
<Rule Id="SA1021" Action="Error" />
<Rule Id="SA1022" Action="Error" />
<Rule Id="SA1100" Action="Error" />
<Rule Id="SA1101" Action="None"/>
<Rule Id="SA1106" Action="Error" />
<Rule Id="SA1111" Action="Error" />
<Rule Id="SA1112" Action="Error" />
<Rule Id="SA1119" Action="Error" />
<Rule Id="SA1121" Action="Error" />
<Rule Id="SA1122" Action="Error" />
<Rule Id="SA1133" Action="Error" />
<Rule Id="SA1201" Action="None"/>
<Rule Id="SA1202" Action="None"/>
<Rule Id="SA1204" Action="None"/>
<Rule Id="SA1300" Action="Error" />
<Rule Id="SA1302" Action="Error" />
<Rule Id="SA1303" Action="Error" />
<Rule Id="SA1304" Action="Error" />
<Rule Id="SA1305" Action="Warning" />
<Rule Id="SA1309" Action="None" />
<Rule Id="SA1311" Action="Error" />
<Rule Id="SA1400" Action="Error" />
<Rule Id="SA1401" Action="Error" />
<Rule Id="SA1402" Action="Error" />
<Rule Id="SA1403" Action="Error" />
<Rule Id="SA1404" Action="Error" />
<Rule Id="SA1405" Action="Error" />
<Rule Id="SA1406" Action="Error" />
<Rule Id="SA1407" Action="Error" />
<Rule Id="SA1408" Action="Error" />
<Rule Id="SA1410" Action="Error" />
<Rule Id="SA1411" Action="Error" />
<Rule Id="SA1412" Action="Warning" />
<Rule Id="SA1503" Action="Error" />
<Rule Id="SA1512" Action="None" />
<Rule Id="SA1515" Action="None" />
<Rule Id="SA1603" Action="Error" />
<Rule Id="SA1609" Action="Warning" />
<Rule Id="SA1633" Action="Warning" /> <!-- Back to Error after MSBuild bug fix (.NET Core 2.0) -->
<Rule Id="SA1636" Action="Error" />
<Rule Id="SA1642" Action="Error" />
<Rule Id="SA1643" Action="Error" />
</Rules>
</RuleSet>
Loading