Skip to content

Commit

Permalink
Fix IDE0301.
Browse files Browse the repository at this point in the history
  • Loading branch information
martinpotter committed May 31, 2024
1 parent 970a16d commit 2850955
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Faithlife.Build/DotNetBuild.cs
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ string[] GetTargetFrameworks()
{
// return single empty framework unless there are more than one
var text = xmlDocGenProjectDocument.XPathSelectElements("Project/PropertyGroup/TargetFrameworks").FirstOrDefault()?.Value;
var values = text is null ? Array.Empty<string>() : text.Split(';').Select(x => x.Trim()).Where(x => x.Length != 0).ToArray();
var values = text is null ? [] : text.Split(';').Select(x => x.Trim()).Where(x => x.Length != 0).ToArray();
return values.Length > 1 ? values : [""];
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/Faithlife.Build/DotNetLocalTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public static DotNetLocalTool CreateFrom(string directory, string name) =>
/// True if there are any .NET local tools at the specified directory.
/// </summary>
/// <param name="directory">The directory from which the tool would be run.</param>
public static bool AnyFrom(string directory) => GetDotNetLocalTools(directory).Any();
public static bool AnyFrom(string directory) => GetDotNetLocalTools(directory).Count != 0;

/// <summary>
/// The version of the tool.
Expand Down Expand Up @@ -110,11 +110,11 @@ internal DotNetLocalTool(string directory, string name, NuGetVersion version)
Version = version;
}

private static IReadOnlyList<(string Package, NuGetVersion Version, string Command)> GetDotNetLocalTools(string directory)
private static List<(string Package, NuGetVersion Version, string Command)> GetDotNetLocalTools(string directory)
{
var manifestPath = TryGetDotNetLocalToolManifestPath(Path.GetFullPath(directory));
if (manifestPath is null)
return Array.Empty<(string, NuGetVersion, string)>();
return [];

return JsonDocument.Parse(File.ReadAllText(manifestPath))
.RootElement
Expand Down

0 comments on commit 2850955

Please sign in to comment.