Skip to content

Commit

Permalink
code review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
xavierdecoster committed Apr 8, 2017
1 parent efc9fcf commit ac097b5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/NuGetGallery.Core/NuGetVersionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public static string Normalize(string version)

public static class NuGetVersionExtensions
{
private const RegexOptions Flags = RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture;
private static readonly Regex SemanticVersionRegex = new Regex(@"^(?<Version>\d+(\s*\.\s*\d+){0,3})(?<Release>-[a-z][0-9a-z-]*)?$", Flags);
private const RegexOptions SemanticVersionRegexFlags = RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture;
private static readonly Regex SemanticVersionRegex = new Regex(@"^(?<Version>\d+(\s*\.\s*\d+){0,3})(?<Release>-[a-z][0-9a-z-]*)?$", SemanticVersionRegexFlags);

public static string ToNormalizedStringSafe(this NuGetVersion self)
{
Expand Down
1 change: 1 addition & 0 deletions src/NuGetGallery.Core/Packaging/ManifestValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ private static IEnumerable<ValidationResult> ValidateCore(PackageMetadata packag
/// <summary>
/// Checks whether the provided version is consumable by legacy 2.x clients,
/// which do not support a `.` in release labels, or release labels starting with numeric characters.
/// See also https://github.com/NuGet/NuGetGallery/issues/3226.
/// </summary>
/// <param name="version">The <see cref="NuGetVersion"/> to check for 2.x client compatibility.</param>
/// <returns>Returns a <see cref="ValidationResult"/> when non-compliant; otherwise <c>null</c>.</returns>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -445,8 +445,6 @@ public void ReturnsNoErrorIfDependencyVersionIsSemVer200WithoutMetadataPart()
[InlineData("1.0.0--")]
public void ReturnsErrorIfNonSemVer2VersionIsNotCompliantWith2XClients(string version)
{
// https://github.com/NuGet/NuGetGallery/issues/3226

var nuspecStream = CreateNuspecStream(string.Format(NuSpecPlaceholderVersion, version));

Assert.Equal(new[] {String.Format(CoreStrings.Manifest_InvalidVersion, version)}, GetErrors(nuspecStream));
Expand Down

0 comments on commit ac097b5

Please sign in to comment.