Skip to content
Draft
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
3 changes: 0 additions & 3 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@

<NoWarn Condition="'$(GenerateDocumentationFile)' != 'true'">$(NoWarn);SA1600;SA0001</NoWarn>

<!-- Conflicts with SA1405: Debug.Assert should provide message text -->
<NoWarn>$(NoWarn);S3236</NoWarn>

<!-- Legacy targets do not support attributes for a nullable context thus suppressing null check warnings -->
<NoWarn Condition="'$(TargetFramework)' == 'net462' or '$(TargetFramework)' == 'netstandard2.0'">$(NoWarn);CA1062</NoWarn>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Diagnostics.CodeAnalysis;
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using System.Diagnostics.CodeAnalysis; is now unused in this file (the only SuppressMessage was removed). Please remove the unused using to avoid IDE0005 warnings.

Suggested change
using System.Diagnostics.CodeAnalysis;

Copilot uses AI. Check for mistakes.
Expand All @@ -10,8 +10,6 @@ internal sealed class DropMessageLoggerProvider : ILoggerProvider
{
public ILogger CreateLogger(string categoryName) => new DropMessageLogger();

[SuppressMessage("Critical Code Smell", "S1186:Methods should not be empty",
Justification = "Noop")]
public void Dispose()
{
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using Microsoft.Extensions.Logging;

namespace Microsoft.Extensions.Telemetry.Bench;

#pragma warning disable S103
#pragma warning disable SA1121
#pragma warning disable S2148
#pragma warning disable IDE0055
#pragma warning disable IDE1006
#pragma warning disable S3235

internal static class ClassicCodeGen
{
Expand Down
2 changes: 1 addition & 1 deletion eng/MSBuild/Analyzers.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<!-- The static analyzers we use -->
<ItemGroup Condition="'$(SkipAnalyzers)' != 'true'">
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
<PackageReference Include="SonarAnalyzer.CSharp" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />

<PackageReference Include="StyleCop.Analyzers.Unstable" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
<AdditionalFiles Include="$(RepositoryEngineeringDir)\Stylecop.json" Visible="false" />
<PackageReference Include="ReferenceTrimmer" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers" />
Expand Down
3 changes: 1 addition & 2 deletions eng/Tools/ApiChief/Commands/CheckBreakingChanges.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
Expand All @@ -13,7 +13,6 @@ namespace ApiChief.Commands;

internal static class CheckBreakingChanges
{
[SuppressMessage("Minor Code Smell", "S3459:Unassigned members should be removed", Justification = "Written through reflection.")]
private sealed class CheckBreakingChangesArgs
{
public FileInfo? AssemblyPath { get; }
Expand Down
4 changes: 1 addition & 3 deletions eng/Tools/ApiChief/Commands/EmitBaseline.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
Expand All @@ -13,8 +13,6 @@ namespace ApiChief.Commands;

internal static class EmitBaseline
{
[SuppressMessage("Minor Code Smell", "S3459:Unassigned members should be removed", Justification = "Written through reflection.")]
[SuppressMessage("Major Code Smell", "S1144:Unused private types or members should be removed", Justification = "Written through reflection.")]
private sealed class EmitBaselineArgs
{
public FileInfo? AssemblyPath { get; set; }
Expand Down
4 changes: 1 addition & 3 deletions eng/Tools/ApiChief/Commands/EmitDelta.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
Expand All @@ -13,8 +13,6 @@ namespace ApiChief.Commands;

internal static class EmitDelta
{
[SuppressMessage("Minor Code Smell", "S3459:Unassigned members should be removed", Justification = "Written through reflection.")]
[SuppressMessage("Major Code Smell", "S1144:Unused private types or members should be removed", Justification = "Written through reflection.")]
private sealed class EmitDeltaArgs
{
public FileInfo? AssemblyPath { get; set; }
Expand Down
6 changes: 1 addition & 5 deletions eng/Tools/ApiChief/Commands/EmitReview.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
Expand All @@ -21,8 +21,6 @@ namespace ApiChief.Commands;

internal static class EmitReview
{
[SuppressMessage("Minor Code Smell", "S3459:Unassigned members should be removed", Justification = "Written through reflection.")]
[SuppressMessage("Major Code Smell", "S1144:Unused private types or members should be removed", Justification = "Written through reflection.")]
private sealed class EmitReviewArgs
{
public FileInfo? AssemblyPath { get; set; }
Expand Down Expand Up @@ -51,7 +49,6 @@ public static Command Create()
private static async Task<int> ExecuteAsync(EmitReviewArgs args)
{
// once with XML comments, once without
#pragma warning disable S109 // Magic numbers should not be used
for (int i = 0; i < 2; i++)
{
var formatting = Formatter.FormattingWithXmlComments;
Expand Down Expand Up @@ -240,7 +237,6 @@ private static async Task<int> ExecuteAsync(EmitReviewArgs args)
}
}
}
#pragma warning restore S109 // Magic numbers should not be used

return 0;
}
Expand Down
4 changes: 1 addition & 3 deletions eng/Tools/ApiChief/Commands/EmitSummary.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
Expand All @@ -16,8 +16,6 @@ namespace ApiChief.Commands;

internal static class EmitSummary
{
[SuppressMessage("Minor Code Smell", "S3459:Unassigned members should be removed", Justification = "Written through reflection.")]
[SuppressMessage("Major Code Smell", "S1144:Unused private types or members should be removed", Justification = "Written through reflection.")]
private sealed class EmitSummaryArgs
{
public FileInfo? AssemblyPath { get; set; }
Expand Down
12 changes: 1 addition & 11 deletions eng/Tools/ApiChief/Format/FormattingExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
Expand Down Expand Up @@ -37,9 +37,7 @@ public static string WithSpaceBetweenParameters(this string signature)
}

sb.Append(next);
#pragma warning disable S127 // "for" loop stop conditions should be invariant
i = index;
#pragma warning restore S127 // "for" loop stop conditions should be invariant
}
else if (current == ',')
{
Expand Down Expand Up @@ -103,11 +101,8 @@ public static string WithNumbersWithoutLiterals(this string memberDecl)
}

sb.Append(next);
#pragma warning disable S127 // "for" loop stop conditions should be invariant
i = initial;
#pragma warning restore S127 // "for" loop stop conditions should be invariant
}
#pragma warning disable S2583 // Conditionally executed code should be reachable
else if (current == '=')
{
sawEqualitySign = true;
Expand All @@ -117,14 +112,12 @@ public static string WithNumbersWithoutLiterals(this string memberDecl)
var initial = i + 1;
var next = memberDecl[initial];

#pragma warning disable S1067 // Expressions should not be too complex
while (char.IsDigit(next) || (char.IsDigit(memberDecl[initial - 1]) && _possibleSpecialCharactersInANumber.Contains(next)))
{
sb.Append(next);
initial++;
next = memberDecl[initial];
}
#pragma warning restore S1067 // Expressions should not be too complex

if (!_numberLiterals.Contains(next))
{
Expand All @@ -134,12 +127,9 @@ public static string WithNumbersWithoutLiterals(this string memberDecl)
{
initial++;
}
#pragma warning disable S127 // "for" loop stop conditions should be invariant
i = initial;
#pragma warning restore S127 // "for" loop stop conditions should be invariant
sawEqualitySign = false;
}
#pragma warning restore S2583 // Conditionally executed code should be reachable

}

Expand Down
3 changes: 1 addition & 2 deletions eng/Tools/ApiChief/Processing/ApiProcessor.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
Expand Down Expand Up @@ -128,7 +128,6 @@ static bool FilterProperties(IProperty property, ITypeDefinition type)
&& property.DeclaringType.Equals(type);
}

[SuppressMessage("Critical Code Smell", "S1067:Expressions should not be too complex", Justification = "Cannot reduce it.")]
private static void ProcessMethods(ITypeDefinition type, ApiType finalTypeApi, ApiStage classStage)
{
var methods = type.Methods
Comment on lines 131 to 133
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using System.Diagnostics.CodeAnalysis; appears unused in this file now that the SuppressMessage attribute was removed. Please remove the unused using to avoid IDE0005 warnings.

Copilot uses AI. Check for mistakes.
Expand Down
4 changes: 1 addition & 3 deletions eng/Tools/ApiChief/Processing/PublicFilterVisitor.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.IO;
Expand Down Expand Up @@ -74,7 +74,6 @@ public override void VisitMethodDeclaration(MethodDeclaration methodDeclaration)
foreach (var attribute in methodDeclaration.Attributes)
{
var s = attribute.ToString();
#pragma warning disable S1067
if (s.Contains("SkipLocalsInit")
|| s.Contains("ExcludeFromCodeCoverage")
|| s.Contains("DebuggerStepThrough")
Expand All @@ -83,7 +82,6 @@ public override void VisitMethodDeclaration(MethodDeclaration methodDeclaration)
|| s.Contains("DynamicDependency")
|| s.Contains("RequiresUnreferencedCode")
|| s.Contains("AsyncStateMachine"))
#pragma warning restore S1067
{
attribute.Remove();
}
Expand Down
4 changes: 1 addition & 3 deletions eng/Tools/DiagConfig/ConfigStore/Metadata.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Generic;
Expand All @@ -10,9 +10,7 @@ internal sealed class Metadata
public string Category { get; set; } = string.Empty;
public string Title { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
#pragma warning disable S3996 // URI properties should not be strings
public string? HelpLinkUri { get; set; }
#pragma warning restore S3996 // URI properties should not be strings
public IList<string>? CustomTags { get; set; }
public Severity DefaultSeverity { get; set; }
}
4 changes: 1 addition & 3 deletions eng/Tools/DiagConfig/MergeAnalyzersCmd.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
Expand Down Expand Up @@ -60,9 +60,7 @@ private static Task<int> ExecuteAsync(MergeAnalyzersArgs args)
Assembly asm;
try
{
#pragma warning disable S3885 // "Assembly.Load" should be used
asm = Assembly.LoadFrom(path);
#pragma warning restore S3885 // "Assembly.Load" should be used
}
catch (Exception ex)
{
Expand Down
6 changes: 1 addition & 5 deletions eng/Tools/DiagConfig/SaveEditorConfigCmd.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
Expand All @@ -12,8 +12,6 @@ namespace DiagConfig;

internal static class SaveEditorConfigCmd
{
#pragma warning disable S3459 // Unassigned members should be removed
#pragma warning disable S1144 // Unused private types or members should be removed
private sealed class SaveEditorConfigArgs
{
public string ConfigDirectory { get; set; } = string.Empty;
Expand All @@ -24,8 +22,6 @@ private sealed class SaveEditorConfigArgs
public bool IsGlobal { get; set; }
public int MaxTier { get; set; } = int.MaxValue;
}
#pragma warning restore S1144 // Unused private types or members should be removed
#pragma warning restore S3459 // Unassigned members should be removed

public static Command Create()
{
Expand Down
Loading
Loading