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

Enable FxCop Analyzers for the repo #23709

Merged
merged 2 commits into from
Jul 8, 2020
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
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ dotnet_sort_system_directives_first = true
[*.{xml,config,*proj,nuspec,props,resx,targets,yml,tasks}]
indent_size = 2

# Xml config files
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
indent_size = 2

[*.json]
indent_size = 2

Expand Down
216 changes: 216 additions & 0 deletions eng/AllRulesDisabled.ruleset

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions eng/Dependencies.props
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ and are generated based on the last package release.
<LatestPackageReference Include="Microsoft.AspNetCore.AzureAppServices.SiteExtension.3.1.x86" Version="$(MicrosoftAspNetCoreAzureAppServicesSiteExtension31PackageVersion)" />
<LatestPackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Runtime" Version="$(MicrosoftAspNetCoreComponentsWebAssemblyRuntimePackageVersion)" />
<LatestPackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="$(MicrosoftBclAsyncInterfacesPackageVersion)" />
<LatestPackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="$(MicrosoftCodeAnalysisFxCopAnalyzersVersion)" />
Pilchie marked this conversation as resolved.
Show resolved Hide resolved
<LatestPackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="$(MicrosoftEntityFrameworkCoreInMemoryPackageVersion)" />
<LatestPackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="$(MicrosoftEntityFrameworkCoreRelationalPackageVersion)" />
<LatestPackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="$(MicrosoftEntityFrameworkCoreSqlitePackageVersion)" />
Expand Down
1 change: 1 addition & 0 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@
<MicrosoftCodeAnalysisCommonPackageVersion>3.7.0-4.20351.7</MicrosoftCodeAnalysisCommonPackageVersion>
<MicrosoftCodeAnalysisCSharpPackageVersion>3.7.0-4.20351.7</MicrosoftCodeAnalysisCSharpPackageVersion>
<MicrosoftCodeAnalysisCSharpWorkspacesPackageVersion>3.7.0-4.20351.7</MicrosoftCodeAnalysisCSharpWorkspacesPackageVersion>
<MicrosoftCodeAnalysisFxCopAnalyzersVersion>3.0.0</MicrosoftCodeAnalysisFxCopAnalyzersVersion>
<MicrosoftCssParserPackageVersion>1.0.0-20200708.1</MicrosoftCssParserPackageVersion>
<MicrosoftIdentityModelClientsActiveDirectoryPackageVersion>3.19.8</MicrosoftIdentityModelClientsActiveDirectoryPackageVersion>
<MicrosoftIdentityModelLoggingPackageVersion>5.5.0</MicrosoftIdentityModelLoggingPackageVersion>
Expand Down
8 changes: 8 additions & 0 deletions eng/targets/CSharp.Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@
<Import Project="$(RepoRoot)src\Razor\Microsoft.NET.Sdk.Razor\src\build\netstandard2.0\Microsoft.NET.Sdk.Razor.props" />
</ImportGroup>

<ItemGroup Condition=" '$(IsTestProject)' != 'true' AND '$(DotNetBuildFromSource)' != 'true' ">
<Reference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" PrivateAssets="All" />
</ItemGroup>

<PropertyGroup>
<CodeAnalysisRuleSet>$(RepoRoot)eng\AllRulesDisabled.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>

<ItemGroup Condition=" '$(IsTestProject)' == 'true' ">
<Reference Include="Microsoft.AspNetCore.Testing" />
<Reference Include="Moq" />
Expand Down
3 changes: 3 additions & 0 deletions src/Azure/AzureAD/AzureAD.ruleset
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="Rules for AzureAD tests" Description="Code analysis rules for AzureAD tests" ToolsVersion="15.0">

<Include Path="..\..\..\eng\AllRulesDisabled.ruleset" Action="Default" />

<Rules AnalyzerId="xunit.analyzers" RuleNamespace="xunit.analyzers">
<!--
This code is produced when theory parameters that are unused. Normally, this is a warning which causes our build to fail.
Expand Down
27 changes: 27 additions & 0 deletions src/Http/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Description: All Globalization Rules are enabled with default severity.

# Code files
[*.{cs,vb}]

# Globalization Rules

# CA1303: Do not pass literals as localized parameters
#dotnet_diagnostic.CA1303.severity = warning

# CA1304: Specify CultureInfo
#dotnet_diagnostic.CA1304.severity = warning

# CA1305: Specify IFormatProvider
#dotnet_diagnostic.CA1305.severity = warning

# CA1307: Specify StringComparison
#dotnet_diagnostic.CA1307.severity = warning

# CA1308: Normalize strings to uppercase
#dotnet_diagnostic.CA1308.severity = warning

# CA1309: Use ordinal stringcomparison
dotnet_diagnostic.CA1309.severity = warning

# CA2101: Specify marshaling for P/Invoke string arguments
#dotnet_diagnostic.CA2101.severity = warning
26 changes: 0 additions & 26 deletions src/Mvc/.editorconfig
Original file line number Diff line number Diff line change
@@ -1,33 +1,7 @@
# EditorConfig is awesome:http://EditorConfig.org

# top-most EditorConfig file
root = true

# Don't use tabs for indentation.
[*]
indent_style = space
# (Please don't specify an indent_size here; that has too many unintended consequences.)

# Code files
[*.{cs,csx,vb,vbx}]
indent_size = 4

# Xml project files
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
indent_size = 2

# Xml config files
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
indent_size = 2

# JSON files
[*.json]
indent_size = 2

# Dotnet code style settings:
[*.cs]
# Sort using and Import directives with System.* appearing first
dotnet_sort_system_directives_first = true

# Don't use this. qualifier
dotnet_style_qualification_for_field = false:suggestion
Expand Down
26 changes: 0 additions & 26 deletions src/Razor/.editorconfig
Original file line number Diff line number Diff line change
@@ -1,33 +1,7 @@
# EditorConfig is awesome:http://EditorConfig.org

# top-most EditorConfig file
root = true

# Don't use tabs for indentation.
[*]
indent_style = space
# (Please don't specify an indent_size here; that has too many unintended consequences.)

# Code files
[*.{cs,csx,vb,vbx}]
indent_size = 4

# Xml project files
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
indent_size = 2

# Xml config files
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
indent_size = 2

# JSON files
[*.json]
indent_size = 2

# Dotnet code style settings:
[*.cs]
# Sort using and Import directives with System.* appearing first
dotnet_sort_system_directives_first = true

# Don't use this. qualifier
dotnet_style_qualification_for_field = false:suggestion
Expand Down