diff --git a/.editorconfig b/.editorconfig index 61a1624..5a5f236 100644 --- a/.editorconfig +++ b/.editorconfig @@ -11,8 +11,8 @@ indent_style = space tab_width = 4 # New line preferences -end_of_line = crlf -insert_final_newline = true +end_of_line = lf +insert_final_newline = false #### .NET Coding Conventions #### @@ -391,9 +391,6 @@ dotnet_diagnostic.S4136.severity = none # S6605: Collection-specific "Exists" method should be used instead of the "Any" extension dotnet_diagnostic.S6605.severity = none dotnet_style_operator_placement_when_wrapping = beginning_of_line -tab_width = 4 -indent_size = 4 -end_of_line = crlf dotnet_style_null_propagation = true:error dotnet_style_coalesce_expression = true:error dotnet_style_prefer_is_null_check_over_reference_equality_method = true:error @@ -411,4 +408,4 @@ dotnet_style_qualification_for_field = false:error dotnet_style_qualification_for_property = false:error dotnet_style_qualification_for_method = false:error dotnet_style_qualification_for_event = false:error -dotnet_style_predefined_type_for_locals_parameters_members = true:error +dotnet_style_predefined_type_for_locals_parameters_members = true:error \ No newline at end of file diff --git a/.gitattributes b/.gitattributes index dfe0770..63b7807 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,5 @@ -# Auto detect text files and perform LF normalization * text=auto +*.{cmd,[cC][mM][dD]} text eol=crlf +*.{bat,[bB][aA][tT]} text eol=crlf +*.{ics,[iI][cC][sS]} text eol=crlf +*.sh text eol=lf \ No newline at end of file diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml new file mode 100644 index 0000000..4dd4b65 --- /dev/null +++ b/.github/workflows/ci-build.yml @@ -0,0 +1,32 @@ +name: CI build + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 9.0.x + + - name: Restore dependencies + run: dotnet restore KernelMemory.Ecommerce.Sample.sln + + - name: Build + run: dotnet build --no-restore KernelMemory.Ecommerce.Sample.sln + + - name: Check fomatting + run: dotnet format --verify-no-changes KernelMemory.Ecommerce.Sample.sln + + - name: Test + run: dotnet test --no-build --verbosity normal KernelMemory.Ecommerce.Sample.sln diff --git a/src/KernelMemory.Ecommerce.Sample.Api/Application/Configuration/ProductSearchOptions.cs b/src/KernelMemory.Ecommerce.Sample.Api/Application/Configuration/ProductSearchOptions.cs index 7a0edb3..1c347b5 100644 --- a/src/KernelMemory.Ecommerce.Sample.Api/Application/Configuration/ProductSearchOptions.cs +++ b/src/KernelMemory.Ecommerce.Sample.Api/Application/Configuration/ProductSearchOptions.cs @@ -10,4 +10,4 @@ public class ProductSearchOptions public required int SearchResultsLimit { get; init; } [Required] public required double MinSearchResultsRelevance { get; init; } -} +} \ No newline at end of file diff --git a/src/KernelMemory.Ecommerce.Sample.Api/Application/CsvReader/CsvReaderErrors.cs b/src/KernelMemory.Ecommerce.Sample.Api/Application/CsvReader/CsvReaderErrors.cs index 771ebc8..f788da4 100644 --- a/src/KernelMemory.Ecommerce.Sample.Api/Application/CsvReader/CsvReaderErrors.cs +++ b/src/KernelMemory.Ecommerce.Sample.Api/Application/CsvReader/CsvReaderErrors.cs @@ -10,4 +10,4 @@ public static Error ReadRecordsFailed(Exception ex) "CsvReader.ReadRecords.Failed", $"An error occurred while parsing the CSV file. Details: {ex.Message}"); } -} +} \ No newline at end of file diff --git a/src/KernelMemory.Ecommerce.Sample.Api/Application/CsvReader/ICsvReader.cs b/src/KernelMemory.Ecommerce.Sample.Api/Application/CsvReader/ICsvReader.cs index ce19d2a..bb94e60 100644 --- a/src/KernelMemory.Ecommerce.Sample.Api/Application/CsvReader/ICsvReader.cs +++ b/src/KernelMemory.Ecommerce.Sample.Api/Application/CsvReader/ICsvReader.cs @@ -6,4 +6,4 @@ public interface ICsvReader { Task>> ReadRecordsAsync( Stream stream, CancellationToken cancellationToken = default); -} +} \ No newline at end of file diff --git a/src/KernelMemory.Ecommerce.Sample.Api/Application/ICommand.cs b/src/KernelMemory.Ecommerce.Sample.Api/Application/ICommand.cs index 998752e..942689f 100644 --- a/src/KernelMemory.Ecommerce.Sample.Api/Application/ICommand.cs +++ b/src/KernelMemory.Ecommerce.Sample.Api/Application/ICommand.cs @@ -8,4 +8,4 @@ public interface IBaseCommand; public interface ICommand : IRequest>, IBaseCommand; public interface ICommandHandler : IRequestHandler> - where TCommand : ICommand; + where TCommand : ICommand; \ No newline at end of file diff --git a/src/KernelMemory.Ecommerce.Sample.Api/Application/IQuery.cs b/src/KernelMemory.Ecommerce.Sample.Api/Application/IQuery.cs index 1e3589e..a49997f 100644 --- a/src/KernelMemory.Ecommerce.Sample.Api/Application/IQuery.cs +++ b/src/KernelMemory.Ecommerce.Sample.Api/Application/IQuery.cs @@ -6,5 +6,4 @@ namespace KernelMemory.Ecommerce.Sample.Api.Application; public interface IQuery : IRequest>; public interface IQueryHandler : IRequestHandler> - where TQuery : IQuery; - + where TQuery : IQuery; \ No newline at end of file diff --git a/src/KernelMemory.Ecommerce.Sample.Api/Application/ProductIngestionCommand/ProductIngestionCommand.cs b/src/KernelMemory.Ecommerce.Sample.Api/Application/ProductIngestionCommand/ProductIngestionCommand.cs index 640d044..c232a47 100644 --- a/src/KernelMemory.Ecommerce.Sample.Api/Application/ProductIngestionCommand/ProductIngestionCommand.cs +++ b/src/KernelMemory.Ecommerce.Sample.Api/Application/ProductIngestionCommand/ProductIngestionCommand.cs @@ -32,4 +32,4 @@ public async Task>> Handle(ProductIngestionCo return documentIds; } -} +} \ No newline at end of file diff --git a/src/KernelMemory.Ecommerce.Sample.Api/Application/ProductSearchQueries/ProductRagSearchQuery.cs b/src/KernelMemory.Ecommerce.Sample.Api/Application/ProductSearchQueries/ProductRagSearchQuery.cs index 51e8168..476190e 100644 --- a/src/KernelMemory.Ecommerce.Sample.Api/Application/ProductSearchQueries/ProductRagSearchQuery.cs +++ b/src/KernelMemory.Ecommerce.Sample.Api/Application/ProductSearchQueries/ProductRagSearchQuery.cs @@ -45,4 +45,4 @@ public async Task> Handle( memoryAnswer.RelevantSources.Count, foundProducts); } -} +} \ No newline at end of file diff --git a/src/KernelMemory.Ecommerce.Sample.Api/Application/ProductSearchQueries/ProductSearchResponse.cs b/src/KernelMemory.Ecommerce.Sample.Api/Application/ProductSearchQueries/ProductSearchResponse.cs index 5f307a1..509ac97 100644 --- a/src/KernelMemory.Ecommerce.Sample.Api/Application/ProductSearchQueries/ProductSearchResponse.cs +++ b/src/KernelMemory.Ecommerce.Sample.Api/Application/ProductSearchQueries/ProductSearchResponse.cs @@ -16,4 +16,4 @@ public static ProductSearchResponse NoProducts(double minRelevance) RelevantSourcesCount: 0, Products: []); } -} +} \ No newline at end of file diff --git a/src/KernelMemory.Ecommerce.Sample.Api/Application/ProductSearchQueries/ProductVectorSearchQuery.cs b/src/KernelMemory.Ecommerce.Sample.Api/Application/ProductSearchQueries/ProductVectorSearchQuery.cs index 6b7ecb0..c637cc8 100644 --- a/src/KernelMemory.Ecommerce.Sample.Api/Application/ProductSearchQueries/ProductVectorSearchQuery.cs +++ b/src/KernelMemory.Ecommerce.Sample.Api/Application/ProductSearchQueries/ProductVectorSearchQuery.cs @@ -49,4 +49,4 @@ public async Task> Handle( searchResult.Results.Count, foundProducts); } -} +} \ No newline at end of file diff --git a/src/KernelMemory.Ecommerce.Sample.Api/Domain/Error.cs b/src/KernelMemory.Ecommerce.Sample.Api/Domain/Error.cs index 5508c29..4876cae 100644 --- a/src/KernelMemory.Ecommerce.Sample.Api/Domain/Error.cs +++ b/src/KernelMemory.Ecommerce.Sample.Api/Domain/Error.cs @@ -4,4 +4,4 @@ public record Error(string Code, string Description) { public static readonly Error None = new(string.Empty, string.Empty); public static readonly Error NullValue = new("General.Null", "Null value was provided"); -} +} \ No newline at end of file diff --git a/src/KernelMemory.Ecommerce.Sample.Api/Domain/Product.cs b/src/KernelMemory.Ecommerce.Sample.Api/Domain/Product.cs index d118249..bc78c42 100644 --- a/src/KernelMemory.Ecommerce.Sample.Api/Domain/Product.cs +++ b/src/KernelMemory.Ecommerce.Sample.Api/Domain/Product.cs @@ -7,4 +7,4 @@ public sealed record Product( decimal Price, string PriceCurrency, int SupplyAbility, - int MinimumOrder); + int MinimumOrder); \ No newline at end of file diff --git a/src/KernelMemory.Ecommerce.Sample.Api/Domain/Result.cs b/src/KernelMemory.Ecommerce.Sample.Api/Domain/Result.cs index 9109f4f..158f927 100644 --- a/src/KernelMemory.Ecommerce.Sample.Api/Domain/Result.cs +++ b/src/KernelMemory.Ecommerce.Sample.Api/Domain/Result.cs @@ -53,5 +53,4 @@ public static implicit operator Result(TValue? value) => public static Result ValidationFailure(Error error) => new(default, false, error); -} - +} \ No newline at end of file diff --git a/src/KernelMemory.Ecommerce.Sample.Api/Infrastructure/CsvReader.cs b/src/KernelMemory.Ecommerce.Sample.Api/Infrastructure/CsvReader.cs index da60b80..e53da0d 100644 --- a/src/KernelMemory.Ecommerce.Sample.Api/Infrastructure/CsvReader.cs +++ b/src/KernelMemory.Ecommerce.Sample.Api/Infrastructure/CsvReader.cs @@ -37,4 +37,4 @@ public async Task>> ReadRecordsAsync( return Result.Failure>(error); } } -} +} \ No newline at end of file diff --git a/src/KernelMemory.Ecommerce.Sample.Api/Infrastructure/ProductSearchPromptProvider.cs b/src/KernelMemory.Ecommerce.Sample.Api/Infrastructure/ProductSearchPromptProvider.cs index e691c2e..64a20e2 100644 --- a/src/KernelMemory.Ecommerce.Sample.Api/Infrastructure/ProductSearchPromptProvider.cs +++ b/src/KernelMemory.Ecommerce.Sample.Api/Infrastructure/ProductSearchPromptProvider.cs @@ -66,4 +66,4 @@ public string ReadPrompt(string promptName) _ => _fallbackProvider.ReadPrompt(promptName) // Fall back to the default }; } -} +} \ No newline at end of file diff --git a/src/KernelMemory.Ecommerce.Sample.Api/Presentation/ApiResults.cs b/src/KernelMemory.Ecommerce.Sample.Api/Presentation/ApiResults.cs index 1455d65..ef03bf6 100644 --- a/src/KernelMemory.Ecommerce.Sample.Api/Presentation/ApiResults.cs +++ b/src/KernelMemory.Ecommerce.Sample.Api/Presentation/ApiResults.cs @@ -10,4 +10,4 @@ public static IResult Problem(string problemTitle, string problemDetail) detail: problemDetail, type: BadRequestRfc, statusCode: StatusCodes.Status400BadRequest); -} +} \ No newline at end of file diff --git a/src/KernelMemory.Ecommerce.Sample.Api/Presentation/EndpointsExtensions.cs b/src/KernelMemory.Ecommerce.Sample.Api/Presentation/EndpointsExtensions.cs index eb4591b..c7d4db0 100644 --- a/src/KernelMemory.Ecommerce.Sample.Api/Presentation/EndpointsExtensions.cs +++ b/src/KernelMemory.Ecommerce.Sample.Api/Presentation/EndpointsExtensions.cs @@ -34,4 +34,4 @@ public static IApplicationBuilder MapEndpoints( return app; } -} +} \ No newline at end of file diff --git a/src/KernelMemory.Ecommerce.Sample.Api/Presentation/IEndpoint.cs b/src/KernelMemory.Ecommerce.Sample.Api/Presentation/IEndpoint.cs index 7f711e2..a605e30 100644 --- a/src/KernelMemory.Ecommerce.Sample.Api/Presentation/IEndpoint.cs +++ b/src/KernelMemory.Ecommerce.Sample.Api/Presentation/IEndpoint.cs @@ -3,5 +3,4 @@ public interface IEndpoint { void MapEndpoint(IEndpointRouteBuilder app); -} - +} \ No newline at end of file diff --git a/src/KernelMemory.Ecommerce.Sample.Api/Presentation/ProductIngestion.cs b/src/KernelMemory.Ecommerce.Sample.Api/Presentation/ProductIngestion.cs index 0ff65bb..82c3c39 100644 --- a/src/KernelMemory.Ecommerce.Sample.Api/Presentation/ProductIngestion.cs +++ b/src/KernelMemory.Ecommerce.Sample.Api/Presentation/ProductIngestion.cs @@ -30,4 +30,4 @@ public void MapEndpoint(IEndpointRouteBuilder app) }) .DisableAntiforgery(); } -} +} \ No newline at end of file diff --git a/src/KernelMemory.Ecommerce.Sample.Api/Presentation/ProductRagSearch.cs b/src/KernelMemory.Ecommerce.Sample.Api/Presentation/ProductRagSearch.cs index b42fd8f..442dbdd 100644 --- a/src/KernelMemory.Ecommerce.Sample.Api/Presentation/ProductRagSearch.cs +++ b/src/KernelMemory.Ecommerce.Sample.Api/Presentation/ProductRagSearch.cs @@ -14,4 +14,4 @@ public void MapEndpoint(IEndpointRouteBuilder app) return Results.Ok(result.Value); }); } -} +} \ No newline at end of file diff --git a/src/KernelMemory.Ecommerce.Sample.Api/Presentation/ProductVectorSearch.cs b/src/KernelMemory.Ecommerce.Sample.Api/Presentation/ProductVectorSearch.cs index 82066d9..2d20b8e 100644 --- a/src/KernelMemory.Ecommerce.Sample.Api/Presentation/ProductVectorSearch.cs +++ b/src/KernelMemory.Ecommerce.Sample.Api/Presentation/ProductVectorSearch.cs @@ -14,4 +14,4 @@ public void MapEndpoint(IEndpointRouteBuilder app) return Results.Ok(result.Value); }); } -} +} \ No newline at end of file diff --git a/src/KernelMemory.Ecommerce.Sample.Api/Program.cs b/src/KernelMemory.Ecommerce.Sample.Api/Program.cs index 73ebd0e..b34e99c 100644 --- a/src/KernelMemory.Ecommerce.Sample.Api/Program.cs +++ b/src/KernelMemory.Ecommerce.Sample.Api/Program.cs @@ -67,4 +67,4 @@ private static WebApplication BuildAsynchronousKernelMemoryApp(WebApplicationBui return appBuilder.Build(); } -} +} \ No newline at end of file diff --git a/src/KernelMemory.Ecommerce.Sample.Api/ServicesExtensions.cs b/src/KernelMemory.Ecommerce.Sample.Api/ServicesExtensions.cs index df9c5aa..479373b 100644 --- a/src/KernelMemory.Ecommerce.Sample.Api/ServicesExtensions.cs +++ b/src/KernelMemory.Ecommerce.Sample.Api/ServicesExtensions.cs @@ -25,4 +25,4 @@ public static IServiceCollection AddApplicationServices(this IServiceCollection return services; } -} +} \ No newline at end of file diff --git a/tests/KernelMemory.Ecommerce.Sample.FunctionalTests/Abstractions/TestWebAppFactory.cs b/tests/KernelMemory.Ecommerce.Sample.FunctionalTests/Abstractions/TestWebAppFactory.cs index 5e9c18e..4deb863 100644 --- a/tests/KernelMemory.Ecommerce.Sample.FunctionalTests/Abstractions/TestWebAppFactory.cs +++ b/tests/KernelMemory.Ecommerce.Sample.FunctionalTests/Abstractions/TestWebAppFactory.cs @@ -25,4 +25,4 @@ protected override void ConfigureWebHost(IWebHostBuilder builder) services.AddSingleton(ProductSearchOptions); }); } -} +} \ No newline at end of file diff --git a/tests/KernelMemory.Ecommerce.Sample.FunctionalTests/ProductIngestionTests.cs b/tests/KernelMemory.Ecommerce.Sample.FunctionalTests/ProductIngestionTests.cs index aff93a7..d8b6f82 100644 --- a/tests/KernelMemory.Ecommerce.Sample.FunctionalTests/ProductIngestionTests.cs +++ b/tests/KernelMemory.Ecommerce.Sample.FunctionalTests/ProductIngestionTests.cs @@ -105,4 +105,4 @@ private async Task> ReadProductIdsFromCsv(string filePath) var records = await csv.GetRecordsAsync().ToListAsync(); return records.Select(x => x.Id.ToString()).ToList(); } -} +} \ No newline at end of file diff --git a/tests/KernelMemory.Ecommerce.Sample.FunctionalTests/ProductRagSearchTests.cs b/tests/KernelMemory.Ecommerce.Sample.FunctionalTests/ProductRagSearchTests.cs index d1e0673..54cb780 100644 --- a/tests/KernelMemory.Ecommerce.Sample.FunctionalTests/ProductRagSearchTests.cs +++ b/tests/KernelMemory.Ecommerce.Sample.FunctionalTests/ProductRagSearchTests.cs @@ -143,4 +143,4 @@ public async Task ProductRagSearch_WithCorrectResponseFromKernel_ReturnsOkResult Assert.NotEmpty(searchResponse.Products); Assert.Contains(product, searchResponse.Products); } -} +} \ No newline at end of file diff --git a/tests/KernelMemory.Ecommerce.Sample.FunctionalTests/ProductVectorSearchTests.cs b/tests/KernelMemory.Ecommerce.Sample.FunctionalTests/ProductVectorSearchTests.cs index 0d9c30f..0ced29f 100644 --- a/tests/KernelMemory.Ecommerce.Sample.FunctionalTests/ProductVectorSearchTests.cs +++ b/tests/KernelMemory.Ecommerce.Sample.FunctionalTests/ProductVectorSearchTests.cs @@ -131,4 +131,4 @@ public async Task ProductRagSearch_WithCorrectResponseFromKernel_ReturnsOkResult Assert.NotEmpty(searchResponse.Products); Assert.Contains(product, searchResponse.Products); } -} +} \ No newline at end of file