Skip to content

Commit 43fec71

Browse files
authored
Enable Roslyn analysis - main project - final (#4707)
* Enable analysis on whole src folder * CA5392 * CA1310 * Mute CA1815 * CA1810 * Mute CA1065 * IDE0007 * Remove unused IntegrationRegistry and IntegrationInfo * Mute CA1810 * Remove empty globalsuppresion file
1 parent 105719a commit 43fec71

33 files changed

+87
-143
lines changed

OpenTelemetry.AutoInstrumentation.sln

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{9E5F0022-0A5
3838
src\CommonExcludedAssets.props = src\CommonExcludedAssets.props
3939
src\Directory.Build.props = src\Directory.Build.props
4040
src\Directory.Packages.props = src\Directory.Packages.props
41-
src\GlobalSuppressions.cs = src\GlobalSuppressions.cs
4241
EndProjectSection
4342
EndProject
4443
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.AutoInstrumentation.BuildTasks", "src\OpenTelemetry.AutoInstrumentation.BuildTasks\OpenTelemetry.AutoInstrumentation.BuildTasks.csproj", "{12A213FD-12A3-406C-8284-E7EA0B180428}"

src/Directory.Build.props

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
<NoWarn>$(NoWarn);NU5104</NoWarn>
3131

3232
<EmbedUntrackedSources Condition=" '$(TargetFramework)' == 'net462' ">true</EmbedUntrackedSources>
33+
<AnalysisLevel>latest-All</AnalysisLevel>
3334
</PropertyGroup>
3435

3536
<ItemGroup>
@@ -51,9 +52,6 @@
5152
<None Include="$(MSBuildThisFileDirectory)\..\opentelemetry-icon-color.png" Pack="true" Visible="false" PackagePath="opentelemetry-icon-color.png" />
5253
<None Include="docs\README.md" Pack="true" PackagePath="docs\README.md" />
5354

54-
<!-- StyleCop -->
55-
<Compile Include="$(MSBuildThisFileDirectory)GlobalSuppressions.cs" Link="GlobalSuppressions.src.cs" />
56-
5755
<!-- reference assemblies let us target .NET Framework without the SDK (for example, on non-Windows) -->
5856
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="all" />
5957
</ItemGroup>

src/GlobalSuppressions.cs

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

src/OpenTelemetry.AutoInstrumentation.AspNetCoreBootstrapper/OpenTelemetry.AutoInstrumentation.AspNetCoreBootstrapper.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
<PropertyGroup>
66
<TargetFrameworks>net8.0</TargetFrameworks>
77
<Description>ASP.NET Core Bootstrapper used by the OpenTelemetry.AutoInstrumentation project.</Description>
8-
<AnalysisLevel>latest-All</AnalysisLevel>
98
</PropertyGroup>
109

1110
<ItemGroup>

src/OpenTelemetry.AutoInstrumentation.BuildTasks/OpenTelemetry.AutoInstrumentation.BuildTasks.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
<!-- The version of certain packages is needed to copy dependencies when creating the NuGet package -->
1515
<NuGetVersioningVersion>6.5.0</NuGetVersioningVersion>
16-
<AnalysisLevel>latest-All</AnalysisLevel>
1716
</PropertyGroup>
1817

1918
<!-- ItemGroup with build files -->

src/OpenTelemetry.AutoInstrumentation.Loader/AssemblyResolver.Net.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ internal partial class AssemblyResolver
5454
}
5555
else
5656
{
57-
var entry = StoreFiles?.FirstOrDefault(e => e.EndsWith($"{assemblyName.Name}.dll"));
57+
var entry = StoreFiles?.FirstOrDefault(e => e.EndsWith($"{assemblyName.Name}.dll", StringComparison.Ordinal));
5858
if (entry != null)
5959
{
6060
return DependencyLoadContext.LoadFromAssemblyPath(entry);

src/OpenTelemetry.AutoInstrumentation.Loader/AssemblyResolver.NetFramework.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ internal partial class AssemblyResolver
100100
/// Return redirection table used in runtime that will match TFM folder to load assemblies.
101101
/// It may not be actual .NET Framework version.
102102
/// </summary>
103+
[DefaultDllImportSearchPaths(DllImportSearchPath.SafeDirectories)]
103104
[DllImport("OpenTelemetry.AutoInstrumentation.Native.dll")]
104105
private static extern int GetNetFrameworkRedirectionVersion();
105106

src/OpenTelemetry.AutoInstrumentation.Loader/OpenTelemetry.AutoInstrumentation.Loader.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">$(TargetFrameworks);net462</TargetFrameworks>
66
<Description>Loader used by the OpenTelemetry.AutoInstrumentation project.</Description>
77
<OutputPath>..\bin\ProfilerResources\</OutputPath>
8+
<!-- Do not catch general exception types. Typically, we need to handle all Exception to do not break application. -->
9+
<NoWarn>$(NoWarn);CA1031</NoWarn>
810
</PropertyGroup>
911
<ItemGroup>
1012
<Compile Include="..\OpenTelemetry.AutoInstrumentation\Logging\InternalLogger.cs">

src/OpenTelemetry.AutoInstrumentation.StartupHook/OpenTelemetry.AutoInstrumentation.StartupHook.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
<Description>StartupHook used by the OpenTelemetry.AutoInstrumentation project.</Description>
99
<!-- Suppress CA1031 warnings about catching general exception types. In this project we need to catch all exceptions to prevent the application from crashing. -->
1010
<NoWarn>$(NoWarn);CA1031</NoWarn>
11-
<AnalysisLevel>latest-All</AnalysisLevel>
1211
</PropertyGroup>
1312

1413
<ItemGroup>

src/OpenTelemetry.AutoInstrumentation/CallTarget/CallTargetState.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ namespace OpenTelemetry.AutoInstrumentation.CallTarget;
99
/// <summary>
1010
/// Call target execution state
1111
/// </summary>
12+
#pragma warning disable CA1815 // Override equals and operator equals on value types
1213
public readonly struct CallTargetState
14+
#pragma warning restore CA1815 // Override equals and operator equals on value types
1315
{
1416
private readonly Activity? _previousActivity;
1517
private readonly Activity? _activity;

0 commit comments

Comments
 (0)