Skip to content

Commit 74ca404

Browse files
.Net: Exclude some code for which we don't need to add code coverage (#11772)
### Motivation and Context Core is very close to the code coverage threshold so excluding some functions from code coverage 1. CaptureUsageDetails 2. CreatePluginFromPromptDirectory no longer a recommended pattern 3. MemoryBuilder and SemanticTextMemory are being deprecated ### Description Before ![image](https://github.com/user-attachments/assets/49780beb-33b5-404e-95ec-cd4b6c52dab6) After ![image](https://github.com/user-attachments/assets/d131ce1c-f91d-4600-b2be-5889f3b54234) ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [ ] The code builds clean without any errors or warnings - [ ] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [ ] All unit tests pass, and I have added new tests where possible - [ ] I didn't break anyone 😄
1 parent 96962c9 commit 74ca404

File tree

4 files changed

+4
-0
lines changed

4 files changed

+4
-0
lines changed

dotnet/src/SemanticKernel.Core/Functions/KernelFunctionFromPrompt.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,7 @@ private async Task<PromptRenderingResult> RenderPromptAsync(
533533
/// <summary>
534534
/// Captures usage details, including token information.
535535
/// </summary>
536+
[ExcludeFromCodeCoverage]
536537
private void CaptureUsageDetails(string? modelId, IReadOnlyDictionary<string, object?>? metadata, ILogger logger)
537538
{
538539
if (!logger.IsEnabled(LogLevel.Information) &&

dotnet/src/SemanticKernel.Core/KernelExtensions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -929,6 +929,7 @@ public static KernelPlugin CreatePluginFromPromptDirectory(
929929
/// <summary>Creates a plugin containing one function per child directory of the specified <paramref name="pluginDirectory"/>.</summary>
930930
[RequiresUnreferencedCode("Uses reflection to handle various aspects of the function creation and invocation, making it incompatible with AOT scenarios.")]
931931
[RequiresDynamicCode("Uses reflection to handle various aspects of the function creation and invocation, making it incompatible with AOT scenarios.")]
932+
[ExcludeFromCodeCoverage]
932933
private static KernelPlugin CreatePluginFromPromptDirectory(
933934
string pluginDirectory,
934935
string? pluginName = null,

dotnet/src/SemanticKernel.Core/Memory/MemoryBuilder.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ namespace Microsoft.SemanticKernel.Memory;
1313
/// A builder for Memory plugin.
1414
/// </summary>
1515
[Experimental("SKEXP0001")]
16+
[ExcludeFromCodeCoverage]
1617
public sealed class MemoryBuilder
1718
{
1819
private Func<IMemoryStore>? _memoryStoreFactory = null;

dotnet/src/SemanticKernel.Core/Memory/SemanticTextMemory.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ namespace Microsoft.SemanticKernel.Memory;
1616
/// in a semantic memory store.
1717
/// </summary>
1818
[Experimental("SKEXP0001")]
19+
[ExcludeFromCodeCoverage]
1920
public sealed class SemanticTextMemory : ISemanticTextMemory
2021
{
2122
private readonly ITextEmbeddingGenerationService _embeddingGenerator;

0 commit comments

Comments
 (0)