Skip to content

Commit

Permalink
update analyzers (#2198)
Browse files Browse the repository at this point in the history
* update analyzers

* remove default case, tests should pass

* fxcop

* cleanup

* testing fix
  • Loading branch information
TimothyMothra authored May 5, 2021
1 parent 4045a98 commit c073221
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
19 changes: 16 additions & 3 deletions .props/Product.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,20 @@

<ItemGroup Condition=" $(OS) == 'Windows_NT'">
<!--Analyzers-->
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="5.0.3">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.3.0">
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.3.2">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.0">
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="3.3.0">
<PackageReference Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="3.3.2">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
</ItemGroup>
Expand All @@ -40,6 +43,16 @@
</ItemGroup>

<PropertyGroup>
<!-- Enable all the latest CA rules from 'Microsoft.CodeAnalysis.NetAnalyzers' as build warnings by default -->

<AnalysisLevel>latest</AnalysisLevel>
<AnalysisMode>AllEnabledByDefault</AnalysisMode>

<!-- This appears to create a conflict between using built-in analyzers and the NuGetPackage. -->
<!--<EnableNETAnalyzers>true</EnableNETAnalyzers>-->



<!--Removing the SRC folder from the output directory-->
<CorePath>$(RelativeOutputPathBase)</CorePath>
<OutputPath>$(BinRoot)\$(Configuration)\$(CorePath)</OutputPath>
Expand Down
2 changes: 2 additions & 0 deletions .rulesets/ApplicationInsightsSDKRules.ruleset
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@
<Rule Id="CA2241" Action="Warning" />
<Rule Id="CA2242" Action="Warning" />
<Rule Id="CA5122" Action="Warning" />
<!-- Suppressing Message "FxCopAnalyzers package has been deprecated in favor of 'Microsoft.CodeAnalysis.NetAnalyzers" because NetAnalyzers does not yet cover as many cases as FxCop -->
<Rule Id="CA9998" Action="None" />
</Rules>
<Rules AnalyzerId="Microsoft.Analyzers.NativeCodeAnalysis" RuleNamespace="Microsoft.Rules.Native">
<Rule Id="C26100" Action="Warning" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,7 @@ public TimeSpan HeartbeatInterval
get => this.interval;
set
{
if (value == null)
{
this.interval = DefaultHeartbeatInterval;
}
else if (value <= MinimumHeartbeatInterval)
if (value <= MinimumHeartbeatInterval)
{
this.interval = MinimumHeartbeatInterval;
}
Expand Down

0 comments on commit c073221

Please sign in to comment.