From 70ae783d71139d4f455dcbb40a061c6a331906b3 Mon Sep 17 00:00:00 2001 From: Devis Lucato Date: Sun, 26 May 2024 15:42:33 -0700 Subject: [PATCH] Fix code style warnings and code clean up --- .../AnswerCorrectness/StatementEvaluation.cs | 2 ++ .../ContextRecall/GroundTruthClassification.cs | 2 ++ .../ContextRelevancy/ContextRelevancy.cs | 2 ++ .../Faithfulness/StatementEvaluation.cs | 2 ++ .../Evaluators/Relevance/RelevanceEvaluation.cs | 2 ++ .../Internals/TypeConverter.cs | 8 ++------ examples/001-dotnet-WebClient/Program.cs | 13 +++++-------- .../003-dotnet-SemanticKernel-plugin/Program.cs | 1 - examples/101-dotnet-custom-Prompts/Program.cs | 1 - .../106-dotnet-retrieve-synthetics/Program.cs | 1 - examples/109-dotnet-custom-webscraper/Program.cs | 2 -- .../111-dotnet-azure-ai-hybrid-search/Program.cs | 16 +++++++--------- .../Program.cs | 1 - .../Program.cs | 1 - .../Program.cs | 1 - examples/208-dotnet-lmstudio/Program.cs | 1 - .../Anthropic/Client/StreamingResponseMessage.cs | 4 +--- .../AzureAISearch.FunctionalTests/Startup.cs | 1 - .../AzureAISearch.UnitTests/Startup.cs | 1 - .../Additional/SearchTests.cs | 2 -- .../Elasticsearch.FunctionalTests/Startup.cs | 1 - .../Exceptions/ElasticsearchException.cs | 2 +- .../Exceptions/InvalidIndexNameException.cs | 2 +- .../LlamaSharp.FunctionalTests/Startup.cs | 1 - .../Internals/MongoDbAtlasSearchHelper.cs | 4 +--- .../Postgres.FunctionalTests/ConcurrencyTests.cs | 3 +-- .../Postgres/Postgres.FunctionalTests/Startup.cs | 1 - .../Postgres/Internals/PostgresDbClient.cs | 1 - extensions/Postgres/Postgres/PostgresConfig.cs | 1 - .../Qdrant/Qdrant.FunctionalTests/Startup.cs | 1 - extensions/Qdrant/Qdrant.UnitTests/Startup.cs | 1 - .../SQLServer.FunctionalTests/Startup.cs | 1 - .../TikToken/TikToken.UnitTests/Startup.cs | 1 - service/Abstractions/AI/Embedding.cs | 2 +- .../AppBuilders/ServiceCollectionExtensions.cs | 2 +- .../Configuration/ConfigurationException.cs | 2 +- .../Configuration/ConfigurationExtensions.cs | 2 +- .../Diagnostics/ArgumentNullExceptionEx.cs | 2 +- .../Diagnostics/ArgumentOutOfRangeExceptionEx.cs | 2 +- .../Abstractions/MemoryStorage/MemoryRecord.cs | 1 - service/Core/AI/DependencyInjection.cs | 2 +- service/Core/DataFormats/DependencyInjection.cs | 2 +- .../DevTools/DependencyInjection.cs | 2 +- service/Core/MemoryServerless.cs | 2 +- service/Core/MemoryService.cs | 2 +- .../DevTools/DependencyInjection.cs | 2 +- .../Queue/DevTools/DependencyInjection.cs | 2 +- service/Core/Search/DependencyInjection.cs | 2 +- service/Service.AspNetCore/WebAPIEndpoints.cs | 11 ++--------- service/Service/ServiceConfiguration.cs | 1 - service/tests/Abstractions.UnitTests/Startup.cs | 1 - .../OpenAITextEmbeddingGeneratorTest.cs | 1 - service/tests/Core.FunctionalTests/Startup.cs | 1 - .../VectorDbComparison/TestMemoryFilters.cs | 2 -- .../Extensions/BinaryDataExtensionsTest.cs | 1 - service/tests/Core.UnitTests/Startup.cs | 1 - service/tests/Service.FunctionalTests/Startup.cs | 1 - tools/InteractiveSetup/AppSettings.cs | 4 +--- tools/InteractiveSetup/Main.cs | 6 +++--- 59 files changed, 49 insertions(+), 94 deletions(-) diff --git a/applications/evaluation/Evaluators/AnswerCorrectness/StatementEvaluation.cs b/applications/evaluation/Evaluators/AnswerCorrectness/StatementEvaluation.cs index f831d31e0..8ecb96fa2 100644 --- a/applications/evaluation/Evaluators/AnswerCorrectness/StatementEvaluation.cs +++ b/applications/evaluation/Evaluators/AnswerCorrectness/StatementEvaluation.cs @@ -1,5 +1,7 @@ // Copyright (c) Microsoft. All rights reserved. +// ReSharper disable CheckNamespace + namespace Microsoft.KernelMemory.Evaluators.AnswerCorrectness; #pragma warning disable CA1812 // 'StatementEvaluation' is an internal class that is apparently never instantiated. If so, remove the code from the assembly. If this class is intended to contain only static members, make it 'static' (Module in Visual Basic). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1812) diff --git a/applications/evaluation/Evaluators/ContextRecall/GroundTruthClassification.cs b/applications/evaluation/Evaluators/ContextRecall/GroundTruthClassification.cs index b2a4c4cde..e29f41ce8 100644 --- a/applications/evaluation/Evaluators/ContextRecall/GroundTruthClassification.cs +++ b/applications/evaluation/Evaluators/ContextRecall/GroundTruthClassification.cs @@ -1,5 +1,7 @@ // Copyright (c) Microsoft. All rights reserved. +// ReSharper disable CheckNamespace + namespace Microsoft.KernelMemory.Evaluators.ContextRecall; #pragma warning disable CA1812 // 'GroundTruthClassification' is an internal class that is apparently never instantiated. If so, remove the code from the assembly. If this class is intended to contain only static members, make it 'static' (Module in Visual Basic). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1812) diff --git a/applications/evaluation/Evaluators/ContextRelevancy/ContextRelevancy.cs b/applications/evaluation/Evaluators/ContextRelevancy/ContextRelevancy.cs index 42a76aeb2..397763c99 100644 --- a/applications/evaluation/Evaluators/ContextRelevancy/ContextRelevancy.cs +++ b/applications/evaluation/Evaluators/ContextRelevancy/ContextRelevancy.cs @@ -1,5 +1,7 @@ // Copyright (c) Microsoft. All rights reserved. +// ReSharper disable CheckNamespace + namespace Microsoft.KernelMemory.Evaluators.ContextRelevancy; #pragma warning disable CA1812 // 'ContextRelevancy' is an internal class that is apparently never instantiated. If so, remove the code from the assembly. If this class is intended to contain only static members, make it 'static' (Module in Visual Basic). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1812) diff --git a/applications/evaluation/Evaluators/Faithfulness/StatementEvaluation.cs b/applications/evaluation/Evaluators/Faithfulness/StatementEvaluation.cs index 0a5e3be36..308317970 100644 --- a/applications/evaluation/Evaluators/Faithfulness/StatementEvaluation.cs +++ b/applications/evaluation/Evaluators/Faithfulness/StatementEvaluation.cs @@ -1,5 +1,7 @@ // Copyright (c) Microsoft. All rights reserved. +// ReSharper disable CheckNamespace + namespace Microsoft.KernelMemory.Evaluators.Faithfulness; #pragma warning disable CA1812 // 'StatementEvaluation' is an internal class that is apparently never instantiated. If so, remove the code from the assembly. If this class is intended to contain only static members, make it 'static' (Module in Visual Basic). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1812) diff --git a/applications/evaluation/Evaluators/Relevance/RelevanceEvaluation.cs b/applications/evaluation/Evaluators/Relevance/RelevanceEvaluation.cs index 39966f05b..fbe0aaed2 100644 --- a/applications/evaluation/Evaluators/Relevance/RelevanceEvaluation.cs +++ b/applications/evaluation/Evaluators/Relevance/RelevanceEvaluation.cs @@ -1,5 +1,7 @@ // Copyright (c) Microsoft. All rights reserved. +// ReSharper disable CheckNamespace + namespace Microsoft.KernelMemory.Evaluators.Relevance; #pragma warning disable CA1812 // 'RelevanceEvaluation' is an internal class that is apparently never instantiated. If so, remove the code from the assembly. If this class is intended to contain only static members, make it 'static' (Module in Visual Basic). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1812) diff --git a/clients/dotnet/SemanticKernelPlugin/Internals/TypeConverter.cs b/clients/dotnet/SemanticKernelPlugin/Internals/TypeConverter.cs index d0b2e51ce..cf1fd6f7a 100644 --- a/clients/dotnet/SemanticKernelPlugin/Internals/TypeConverter.cs +++ b/clients/dotnet/SemanticKernelPlugin/Internals/TypeConverter.cs @@ -9,14 +9,10 @@ namespace Microsoft.KernelMemory.SemanticKernelPlugin.Internals; [TypeConverter(typeof(TypeConverter))] -public class TagCollectionWrapper : TagCollection -{ -} +public class TagCollectionWrapper : TagCollection; [TypeConverter(typeof(TypeConverter))] -public class ListOfStringsWrapper : List -{ -} +public class ListOfStringsWrapper : List; #pragma warning disable CA1812 // required by SK internal sealed class TypeConverter : System.ComponentModel.TypeConverter diff --git a/examples/001-dotnet-WebClient/Program.cs b/examples/001-dotnet-WebClient/Program.cs index 8af10354c..437dee4e4 100644 --- a/examples/001-dotnet-WebClient/Program.cs +++ b/examples/001-dotnet-WebClient/Program.cs @@ -1,8 +1,5 @@ // Copyright (c) Microsoft. All rights reserved. -// ReSharper disable InconsistentNaming -// ReSharper disable CommentTypo - #pragma warning disable CS8602 // memory is initialized before usage #pragma warning disable CS0162 // unreachable code is managed via boolean settings @@ -504,18 +501,18 @@ Azure Active Directory (AAD) authentication mechanism. To test this locally, you // Download file and print details private static async Task DownloadFile() { - const string filename = "file1-Wikipedia-Carbon.txt"; + const string Filename = "file1-Wikipedia-Carbon.txt"; Console.WriteLine("Downloading file"); - StreamableFileContent result = await s_memory.ExportFileAsync(documentId: "doc001", fileName: filename); + StreamableFileContent result = await s_memory.ExportFileAsync(documentId: "doc001", fileName: Filename); var stream = new MemoryStream(); await (await result.GetStreamAsync()).CopyToAsync(stream); var bytes = stream.ToArray(); Console.WriteLine(); - Console.WriteLine("Original File name : " + filename); - Console.WriteLine("Original File size : " + new FileInfo(filename).Length); - Console.WriteLine("Original Bytes count: " + (await File.ReadAllBytesAsync(filename)).Length); + Console.WriteLine("Original File name : " + Filename); + Console.WriteLine("Original File size : " + new FileInfo(Filename).Length); + Console.WriteLine("Original Bytes count: " + (await File.ReadAllBytesAsync(Filename)).Length); Console.WriteLine(); Console.WriteLine("Downloaded File name : " + result.FileName); Console.WriteLine("Downloaded File type : " + result.FileType); diff --git a/examples/003-dotnet-SemanticKernel-plugin/Program.cs b/examples/003-dotnet-SemanticKernel-plugin/Program.cs index d36b82b79..b36a14ac3 100644 --- a/examples/003-dotnet-SemanticKernel-plugin/Program.cs +++ b/examples/003-dotnet-SemanticKernel-plugin/Program.cs @@ -6,7 +6,6 @@ public static class Program { - // ReSharper disable InconsistentNaming public static async Task Main() { const string DocFilename = "mydocs-NASA-news.pdf"; diff --git a/examples/101-dotnet-custom-Prompts/Program.cs b/examples/101-dotnet-custom-Prompts/Program.cs index f8da1bfdb..a8ce6adbd 100644 --- a/examples/101-dotnet-custom-Prompts/Program.cs +++ b/examples/101-dotnet-custom-Prompts/Program.cs @@ -5,7 +5,6 @@ public static class Program { - // ReSharper disable InconsistentNaming public static async Task Main() { var azureOpenAITextConfig = new AzureOpenAIConfig(); diff --git a/examples/106-dotnet-retrieve-synthetics/Program.cs b/examples/106-dotnet-retrieve-synthetics/Program.cs index 34edaa118..fae53ddb5 100644 --- a/examples/106-dotnet-retrieve-synthetics/Program.cs +++ b/examples/106-dotnet-retrieve-synthetics/Program.cs @@ -45,7 +45,6 @@ await memory.ImportDocumentAsync(new Document("doc1") Console.WriteLine($"== {result.SourceName} summary ==\n{result.Partitions.First().Text}\n"); } -// ReSharper disable CommentTypo /* OUTPUT: diff --git a/examples/109-dotnet-custom-webscraper/Program.cs b/examples/109-dotnet-custom-webscraper/Program.cs index 63937bf72..fafda53a0 100644 --- a/examples/109-dotnet-custom-webscraper/Program.cs +++ b/examples/109-dotnet-custom-webscraper/Program.cs @@ -1,7 +1,5 @@ // Copyright (c) Microsoft. All rights reserved. -// ReSharper disable InconsistentNaming - using Microsoft.KernelMemory; using Microsoft.KernelMemory.DataFormats.WebPages; diff --git a/examples/111-dotnet-azure-ai-hybrid-search/Program.cs b/examples/111-dotnet-azure-ai-hybrid-search/Program.cs index dfd07972f..a0419c94f 100644 --- a/examples/111-dotnet-azure-ai-hybrid-search/Program.cs +++ b/examples/111-dotnet-azure-ai-hybrid-search/Program.cs @@ -1,13 +1,11 @@ // Copyright (c) Microsoft. All rights reserved. -// ReSharper disable InconsistentNaming - using Microsoft.KernelMemory; using Microsoft.KernelMemory.AI.OpenAI; public static class Program { - private const string indexName = "acronyms"; + private const string IndexName = "acronyms"; public static async Task Main() { @@ -44,26 +42,26 @@ public static async Task Main() await CreateIndexAndImportData(memoryWithHybridSearch); - const string question = "abc"; + const string Question = "abc"; Console.WriteLine("Answer without hybrid search:"); - await AskQuestion(memoryNoHybridSearch, question); + await AskQuestion(memoryNoHybridSearch, Question); // Output: INFO NOT FOUND Console.WriteLine("Answer using hybrid search:"); - await AskQuestion(memoryWithHybridSearch, question); + await AskQuestion(memoryWithHybridSearch, Question); // Output: 'Aliens Brewing Coffee' } private static async Task AskQuestion(IKernelMemory memory, string question) { - var answer = await memory.AskAsync(question, index: indexName); + var answer = await memory.AskAsync(question, index: IndexName); Console.WriteLine(answer.Result); } private static async Task CreateIndexAndImportData(IKernelMemory memory) { - await memory.DeleteIndexAsync(indexName); + await memory.DeleteIndexAsync(IndexName); var data = """ aaa bbb ccc 000000000 @@ -77,7 +75,7 @@ A B C D first 4 letters var rows = data.Split("\n"); foreach (var acronym in rows) { - await memory.ImportTextAsync(acronym, index: indexName); + await memory.ImportTextAsync(acronym, index: IndexName); } } } diff --git a/examples/201-dotnet-serverless-custom-handler/Program.cs b/examples/201-dotnet-serverless-custom-handler/Program.cs index 372fe3368..d6031aff1 100644 --- a/examples/201-dotnet-serverless-custom-handler/Program.cs +++ b/examples/201-dotnet-serverless-custom-handler/Program.cs @@ -1,5 +1,4 @@ // Copyright (c) Microsoft. All rights reserved. -// ReSharper disable InconsistentNaming using Microsoft.KernelMemory; using Microsoft.KernelMemory.Diagnostics; diff --git a/examples/206-dotnet-configuration-and-logging/Program.cs b/examples/206-dotnet-configuration-and-logging/Program.cs index 63778f0a6..fb9c27734 100644 --- a/examples/206-dotnet-configuration-and-logging/Program.cs +++ b/examples/206-dotnet-configuration-and-logging/Program.cs @@ -4,7 +4,6 @@ public static class Program { - // ReSharper disable once InconsistentNaming public static async Task Main() { var openAIConfig = new OpenAIConfig diff --git a/examples/207-dotnet-expanding-chunks-on-retrieval/Program.cs b/examples/207-dotnet-expanding-chunks-on-retrieval/Program.cs index 3f3cd48ad..fabbf17c2 100644 --- a/examples/207-dotnet-expanding-chunks-on-retrieval/Program.cs +++ b/examples/207-dotnet-expanding-chunks-on-retrieval/Program.cs @@ -37,7 +37,6 @@ /// public static class Program { - // ReSharper disable once InconsistentNaming public static async Task Main() { // Partition input text in chunks of 100 tokens diff --git a/examples/208-dotnet-lmstudio/Program.cs b/examples/208-dotnet-lmstudio/Program.cs index e5b7e1562..3dcc04ac6 100644 --- a/examples/208-dotnet-lmstudio/Program.cs +++ b/examples/208-dotnet-lmstudio/Program.cs @@ -4,7 +4,6 @@ public static class Program { - // ReSharper disable once InconsistentNaming public static async Task Main() { // Using OpenAI for embeddings diff --git a/extensions/Anthropic/Client/StreamingResponseMessage.cs b/extensions/Anthropic/Client/StreamingResponseMessage.cs index ceef42335..fb61e7c39 100644 --- a/extensions/Anthropic/Client/StreamingResponseMessage.cs +++ b/extensions/Anthropic/Client/StreamingResponseMessage.cs @@ -2,6 +2,4 @@ namespace Microsoft.KernelMemory.AI.Anthropic.Client; -internal abstract class StreamingResponseMessage -{ -} +internal abstract class StreamingResponseMessage; diff --git a/extensions/AzureAISearch/AzureAISearch.FunctionalTests/Startup.cs b/extensions/AzureAISearch/AzureAISearch.FunctionalTests/Startup.cs index 33b9488c8..22bcb4fb4 100644 --- a/extensions/AzureAISearch/AzureAISearch.FunctionalTests/Startup.cs +++ b/extensions/AzureAISearch/AzureAISearch.FunctionalTests/Startup.cs @@ -7,7 +7,6 @@ namespace Microsoft.AzureAISearch.FunctionalTests; public class Startup { - // ReSharper disable once UnusedMember.Global public void ConfigureHost(IHostBuilder hostBuilder) { var config = new ConfigurationBuilder() diff --git a/extensions/AzureAISearch/AzureAISearch.UnitTests/Startup.cs b/extensions/AzureAISearch/AzureAISearch.UnitTests/Startup.cs index 7e00aef06..b852d3719 100644 --- a/extensions/AzureAISearch/AzureAISearch.UnitTests/Startup.cs +++ b/extensions/AzureAISearch/AzureAISearch.UnitTests/Startup.cs @@ -9,7 +9,6 @@ namespace Microsoft.AzureAISearch.UnitTests; public class Startup { - // ReSharper disable once UnusedMember.Global public void ConfigureHost(IHostBuilder hostBuilder) { } diff --git a/extensions/Elasticsearch/Elasticsearch.FunctionalTests/Additional/SearchTests.cs b/extensions/Elasticsearch/Elasticsearch.FunctionalTests/Additional/SearchTests.cs index 87e0d1631..397f346c3 100644 --- a/extensions/Elasticsearch/Elasticsearch.FunctionalTests/Additional/SearchTests.cs +++ b/extensions/Elasticsearch/Elasticsearch.FunctionalTests/Additional/SearchTests.cs @@ -85,8 +85,6 @@ public async Task CanGetListWithEmptyFiltersAsync() { } - ; - // If it gets here, the test passed. } } diff --git a/extensions/Elasticsearch/Elasticsearch.FunctionalTests/Startup.cs b/extensions/Elasticsearch/Elasticsearch.FunctionalTests/Startup.cs index 6149d0263..9071fd04d 100644 --- a/extensions/Elasticsearch/Elasticsearch.FunctionalTests/Startup.cs +++ b/extensions/Elasticsearch/Elasticsearch.FunctionalTests/Startup.cs @@ -7,7 +7,6 @@ namespace Microsoft.Elasticsearch.FunctionalTests; public class Startup { - // ReSharper disable once UnusedMember.Global public void ConfigureHost(IHostBuilder hostBuilder) { var config = new ConfigurationBuilder() diff --git a/extensions/Elasticsearch/Elasticsearch/Exceptions/ElasticsearchException.cs b/extensions/Elasticsearch/Elasticsearch/Exceptions/ElasticsearchException.cs index f38784ada..ce49d8bf9 100644 --- a/extensions/Elasticsearch/Elasticsearch/Exceptions/ElasticsearchException.cs +++ b/extensions/Elasticsearch/Elasticsearch/Exceptions/ElasticsearchException.cs @@ -1,6 +1,6 @@ // Copyright (c) Microsoft. All rights reserved. -// ReSharper disable CheckNamespace +// ReSharper disable once CheckNamespace - reduce number of "using" statements namespace Microsoft.KernelMemory.MemoryDb.Elasticsearch; diff --git a/extensions/Elasticsearch/Elasticsearch/Exceptions/InvalidIndexNameException.cs b/extensions/Elasticsearch/Elasticsearch/Exceptions/InvalidIndexNameException.cs index 5bbc35b28..443e37827 100644 --- a/extensions/Elasticsearch/Elasticsearch/Exceptions/InvalidIndexNameException.cs +++ b/extensions/Elasticsearch/Elasticsearch/Exceptions/InvalidIndexNameException.cs @@ -1,6 +1,6 @@ // Copyright (c) Microsoft. All rights reserved. -// ReSharper disable CheckNamespace +// ReSharper disable once CheckNamespace - reduce number of "using" statements namespace Microsoft.KernelMemory.MemoryDb.Elasticsearch; diff --git a/extensions/LlamaSharp/LlamaSharp.FunctionalTests/Startup.cs b/extensions/LlamaSharp/LlamaSharp.FunctionalTests/Startup.cs index 6963f7303..a6eb33f45 100644 --- a/extensions/LlamaSharp/LlamaSharp.FunctionalTests/Startup.cs +++ b/extensions/LlamaSharp/LlamaSharp.FunctionalTests/Startup.cs @@ -7,7 +7,6 @@ namespace Microsoft.LlamaSharp.FunctionalTests; public class Startup { - // ReSharper disable once UnusedMember.Global public void ConfigureHost(IHostBuilder hostBuilder) { var config = new ConfigurationBuilder() diff --git a/extensions/MongoDbAtlas/MongoDbAtlas/Internals/MongoDbAtlasSearchHelper.cs b/extensions/MongoDbAtlas/MongoDbAtlas/Internals/MongoDbAtlasSearchHelper.cs index c58361211..b6c366d34 100644 --- a/extensions/MongoDbAtlas/MongoDbAtlas/Internals/MongoDbAtlasSearchHelper.cs +++ b/extensions/MongoDbAtlas/MongoDbAtlas/Internals/MongoDbAtlasSearchHelper.cs @@ -96,9 +96,7 @@ public async Task DeleteIndicesAsync(string collectionName) { { "$listSearchIndexes", - new BsonDocument - { - } + new BsonDocument() } } }; diff --git a/extensions/Postgres/Postgres.FunctionalTests/ConcurrencyTests.cs b/extensions/Postgres/Postgres.FunctionalTests/ConcurrencyTests.cs index 1bebff0c2..b4650b90c 100644 --- a/extensions/Postgres/Postgres.FunctionalTests/ConcurrencyTests.cs +++ b/extensions/Postgres/Postgres.FunctionalTests/ConcurrencyTests.cs @@ -63,10 +63,9 @@ last_update TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP NOT NULL break; } - // ReSharper disable once CommentTypo /* If concurrency is not handled properly, the test should fail with * Npgsql.PostgresException - * 23505: duplicate key value violates unique constraint "pg_type_typname_nsp_index" + * 23505: duplicate key value violates unique constraint */ var concurrency = 20; var indexName = "create_index_test"; diff --git a/extensions/Postgres/Postgres.FunctionalTests/Startup.cs b/extensions/Postgres/Postgres.FunctionalTests/Startup.cs index 3a2905ffa..8b3d571d4 100644 --- a/extensions/Postgres/Postgres.FunctionalTests/Startup.cs +++ b/extensions/Postgres/Postgres.FunctionalTests/Startup.cs @@ -7,7 +7,6 @@ namespace Microsoft.Postgres.FunctionalTests; public class Startup { - // ReSharper disable once UnusedMember.Global public void ConfigureHost(IHostBuilder hostBuilder) { var config = new ConfigurationBuilder() diff --git a/extensions/Postgres/Postgres/Internals/PostgresDbClient.cs b/extensions/Postgres/Postgres/Internals/PostgresDbClient.cs index 658a30ed7..6ac76b69d 100644 --- a/extensions/Postgres/Postgres/Internals/PostgresDbClient.cs +++ b/extensions/Postgres/Postgres/Internals/PostgresDbClient.cs @@ -631,7 +631,6 @@ private void Dispose(bool disposing) { if (disposing) { - // ReSharper disable once ConditionalAccessQualifierIsNonNullableAccordingToAPIContract (this._dataSource as IDisposable)?.Dispose(); } } diff --git a/extensions/Postgres/Postgres/PostgresConfig.cs b/extensions/Postgres/Postgres/PostgresConfig.cs index 1731473fb..77c0a39b6 100644 --- a/extensions/Postgres/Postgres/PostgresConfig.cs +++ b/extensions/Postgres/Postgres/PostgresConfig.cs @@ -127,7 +127,6 @@ public PostgresConfig() /// public void Validate() { - // ReSharper disable ConditionalAccessQualifierIsNonNullableAccordingToAPIContract this.TableNamePrefix = this.TableNamePrefix?.Trim() ?? string.Empty; this.ConnectionString = this.ConnectionString?.Trim() ?? string.Empty; diff --git a/extensions/Qdrant/Qdrant.FunctionalTests/Startup.cs b/extensions/Qdrant/Qdrant.FunctionalTests/Startup.cs index f1b446883..b02b97248 100644 --- a/extensions/Qdrant/Qdrant.FunctionalTests/Startup.cs +++ b/extensions/Qdrant/Qdrant.FunctionalTests/Startup.cs @@ -7,7 +7,6 @@ namespace Microsoft.Qdrant.FunctionalTests; public class Startup { - // ReSharper disable once UnusedMember.Global public void ConfigureHost(IHostBuilder hostBuilder) { var config = new ConfigurationBuilder() diff --git a/extensions/Qdrant/Qdrant.UnitTests/Startup.cs b/extensions/Qdrant/Qdrant.UnitTests/Startup.cs index a5f70ff1a..fad581d83 100644 --- a/extensions/Qdrant/Qdrant.UnitTests/Startup.cs +++ b/extensions/Qdrant/Qdrant.UnitTests/Startup.cs @@ -9,7 +9,6 @@ namespace Microsoft.Qdrant.UnitTests; public class Startup { - // ReSharper disable once UnusedMember.Global public void ConfigureHost(IHostBuilder hostBuilder) { } diff --git a/extensions/SQLServer/SQLServer.FunctionalTests/Startup.cs b/extensions/SQLServer/SQLServer.FunctionalTests/Startup.cs index dfce760c2..81e555582 100644 --- a/extensions/SQLServer/SQLServer.FunctionalTests/Startup.cs +++ b/extensions/SQLServer/SQLServer.FunctionalTests/Startup.cs @@ -7,7 +7,6 @@ namespace Microsoft.SQLServer.FunctionalTests; public class Startup { - // ReSharper disable once UnusedMember.Global public void ConfigureHost(IHostBuilder hostBuilder) { var config = new ConfigurationBuilder() diff --git a/extensions/TikToken/TikToken.UnitTests/Startup.cs b/extensions/TikToken/TikToken.UnitTests/Startup.cs index 99a1a4f77..a5a30976c 100644 --- a/extensions/TikToken/TikToken.UnitTests/Startup.cs +++ b/extensions/TikToken/TikToken.UnitTests/Startup.cs @@ -9,7 +9,6 @@ namespace Microsoft.TikToken.UnitTests; public class Startup { - // ReSharper disable once UnusedMember.Global public void ConfigureHost(IHostBuilder hostBuilder) { } diff --git a/service/Abstractions/AI/Embedding.cs b/service/Abstractions/AI/Embedding.cs index 3b3f64ace..e44526722 100644 --- a/service/Abstractions/AI/Embedding.cs +++ b/service/Abstractions/AI/Embedding.cs @@ -9,7 +9,7 @@ #pragma warning disable IDE0130 // first class concept we want to have readily available #pragma warning disable CA2225 // no need for explicit methods -// ReSharper disable once CheckNamespace +// ReSharper disable once CheckNamespace - reduce number of "using" statements namespace Microsoft.KernelMemory; /// diff --git a/service/Abstractions/AppBuilders/ServiceCollectionExtensions.cs b/service/Abstractions/AppBuilders/ServiceCollectionExtensions.cs index 62228bb5f..e39a3afd3 100644 --- a/service/Abstractions/AppBuilders/ServiceCollectionExtensions.cs +++ b/service/Abstractions/AppBuilders/ServiceCollectionExtensions.cs @@ -4,7 +4,7 @@ using System.Linq; #pragma warning disable IDE0130 // reduce number of "using" statements -// ReSharper disable once CheckNamespace +// ReSharper disable once CheckNamespace - reduce number of "using" statements namespace Microsoft.Extensions.DependencyInjection; #pragma warning restore IDE0130 diff --git a/service/Abstractions/Configuration/ConfigurationException.cs b/service/Abstractions/Configuration/ConfigurationException.cs index 89953b177..5ad17f2da 100644 --- a/service/Abstractions/Configuration/ConfigurationException.cs +++ b/service/Abstractions/Configuration/ConfigurationException.cs @@ -2,7 +2,7 @@ using System; -// ReSharper disable CheckNamespace +// ReSharper disable once CheckNamespace - reduce number of "using" statements namespace Microsoft.KernelMemory; public class ConfigurationException : KernelMemoryException diff --git a/service/Abstractions/Configuration/ConfigurationExtensions.cs b/service/Abstractions/Configuration/ConfigurationExtensions.cs index f92bf4569..1571e1918 100644 --- a/service/Abstractions/Configuration/ConfigurationExtensions.cs +++ b/service/Abstractions/Configuration/ConfigurationExtensions.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft. All rights reserved. #pragma warning disable IDE0130 // reduce number of "using" statements -// ReSharper disable once CheckNamespace +// ReSharper disable once CheckNamespace - reduce number of "using" statements namespace Microsoft.Extensions.Configuration; #pragma warning restore IDE0130 diff --git a/service/Abstractions/Diagnostics/ArgumentNullExceptionEx.cs b/service/Abstractions/Diagnostics/ArgumentNullExceptionEx.cs index d39288005..2f1bb519e 100644 --- a/service/Abstractions/Diagnostics/ArgumentNullExceptionEx.cs +++ b/service/Abstractions/Diagnostics/ArgumentNullExceptionEx.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; -// ReSharper disable CheckNamespace +// ReSharper disable once CheckNamespace - reduce number of "using" statements namespace Microsoft.KernelMemory; #pragma warning disable CS8777 diff --git a/service/Abstractions/Diagnostics/ArgumentOutOfRangeExceptionEx.cs b/service/Abstractions/Diagnostics/ArgumentOutOfRangeExceptionEx.cs index eb57deced..f81cef9c3 100644 --- a/service/Abstractions/Diagnostics/ArgumentOutOfRangeExceptionEx.cs +++ b/service/Abstractions/Diagnostics/ArgumentOutOfRangeExceptionEx.cs @@ -3,7 +3,7 @@ using System; using System.Collections.Generic; -// ReSharper disable CheckNamespace +// ReSharper disable once CheckNamespace - reduce number of "using" statements namespace Microsoft.KernelMemory; public static class ArgumentOutOfRangeExceptionEx diff --git a/service/Abstractions/MemoryStorage/MemoryRecord.cs b/service/Abstractions/MemoryStorage/MemoryRecord.cs index 0d77332d1..11e462610 100644 --- a/service/Abstractions/MemoryStorage/MemoryRecord.cs +++ b/service/Abstractions/MemoryStorage/MemoryRecord.cs @@ -5,7 +5,6 @@ namespace Microsoft.KernelMemory.MemoryStorage; -// ReSharper disable ConditionIsAlwaysTrueOrFalseAccordingToNullableAPIContract public class MemoryRecord { // Memory Db Record schema versioning - Introduced after version 0.23.231218.1 diff --git a/service/Core/AI/DependencyInjection.cs b/service/Core/AI/DependencyInjection.cs index d83c30974..7bbdb231d 100644 --- a/service/Core/AI/DependencyInjection.cs +++ b/service/Core/AI/DependencyInjection.cs @@ -3,7 +3,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.KernelMemory.AI; -// ReSharper disable once CheckNamespace +// ReSharper disable once CheckNamespace - reduce number of "using" statements namespace Microsoft.KernelMemory; public static partial class KernelMemoryBuilderExtensions diff --git a/service/Core/DataFormats/DependencyInjection.cs b/service/Core/DataFormats/DependencyInjection.cs index 145db79d8..f177a5fff 100644 --- a/service/Core/DataFormats/DependencyInjection.cs +++ b/service/Core/DataFormats/DependencyInjection.cs @@ -8,7 +8,7 @@ using Microsoft.KernelMemory.DataFormats.Text; using Microsoft.KernelMemory.DataFormats.WebPages; -// ReSharper disable once CheckNamespace +// ReSharper disable once CheckNamespace - reduce number of "using" statements namespace Microsoft.KernelMemory; public static partial class KernelMemoryBuilderExtensions diff --git a/service/Core/DocumentStorage/DevTools/DependencyInjection.cs b/service/Core/DocumentStorage/DevTools/DependencyInjection.cs index 61052e5d2..e0717a854 100644 --- a/service/Core/DocumentStorage/DevTools/DependencyInjection.cs +++ b/service/Core/DocumentStorage/DevTools/DependencyInjection.cs @@ -5,7 +5,7 @@ using Microsoft.KernelMemory.DocumentStorage.DevTools; using Microsoft.KernelMemory.FileSystem.DevTools; -// ReSharper disable once CheckNamespace +// ReSharper disable once CheckNamespace - reduce number of "using" statements namespace Microsoft.KernelMemory; public static partial class KernelMemoryBuilderExtensions diff --git a/service/Core/MemoryServerless.cs b/service/Core/MemoryServerless.cs index 13e223ca4..d8f9ff78b 100644 --- a/service/Core/MemoryServerless.cs +++ b/service/Core/MemoryServerless.cs @@ -12,7 +12,7 @@ using Microsoft.KernelMemory.Pipeline; using Microsoft.KernelMemory.Search; -// ReSharper disable once CheckNamespace +// ReSharper disable once CheckNamespace - reduce number of "using" statements namespace Microsoft.KernelMemory; /// diff --git a/service/Core/MemoryService.cs b/service/Core/MemoryService.cs index d851f4f5e..818e3d6c4 100644 --- a/service/Core/MemoryService.cs +++ b/service/Core/MemoryService.cs @@ -12,7 +12,7 @@ using Microsoft.KernelMemory.Pipeline; using Microsoft.KernelMemory.Search; -// ReSharper disable once CheckNamespace +// ReSharper disable once CheckNamespace - reduce number of "using" statements namespace Microsoft.KernelMemory; public sealed class MemoryService : IKernelMemory diff --git a/service/Core/MemoryStorage/DevTools/DependencyInjection.cs b/service/Core/MemoryStorage/DevTools/DependencyInjection.cs index 2056c24df..95c9fea1a 100644 --- a/service/Core/MemoryStorage/DevTools/DependencyInjection.cs +++ b/service/Core/MemoryStorage/DevTools/DependencyInjection.cs @@ -5,7 +5,7 @@ using Microsoft.KernelMemory.MemoryStorage; using Microsoft.KernelMemory.MemoryStorage.DevTools; -// ReSharper disable once CheckNamespace +// ReSharper disable once CheckNamespace - reduce number of "using" statements namespace Microsoft.KernelMemory; public static partial class KernelMemoryBuilderExtensions diff --git a/service/Core/Pipeline/Queue/DevTools/DependencyInjection.cs b/service/Core/Pipeline/Queue/DevTools/DependencyInjection.cs index 56201cecf..45749f4e7 100644 --- a/service/Core/Pipeline/Queue/DevTools/DependencyInjection.cs +++ b/service/Core/Pipeline/Queue/DevTools/DependencyInjection.cs @@ -7,7 +7,7 @@ using Microsoft.KernelMemory.Pipeline.Queue; using Microsoft.KernelMemory.Pipeline.Queue.DevTools; -// ReSharper disable once CheckNamespace +// ReSharper disable once CheckNamespace - reduce number of "using" statements namespace Microsoft.KernelMemory; public static partial class KernelMemoryBuilderExtensions diff --git a/service/Core/Search/DependencyInjection.cs b/service/Core/Search/DependencyInjection.cs index 099598d48..99bced05e 100644 --- a/service/Core/Search/DependencyInjection.cs +++ b/service/Core/Search/DependencyInjection.cs @@ -3,7 +3,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.KernelMemory.Search; -// ReSharper disable once CheckNamespace +// ReSharper disable once CheckNamespace - reduce number of "using" statements namespace Microsoft.KernelMemory; public static partial class KernelMemoryBuilderExtensions diff --git a/service/Service.AspNetCore/WebAPIEndpoints.cs b/service/Service.AspNetCore/WebAPIEndpoints.cs index 0e7b44221..0d6d5e5c6 100644 --- a/service/Service.AspNetCore/WebAPIEndpoints.cs +++ b/service/Service.AspNetCore/WebAPIEndpoints.cs @@ -1,9 +1,5 @@ // Copyright (c) Microsoft. All rights reserved. -// ReSharper disable RedundantUsingDirective - -#pragma warning disable IDE0005 // temp - using System; using System.Collections.Generic; using System.Threading; @@ -385,11 +381,8 @@ public static void AddGetDownloadEndpoint(this IEndpointRouteBuilder builder, st if (authFilter != null) { route.AddEndpointFilter(authFilter); } } - // Class used to tag log entries and allow log filtering - // ReSharper disable once ClassNeverInstantiated.Local #pragma warning disable CA1812 // used by logger, can't be static - private sealed class KernelMemoryWebAPI - { - } + // Class used to tag log entries and allow log filtering + private sealed class KernelMemoryWebAPI; #pragma warning restore CA1812 } diff --git a/service/Service/ServiceConfiguration.cs b/service/Service/ServiceConfiguration.cs index 7c0069c82..258912096 100644 --- a/service/Service/ServiceConfiguration.cs +++ b/service/Service/ServiceConfiguration.cs @@ -178,7 +178,6 @@ private void ConfigureStorageDependency(IKernelMemoryBuilder builder) private void ConfigureTextPartitioning(IKernelMemoryBuilder builder) { - // ReSharper disable once ConditionIsAlwaysTrueOrFalseAccordingToNullableAPIContract if (this._memoryConfiguration.DataIngestion.TextPartitioning != null) { this._memoryConfiguration.DataIngestion.TextPartitioning.Validate(); diff --git a/service/tests/Abstractions.UnitTests/Startup.cs b/service/tests/Abstractions.UnitTests/Startup.cs index b81c2d742..31619e92a 100644 --- a/service/tests/Abstractions.UnitTests/Startup.cs +++ b/service/tests/Abstractions.UnitTests/Startup.cs @@ -9,7 +9,6 @@ namespace Microsoft.KM.Abstractions.UnitTests; public class Startup { - // ReSharper disable once UnusedMember.Global public void ConfigureHost(IHostBuilder hostBuilder) { } diff --git a/service/tests/Core.FunctionalTests/ServerLess/AIClients/OpenAITextEmbeddingGeneratorTest.cs b/service/tests/Core.FunctionalTests/ServerLess/AIClients/OpenAITextEmbeddingGeneratorTest.cs index 9d23ce4e8..fab60c2f3 100644 --- a/service/tests/Core.FunctionalTests/ServerLess/AIClients/OpenAITextEmbeddingGeneratorTest.cs +++ b/service/tests/Core.FunctionalTests/ServerLess/AIClients/OpenAITextEmbeddingGeneratorTest.cs @@ -6,7 +6,6 @@ namespace Microsoft.KM.Core.FunctionalTests.ServerLess.AIClients; -// ReSharper disable StringLiteralTypo public sealed class OpenAITextEmbeddingGeneratorTest : BaseFunctionalTestCase { private readonly OpenAITextEmbeddingGenerator _target; diff --git a/service/tests/Core.FunctionalTests/Startup.cs b/service/tests/Core.FunctionalTests/Startup.cs index 352298dfe..9af4e4bf5 100644 --- a/service/tests/Core.FunctionalTests/Startup.cs +++ b/service/tests/Core.FunctionalTests/Startup.cs @@ -7,7 +7,6 @@ namespace Microsoft.KM.Core.FunctionalTests; public class Startup { - // ReSharper disable once UnusedMember.Global public void ConfigureHost(IHostBuilder hostBuilder) { var config = new ConfigurationBuilder() diff --git a/service/tests/Core.FunctionalTests/VectorDbComparison/TestMemoryFilters.cs b/service/tests/Core.FunctionalTests/VectorDbComparison/TestMemoryFilters.cs index 7ec304cae..e1a1eb4ea 100644 --- a/service/tests/Core.FunctionalTests/VectorDbComparison/TestMemoryFilters.cs +++ b/service/tests/Core.FunctionalTests/VectorDbComparison/TestMemoryFilters.cs @@ -13,8 +13,6 @@ using StackExchange.Redis; using Xunit.Abstractions; -// ReSharper disable MissingBlankLines - namespace Microsoft.KM.Core.FunctionalTests.VectorDbComparison; public class TestMemoryFilters : BaseFunctionalTestCase diff --git a/service/tests/Core.UnitTests/Extensions/BinaryDataExtensionsTest.cs b/service/tests/Core.UnitTests/Extensions/BinaryDataExtensionsTest.cs index a6083586a..92e4d7950 100644 --- a/service/tests/Core.UnitTests/Extensions/BinaryDataExtensionsTest.cs +++ b/service/tests/Core.UnitTests/Extensions/BinaryDataExtensionsTest.cs @@ -6,7 +6,6 @@ namespace Microsoft.KM.Core.UnitTests.Extensions; -// ReSharper disable StringLiteralTypo public class BinaryDataExtensionsTest : BaseUnitTestCase { public BinaryDataExtensionsTest(ITestOutputHelper output) : base(output) diff --git a/service/tests/Core.UnitTests/Startup.cs b/service/tests/Core.UnitTests/Startup.cs index f60d1f0d3..d0829a797 100644 --- a/service/tests/Core.UnitTests/Startup.cs +++ b/service/tests/Core.UnitTests/Startup.cs @@ -9,7 +9,6 @@ namespace Microsoft.KM.Core.UnitTests; public class Startup { - // ReSharper disable once UnusedMember.Global public void ConfigureHost(IHostBuilder hostBuilder) { } diff --git a/service/tests/Service.FunctionalTests/Startup.cs b/service/tests/Service.FunctionalTests/Startup.cs index 9578ebeda..e80fe32e8 100644 --- a/service/tests/Service.FunctionalTests/Startup.cs +++ b/service/tests/Service.FunctionalTests/Startup.cs @@ -7,7 +7,6 @@ namespace Microsoft.KM.Service.FunctionalTests; public class Startup { - // ReSharper disable once UnusedMember.Global public void ConfigureHost(IHostBuilder hostBuilder) { var config = new ConfigurationBuilder() diff --git a/tools/InteractiveSetup/AppSettings.cs b/tools/InteractiveSetup/AppSettings.cs index d0ed348d6..9cbf517cd 100644 --- a/tools/InteractiveSetup/AppSettings.cs +++ b/tools/InteractiveSetup/AppSettings.cs @@ -116,9 +116,7 @@ private static void CreateFileIfNotExists() File.Create(DevelopmentSettingsFile).Dispose(); var data = new { - KernelMemory = new - { - }, + KernelMemory = new { }, Logging = new { LogLevel = new diff --git a/tools/InteractiveSetup/Main.cs b/tools/InteractiveSetup/Main.cs index 0bba57019..a4782e307 100644 --- a/tools/InteractiveSetup/Main.cs +++ b/tools/InteractiveSetup/Main.cs @@ -179,7 +179,7 @@ private static void EmbeddingGeneratorSetup(Context ctx) x.Retrieval.EmbeddingGeneratorType = "AzureOpenAIEmbedding"; x.DataIngestion.EmbeddingGeneratorTypes = ctx.CfgEmbeddingGenerationEnabled.Value ? new List { x.Retrieval.EmbeddingGeneratorType } - : new List { }; + : new List(); }); ctx.CfgAzureOpenAIEmbedding.Value = true; }), @@ -199,7 +199,7 @@ private static void EmbeddingGeneratorSetup(Context ctx) AppSettings.Change(x => { x.Retrieval.EmbeddingGeneratorType = ""; - x.DataIngestion.EmbeddingGeneratorTypes = new List { }; + x.DataIngestion.EmbeddingGeneratorTypes = new List(); }); }), new("-exit-", false, SetupUI.Exit), @@ -420,7 +420,7 @@ private static void MemoryDbTypeSetup(Context ctx) AppSettings.Change(x => { x.Retrieval.MemoryDbType = ""; - x.DataIngestion.MemoryDbTypes = new List { }; + x.DataIngestion.MemoryDbTypes = new List(); }); }), new("-exit-", false, SetupUI.Exit),