Skip to content

Commit

Permalink
build(analyzer): replace FxCopAnalyzers with NetAnalyzers (Azure#…
Browse files Browse the repository at this point in the history
…34780)

`FxCopAnalyzers` is obsolete and it's reocmmended to use `NetAnalyzers`. See correponding issue for details.

resolve Azure#34779
  • Loading branch information
archerzz authored Mar 21, 2023
1 parent 4e0314f commit 6bf7b23
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions eng/Directory.Build.Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
-->
<NoWarn>$(NoWarn);CA1812</NoWarn>
<!--
Disable some FxCop rules
Disable some NetAnalyzers rules
-->
<NoWarn>
$(NoWarn);
Expand Down Expand Up @@ -78,7 +78,7 @@

<PropertyGroup>
<EnableClientSdkAnalyzers Condition="'$(IsShippingClientLibrary)' == 'true'">true</EnableClientSdkAnalyzers>
<EnableFxCopAnalyzers Condition="'$(IsShippingClientLibrary)' == 'true'">true</EnableFxCopAnalyzers>
<EnableNetAnalyzers Condition="'$(IsShippingClientLibrary)' == 'true'">true</EnableNetAnalyzers>
<EnableStyleCopAnalyzers Condition="'$(EnableStyleCopAnalyzers)' == '' and '$(IsClientLibrary)' == 'true'">true</EnableStyleCopAnalyzers>
<EnableBannedApiAnalyzers Condition="'$(IsShippingClientLibrary)' == 'true'">true</EnableBannedApiAnalyzers>
<GenerateAPIListing Condition="'$(IsShippingClientLibrary)' == 'true'">true</GenerateAPIListing>
Expand Down
4 changes: 2 additions & 2 deletions eng/Directory.Build.Common.targets
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<Import Project="Versioning.targets" />

Expand Down Expand Up @@ -87,7 +87,7 @@

<PackageReference Condition="'$(EnableClientSdkAnalyzers)' == 'true'" Include="Azure.ClientSdk.Analyzers" PrivateAssets="All" />

<PackageReference Condition="'$(EnableFxCopAnalyzers)' == 'true'" Include="Microsoft.CodeAnalysis.FxCopAnalyzers" PrivateAssets="All" />
<PackageReference Condition="'$(EnableNetAnalyzers)' == 'true'" Include="Microsoft.CodeAnalysis.NetAnalyzers" PrivateAssets="All" />

<PackageReference Condition="'$(EnableBannedApiAnalyzers)' == 'true'" Include="Microsoft.CodeAnalysis.BannedApiAnalyzers" PrivateAssets="All" />

Expand Down
2 changes: 1 addition & 1 deletion eng/Packages.Data.props
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
<PackageReference Update="Microsoft.Azure.AutoRest.CSharp" Version="3.0.0-beta.20230320.5" PrivateAssets="All" />
<PackageReference Update="Azure.ClientSdk.Analyzers" Version="0.1.1-dev.20230131.1" PrivateAssets="All" />
<PackageReference Update="coverlet.collector" Version="1.3.0" PrivateAssets="All" />
<PackageReference Update="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.3.1" PrivateAssets="All" />
<PackageReference Update="Microsoft.CodeAnalysis.NetAnalyzers" Version="7.0.0" PrivateAssets="All" />
<PackageReference Update="Microsoft.CodeAnalysis.BannedApiAnalyzers" Version="3.3.2" PrivateAssets="All" />
<PackageReference Update="Microsoft.DotNet.ApiCompat" Version="5.0.0-beta.20467.1" PrivateAssets="All" />
<PackageReference Update="Microsoft.DotNet.GenAPI" Version="5.0.0-beta.19552.1" PrivateAssets="All" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers">
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; reliability</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ public class HttpPipelineTransportOptions
/// </summary>
public HttpPipelineTransportOptions()
{
// suppress false postive of NetAnalyzers: error CA1416: This call site is reachable on all platforms. 'X509Certificate2' is unsupported on: 'browser'.
#pragma warning disable CA1416
ClientCertificates = new List<X509Certificate2>();
#pragma warning restore CA1416
}

/// <summary>
Expand All @@ -29,6 +32,6 @@ public HttpPipelineTransportOptions()
/// The client certificate collection that will be configured for the transport.
/// </summary>
/// <value></value>
public IList<X509Certificate2> ClientCertificates {get;}
public IList<X509Certificate2> ClientCertificates { get; }
}
}

0 comments on commit 6bf7b23

Please sign in to comment.