-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
combine validation and errors into one result (#155)
- Loading branch information
Showing
205 changed files
with
18,596 additions
and
1,723 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
namespace NuGetUtility.Extension | ||
{ | ||
public static class AsyncEnumerableExtension | ||
{ | ||
public static async IAsyncEnumerable<TResult> SelectMany<TSource, TResult>(this IAsyncEnumerable<TSource> input, | ||
Func<TSource, IAsyncEnumerable<TResult>> transform) | ||
{ | ||
await foreach (var value in input) | ||
{ | ||
await foreach (var transformedValue in transform(value)) | ||
{ | ||
yield return transformedValue; | ||
} | ||
} | ||
} | ||
public static async IAsyncEnumerable<TResult> SelectMany<TSource, TResult>(this IEnumerable<TSource> input, | ||
Func<TSource, IAsyncEnumerable<TResult>> transform) | ||
{ | ||
foreach (var value in input) | ||
{ | ||
await foreach (var transformedValue in transform(value)) | ||
{ | ||
yield return transformedValue; | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
public enum LicenseInformationOrigin | ||
{ | ||
Expression, | ||
Url | ||
Url, | ||
Unknown | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
17 changes: 17 additions & 0 deletions
17
src/NuGetUtility/LicenseValidator/LicenseValidationResult.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using NuGet.Versioning; | ||
|
||
namespace NuGetUtility.LicenseValidator | ||
{ | ||
public record LicenseValidationResult(string PackageId, | ||
NuGetVersion PackageVersion, | ||
string? PackageProjectUrl, | ||
string? License, | ||
LicenseInformationOrigin LicenseInformationOrigin, | ||
List<ValidationError>? ValidationErrors = null) | ||
{ | ||
public List<ValidationError> ValidationErrors { get; } = ValidationErrors ?? new List<ValidationError>(); | ||
|
||
public string? License { get; set; } = License; | ||
public LicenseInformationOrigin LicenseInformationOrigin { get; set; } = LicenseInformationOrigin; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
namespace NuGetUtility.LicenseValidator | ||
{ | ||
public record ValidationError(string Error, string Context); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using NuGetUtility.LicenseValidator; | ||
|
||
namespace NuGetUtility.Output | ||
{ | ||
public interface IOutputFormatter | ||
{ | ||
Task Write(Stream stream, IList<LicenseValidationResult> results); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.