From 00a961678d0895592169ae89837eee72c650a181 Mon Sep 17 00:00:00 2001 From: Pablo Monteiro Date: Sat, 25 May 2024 15:12:25 -0300 Subject: [PATCH 1/2] chore: removing some warnings --- src/Buildalyzer/Buildalyzer.csproj | 6 ++---- src/Buildalyzer/Environment/BuildEnvironment.cs | 2 +- src/Buildalyzer/Logging/EventProcessor.cs | 6 +----- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/Buildalyzer/Buildalyzer.csproj b/src/Buildalyzer/Buildalyzer.csproj index 3c8b464a..d1aa8711 100644 --- a/src/Buildalyzer/Buildalyzer.csproj +++ b/src/Buildalyzer/Buildalyzer.csproj @@ -12,12 +12,10 @@ - - - - + + diff --git a/src/Buildalyzer/Environment/BuildEnvironment.cs b/src/Buildalyzer/Environment/BuildEnvironment.cs index 968ed0a9..c877d1f0 100644 --- a/src/Buildalyzer/Environment/BuildEnvironment.cs +++ b/src/Buildalyzer/Environment/BuildEnvironment.cs @@ -76,7 +76,7 @@ public BuildEnvironment( WorkingDirectory = workingDirectory; // Check if we've already specified a path to MSBuild - string envMsBuildExePath = System.Environment.GetEnvironmentVariable(Environment.EnvironmentVariables.MSBUILD_EXE_PATH); + string? envMsBuildExePath = System.Environment.GetEnvironmentVariable(Environment.EnvironmentVariables.MSBUILD_EXE_PATH); MsBuildExePath = !string.IsNullOrEmpty(envMsBuildExePath) && File.Exists(envMsBuildExePath) ? envMsBuildExePath : msBuildExePath; if (string.IsNullOrWhiteSpace(MsBuildExePath) && string.IsNullOrWhiteSpace(dotnetExePath)) diff --git a/src/Buildalyzer/Logging/EventProcessor.cs b/src/Buildalyzer/Logging/EventProcessor.cs index 7a5e3f9d..9ac7ed26 100644 --- a/src/Buildalyzer/Logging/EventProcessor.cs +++ b/src/Buildalyzer/Logging/EventProcessor.cs @@ -1,8 +1,4 @@ extern alias StructuredLogger; - -using System; -using System.Collections.Generic; -using System.Linq; using Microsoft.Build.Framework; using Microsoft.Extensions.Logging; @@ -100,7 +96,7 @@ private void ProjectStarted(object sender, ProjectStartedEventArgs e) // Get the TFM for this project // use an empty string if no target framework was found, for example in case of C++ projects with VS >= 2022 - var tfm = propertiesAndItems?.Properties.TryGet("TargetFrameworkMoniker")?.StringValue + string tfm = propertiesAndItems?.Properties.TryGet("TargetFrameworkMoniker")?.StringValue ?? string.Empty; if (propertiesAndItems != null && propertiesAndItems.Properties != null && propertiesAndItems.Items != null) From 5f16f22958db0fed48890f6945b9d866c4b4ef99 Mon Sep 17 00:00:00 2001 From: Pablo Monteiro Date: Mon, 17 Jun 2024 21:33:54 -0300 Subject: [PATCH 2/2] chore: ignore var --- .editorconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.editorconfig b/.editorconfig index 2105c525..4cdd8581 100644 --- a/.editorconfig +++ b/.editorconfig @@ -47,9 +47,9 @@ dotnet_style_explicit_tuple_names = true:suggestion # CSharp code style settings: [*.cs] -csharp_style_var_for_built_in_types = false:suggestion -csharp_style_var_when_type_is_apparent = false:suggestion -csharp_style_var_elsewhere = false:suggestion +csharp_style_var_for_built_in_types = true:suggestion +csharp_style_var_when_type_is_apparent = true:suggestion +csharp_style_var_elsewhere = true:suggestion # Prefer method-like constructs to have a block body csharp_style_expression_bodied_methods = false:none