diff --git a/.editorconfig b/.editorconfig index 93684b2..54b23c8 100644 --- a/.editorconfig +++ b/.editorconfig @@ -24,6 +24,10 @@ insert_final_newline = false #### .NET Coding Conventions #### [*.{cs,vb}] +# diagnostics +dotnet_diagnostic.IDE0058.severity = none +dotnet_diagnostic.CA1707.severity = none + # Organize usings dotnet_separate_import_directive_groups = true dotnet_sort_system_directives_first = true @@ -81,9 +85,9 @@ dotnet_remove_unnecessary_suppression_exclusions = none csharp_style_namespace_declarations = file_scoped:suggestion # var preferences -csharp_style_var_elsewhere = false:silent -csharp_style_var_for_built_in_types = false:silent -csharp_style_var_when_type_is_apparent = false:silent +csharp_style_var_elsewhere = true:suggestion +csharp_style_var_for_built_in_types = true:suggestion +csharp_style_var_when_type_is_apparent = true:suggestion # Expression-bodied members csharp_style_expression_bodied_accessors = true:silent @@ -121,7 +125,7 @@ csharp_style_pattern_local_over_anonymous_function = true:suggestion csharp_style_prefer_index_operator = true:suggestion csharp_style_prefer_range_operator = true:suggestion csharp_style_throw_expression = true:suggestion -csharp_style_unused_value_assignment_preference = discard_variable:suggestion +csharp_style_unused_value_assignment_preference = discard_variable:silent csharp_style_unused_value_expression_statement_preference = discard_variable:silent # 'using' directive preferences diff --git a/tests/AnthropicClient.Tests/EndToEnd/AnthropicApiClientTests.cs b/tests/AnthropicClient.Tests/EndToEnd/AnthropicApiClientTests.cs index 230e0d3..1e0bafb 100644 --- a/tests/AnthropicClient.Tests/EndToEnd/AnthropicApiClientTests.cs +++ b/tests/AnthropicClient.Tests/EndToEnd/AnthropicApiClientTests.cs @@ -83,7 +83,7 @@ public class AnthropicApiClientTests(ConfigurationFixture configFixture) : EndTo result.Value.Should().BeOfType(); result.Value.Content.Should().NotBeNullOrEmpty(); - var text = result.Value.Content.Aggregate("", (acc, content) => + var text = result.Value.Content.Aggregate("", static (acc, content) => { if (content is TextContent textContent) { @@ -122,7 +122,7 @@ public class AnthropicApiClientTests(ConfigurationFixture configFixture) : EndTo resultOne.IsSuccess.Should().BeTrue(); resultOne.Value.Should().BeOfType(); resultOne.Value.Content.Should().NotBeNullOrEmpty(); - resultOne.Value.Usage.Should().Match(u => u.CacheCreationInputTokens > 0 || u.CacheReadInputTokens > 0); + resultOne.Value.Usage.Should().Match(static u => u.CacheCreationInputTokens > 0 || u.CacheReadInputTokens > 0); request.Messages.Add(new(MessageRole.Assistant, resultOne.Value.Content)); request.Messages.Add(new(MessageRole.User, [new TextContent("What is the main theme of this story?")])); @@ -158,7 +158,7 @@ public class AnthropicApiClientTests(ConfigurationFixture configFixture) : EndTo resultOne.IsSuccess.Should().BeTrue(); resultOne.Value.Should().BeOfType(); resultOne.Value.Content.Should().NotBeNullOrEmpty(); - resultOne.Value.Usage.Should().Match(u => u.CacheCreationInputTokens > 0 || u.CacheReadInputTokens > 0); + resultOne.Value.Usage.Should().Match(static u => u.CacheCreationInputTokens > 0 || u.CacheReadInputTokens > 0); request.Messages.Add(new(MessageRole.Assistant, resultOne.Value.Content)); request.Messages.Add(new(MessageRole.User, [new TextContent("What is the main theme of this story?")])); @@ -236,7 +236,7 @@ public class AnthropicApiClientTests(ConfigurationFixture configFixture) : EndTo result.Value.Should().BeOfType(); result.Value.Content.Should().NotBeNullOrEmpty(); - var text = result.Value.Content.Aggregate("", (acc, content) => + var text = result.Value.Content.Aggregate("", static (acc, content) => { if (content is TextContent textContent) { @@ -273,7 +273,7 @@ public class AnthropicApiClientTests(ConfigurationFixture configFixture) : EndTo resultOne.IsSuccess.Should().BeTrue(); resultOne.Value.Should().BeOfType(); resultOne.Value.Content.Should().NotBeNullOrEmpty(); - resultOne.Value.Usage.Should().Match(u => u.CacheCreationInputTokens > 0 || u.CacheReadInputTokens > 0); + resultOne.Value.Usage.Should().Match(static u => u.CacheCreationInputTokens > 0 || u.CacheReadInputTokens > 0); request.Messages.Add(new(MessageRole.Assistant, resultOne.Value.Content)); request.Messages.Add(new(MessageRole.User, [new TextContent("What is the main theme of this paper?")])); @@ -312,7 +312,7 @@ public class AnthropicApiClientTests(ConfigurationFixture configFixture) : EndTo var result = await _client.CreateMessageAsync(request); result.IsSuccess.Should().BeTrue(); - result.Value.Content.OfType().SelectMany(c => c.Citations).Should().NotBeEmpty(); + result.Value.Content.OfType().SelectMany(static c => c.Citations).Should().NotBeEmpty(); } [Fact]