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

chore: removing some warnings #275

Merged
merged 2 commits into from
Jun 18, 2024
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
6 changes: 3 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 2 additions & 4 deletions src/Buildalyzer/Buildalyzer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="[4,)" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic" Version="[4,)" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />
<PackageReference Include="MsBuildPipeLogger.Server" Version="1.1.6" />
<PackageReference Include="Microsoft.Build" Version="17.0.1" />
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="17.0.1" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="[4,)" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic" Version="[4,)" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />
<PackageReference Include="MSBuild.StructuredLogger" Version="2.1.815" Aliases="StructuredLogger" />
<PackageReference Include="MsBuildPipeLogger.Server" Version="1.1.6" />
Expand Down
2 changes: 1 addition & 1 deletion src/Buildalyzer/Environment/BuildEnvironment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
6 changes: 1 addition & 5 deletions src/Buildalyzer/Logging/EventProcessor.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
extern alias StructuredLogger;

using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Build.Framework;
using Microsoft.Extensions.Logging;

Expand Down Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought var was okay now? Or is it this particular line where you want string instead?

Copy link
Owner Author

Choose a reason for hiding this comment

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

var is ok, I removed the warning in the config editor too.

?? string.Empty;

if (propertiesAndItems != null && propertiesAndItems.Properties != null && propertiesAndItems.Items != null)
Expand Down
Loading