Skip to content

Commit

Permalink
Direct project references were not checking the version number betwee…
Browse files Browse the repository at this point in the history
…n them (#968)
  • Loading branch information
claudiamurialdo authored Feb 28, 2024
1 parent 492620c commit 29f5876
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion dotnet/test/ProjectHealthTest/PackageVersionsConsistency.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,18 @@ private bool AnyDirectReferenceLessThanTransitiveVersion(ICollection<PackageVers
else
{
Version directVersion = GetVersion(directReference.Version);
return value.Any(k => GetVersion(k.Version) > directVersion);
return value.Any(k => DirectReferenceLessThanTransitiveVersion(directVersion, k) || DiferentDirectReferences(directVersion, k));
}
}
private bool DiferentDirectReferences(Version directVersion, PackageVersionItem k)
{
return (!k.Transitive && GetVersion(k.Version) != directVersion);
}
private bool DirectReferenceLessThanTransitiveVersion(Version directVersion, PackageVersionItem k)
{
return (k.Transitive && GetVersion(k.Version) > directVersion);
}

private Version GetVersion(String versionString)
{
return Version.Parse(Regex.Match(versionString, VersionPattern).Value);
Expand Down

0 comments on commit 29f5876

Please sign in to comment.