Skip to content

Commit

Permalink
Address Pavel comments 1
Browse files Browse the repository at this point in the history
  • Loading branch information
CristianAmbrosini committed May 7, 2024
1 parent 8eb8ef3 commit a294811
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void LatestSdkFolder_ReturnLatest()
Version.TryParse(Path.GetFileName(latestSdkFolder), out var latestSdkVersion).Should().BeTrue($"'{latestSdkFolder}' cannot be parsed to a version number");
var parentDirectory = Directory.GetParent(latestSdkFolder);
parentDirectory.Name.Should().Be("sdk", "Parent directory of the latest SDK should be 'sdk'");
Directory.GetDirectories(parentDirectory.FullName, $"{typeof(object).Assembly.GetName().Version.Major}.*", SearchOption.TopDirectoryOnly)
Directory.GetDirectories(parentDirectory.FullName, $"{typeof(object).Assembly.GetName().Version.Major}.*")
.Should().NotContain(x => IsHigherVersion(x, latestSdkVersion), "There should be no SDK folders with a higher version number than the latest SDK folder");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,9 @@ public static string LatestSdkFolder()
$"This may be because you are not using .NET Core. " +
$"Please note that Razor analysis is only supported when using .NET Core.");
}
return Directory.GetDirectories(sdkDirectory, $"{objectAssembly.GetName().Version.Major}.*", SearchOption.TopDirectoryOnly)
return Directory.GetDirectories(sdkDirectory, $"{objectAssembly.GetName().Version.Major}.*")
.OrderByDescending(x => Version.Parse(new DirectoryInfo(x).Name))
.FirstOrDefault() is { } latestSdkDirectory
? latestSdkDirectory
: throw new DirectoryNotFoundException($"SDK directory not found for version {objectAssembly.GetName().Version.Major}");
.First();
}

private sealed class AssemblyLoader : IAnalyzerAssemblyLoader
Expand Down

0 comments on commit a294811

Please sign in to comment.