Skip to content

Commit 9d7d47b

Browse files
Chris Martinezcommonsensesoftware
authored andcommitted
Update code analysis and fix new violations
1 parent 84028c7 commit 9d7d47b

File tree

13 files changed

+52
-46
lines changed

13 files changed

+52
-46
lines changed

.editorconfig

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,28 @@ csharp_space_after_cast = true
8686
csharp_space_after_keywords_in_control_flow_statements = true
8787
csharp_space_between_method_declaration_parameter_list_parentheses = true
8888
csharp_space_between_method_call_parameter_list_parentheses = true
89-
csharp_space_between_parentheses = control_flow_statements, expressions
89+
csharp_space_between_parentheses = control_flow_statements, expressions
90+
91+
# ide code suppressions
92+
dotnet_diagnostic.IDE0079.severity = none
93+
94+
# style code suppressions
95+
dotnet_diagnostic.SA1002.severity = none
96+
dotnet_diagnostic.SA1003.severity = none
97+
dotnet_diagnostic.SA1008.severity = none
98+
dotnet_diagnostic.SA1009.severity = none
99+
dotnet_diagnostic.SA1101.severity = none
100+
dotnet_diagnostic.SA1127.severity = none
101+
dotnet_diagnostic.SA1128.severity = none
102+
dotnet_diagnostic.SA1201.severity = none
103+
dotnet_diagnostic.SA1202.severity = none
104+
dotnet_diagnostic.SA1204.severity = none
105+
dotnet_diagnostic.SA1205.severity = none
106+
dotnet_diagnostic.SA1208.severity = none
107+
dotnet_diagnostic.SA1217.severity = none
108+
dotnet_diagnostic.SA1311.severity = none
109+
dotnet_diagnostic.SA1400.severity = none
110+
dotnet_diagnostic.SA1502.severity = none
111+
dotnet_diagnostic.SA1516.severity = none
112+
dotnet_diagnostic.SA1600.severity = none
113+
dotnet_diagnostic.SA1633.severity = none

ApiVersioning.sln

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{2BB57808
110110
ProjectSection(SolutionItems) = preProject
111111
after.apiversioning.sln.targets = after.apiversioning.sln.targets
112112
build\code-analysis.props = build\code-analysis.props
113-
build\code-analysis.ruleset = build\code-analysis.ruleset
114113
build\common.props = build\common.props
115114
build\file-version.targets = build\file-version.targets
116115
build\icon.png = build\icon.png

build/code-analysis.props

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,15 @@
22
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33

44
<PropertyGroup Label="Code Analysis">
5-
<Features>IOperation</Features>
5+
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
66
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
7-
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)code-analysis.ruleset</CodeAnalysisRuleSet>
87
</PropertyGroup>
98

109
<ItemGroup Label="Code Analysis">
1110
<AdditionalFiles Include="$(MSBuildThisFileDirectory)stylecop.json" Link="stylecop.json" Visible="false" />
1211
</ItemGroup>
1312

1413
<ItemGroup Label="NuGet">
15-
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.0" PrivateAssets="All" />
16-
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.3.0" PrivateAssets="All" />
1714
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-*" PrivateAssets="All" />
1815
</ItemGroup>
1916

build/code-analysis.ruleset

Lines changed: 0 additions & 31 deletions
This file was deleted.

src/Common.OData/AspNet.OData/Builder/VersionedODataModelBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,4 +118,4 @@ void BuildModelPerApiVersion(
118118
}
119119
}
120120
}
121-
}
121+
}

src/Common/AdvertiseApiVersionsAttribute.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ namespace Microsoft.AspNetCore.Mvc
1313
using System.Diagnostics.CodeAnalysis;
1414
using static System.AttributeTargets;
1515

16+
#pragma warning disable CA1019
17+
#pragma warning disable CA1813
18+
1619
/// <summary>
1720
/// Represents the metadata that describes the advertised <see cref="ApiVersion">API versions</see> for an ASP.NET controllers.
1821
/// </summary>
@@ -48,9 +51,9 @@ public AdvertiseApiVersionsAttribute( string version ) : base( version ) { }
4851
[CLSCompliant( false )]
4952
public AdvertiseApiVersionsAttribute( params string[] versions ) : base( versions ) { }
5053

51-
#pragma warning disable CA1033 // Interface methods should be callable by child types
54+
#pragma warning disable CA1033
5255
ApiVersionProviderOptions IApiVersionProvider.Options => options;
53-
#pragma warning restore CA1033 // Interface methods should be callable by child types
56+
#pragma warning restore CA1033
5457

5558
/// <summary>
5659
/// Gets or sets a value indicating whether the specified set of API versions are deprecated.

src/Common/ApiVersionAttribute.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,13 @@ namespace Microsoft.AspNetCore.Mvc
1212
using System;
1313
using static System.AttributeTargets;
1414

15+
#pragma warning disable CA1813
16+
1517
/// <summary>
1618
/// Represents the metadata that describes the <see cref="ApiVersion">API versions</see> associated with a service.
1719
/// </summary>
1820
[AttributeUsage( Class | Method, AllowMultiple = true, Inherited = false )]
21+
1922
public class ApiVersionAttribute : ApiVersionsBaseAttribute, IApiVersionProvider
2023
{
2124
ApiVersionProviderOptions options = ApiVersionProviderOptions.None;
@@ -30,7 +33,9 @@ protected ApiVersionAttribute( ApiVersion version ) : base( version ) { }
3033
/// Initializes a new instance of the <see cref="ApiVersionAttribute"/> class.
3134
/// </summary>
3235
/// <param name="version">The API version string.</param>
36+
#pragma warning disable CA1019
3337
public ApiVersionAttribute( string version ) : base( version ) { }
38+
#pragma warning restore CA1019
3439

3540
#pragma warning disable CA1033 // Interface methods should be callable by child types
3641
ApiVersionProviderOptions IApiVersionProvider.Options => options;

src/Common/MapToApiVersionAttribute.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ namespace Microsoft.AspNetCore.Mvc
1212
using System;
1313
using static System.AttributeTargets;
1414

15+
#pragma warning disable CA1019
16+
#pragma warning disable CA1813
17+
1518
/// <summary>
1619
/// Represents the metadata that describes the <see cref="ApiVersion">API version</see>-specific implementation of a service.
1720
/// </summary>
@@ -33,8 +36,8 @@ protected MapToApiVersionAttribute( ApiVersion version ) : base( version ) { }
3336
/// <param name="version">The API version string.</param>
3437
public MapToApiVersionAttribute( string version ) : base( version ) { }
3538

36-
#pragma warning disable CA1033 // Interface methods should be callable by child types
39+
#pragma warning disable CA1033
3740
ApiVersionProviderOptions IApiVersionProvider.Options => ApiVersionProviderOptions.Mapped;
38-
#pragma warning restore CA1033 // Interface methods should be callable by child types
41+
#pragma warning restore CA1033
3942
}
4043
}

src/Common/Versioning/ApiVersionsBaseAttribute.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ protected ApiVersionsBaseAttribute( params ApiVersion[] versions )
4141
/// Initializes a new instance of the <see cref="ApiVersionsBaseAttribute"/> class.
4242
/// </summary>
4343
/// <param name="version">The API version string.</param>
44-
public ApiVersionsBaseAttribute( string version ) : this( new[] { version } ) { }
44+
protected ApiVersionsBaseAttribute( string version ) : this( new[] { version } ) { }
4545

4646
/// <summary>
4747
/// Initializes a new instance of the <see cref="ApiVersionsBaseAttribute"/> class.
4848
/// </summary>
4949
/// <param name="versions">An <see cref="Array">array</see> of API version strings.</param>
5050
[CLSCompliant( false )]
51-
public ApiVersionsBaseAttribute( params string[] versions )
51+
protected ApiVersionsBaseAttribute( params string[] versions )
5252
{
5353
computedHashCode = new Lazy<int>( () => ComputeHashCode( Versions ) );
5454
this.versions = new Lazy<IReadOnlyList<ApiVersion>>( () => versions.Select( Parse ).Distinct().ToSortedReadOnlyList() );

src/Microsoft.AspNet.WebApi.Versioning/ReportApiVersionsAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
/// <content>
99
/// Provides the implementation for ASP.NET Web API.
1010
/// </content>
11-
public partial class ReportApiVersionsAttribute
11+
public sealed partial class ReportApiVersionsAttribute
1212
{
1313
/// <summary>
1414
/// Occurs after the controller action has executed.

0 commit comments

Comments
 (0)