From 3e7ea39bf70556154699bdfe483ca049a16b99aa Mon Sep 17 00:00:00 2001 From: Konstantin Pavlov <1517853+kpavlov@users.noreply.github.com> Date: Tue, 3 Mar 2026 23:46:32 +0200 Subject: [PATCH] chore: relax Detekt rules for tests (#582) - Updated `detekt.yml` to exclude test folders from `EmptyFunctionBlock`, `LargeClass`, and `LongMethod` checks. - Cleanup detekt-baseline files. - Simplified `.idea/detekt.xml`. ## Motivation and Context To reduce linter noise and reduce tension ## How Has This Been Tested? `./gradlew detekt` ## Breaking Changes No ## Types of changes - [x] Build tool/ci update ## Checklist - [x] I have read the [MCP Documentation](https://modelcontextprotocol.io) - [x] My code follows the repository's style guidelines - [x] New and existing tests pass locally - [ ] I have added appropriate error handling - [ ] I have added or updated documentation as needed ## Additional context #567 --- .idea/detekt.xml | 7 +------ config/detekt/detekt.yml | 15 +++++++++++++++ .../detekt-baseline-commonTestSourceSet.xml | 11 ----------- integration-test/detekt-baseline-test.xml | 15 --------------- .../detekt-baseline-commonTestSourceSet.xml | 1 - kotlin-sdk-client/detekt-baseline-test.xml | 2 -- 6 files changed, 16 insertions(+), 35 deletions(-) delete mode 100644 integration-test/detekt-baseline-commonTestSourceSet.xml diff --git a/.idea/detekt.xml b/.idea/detekt.xml index a408ca9..d89f908 100644 --- a/.idea/detekt.xml +++ b/.idea/detekt.xml @@ -1,14 +1,9 @@ - - \ No newline at end of file + diff --git a/config/detekt/detekt.yml b/config/detekt/detekt.yml index a7504c1..8c19749 100644 --- a/config/detekt/detekt.yml +++ b/config/detekt/detekt.yml @@ -3,3 +3,18 @@ config: warningsAsErrors: false checkExhaustiveness: false +complexity: + LargeClass: + excludes: &testFolders + - '**/test/**' + - '**/commonTest/**' + - '**/jvmTest/**' + - '**/jsTest/**' + - '**/iosTest/**' + LongMethod: + excludes: *testFolders + +empty-blocks: + EmptyFunctionBlock: + excludes: *testFolders + diff --git a/integration-test/detekt-baseline-commonTestSourceSet.xml b/integration-test/detekt-baseline-commonTestSourceSet.xml deleted file mode 100644 index 660fa66..0000000 --- a/integration-test/detekt-baseline-commonTestSourceSet.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - EmptyFunctionBlock:ClientTest.kt:ClientTest.<no name provided>${ } - EmptyFunctionBlock:ClientTest.kt:ClientTest.<no name provided>${} - LargeClass:ClientTest.kt:ClientTest - LongMethod:ClientTest.kt:ClientTest$@Test fun `JSONRPCRequest with ToolsList method and default params returns list of tools` - LongMethod:ClientTest.kt:ClientTest$@Test fun `should handle logging setLevel request` - - diff --git a/integration-test/detekt-baseline-test.xml b/integration-test/detekt-baseline-test.xml index 1e93fe0..710b729 100644 --- a/integration-test/detekt-baseline-test.xml +++ b/integration-test/detekt-baseline-test.xml @@ -7,8 +7,6 @@ AbstractClassCanBeConcreteClass:AbstractToolIntegrationTest.kt:AbstractToolIntegrationTest$AbstractToolIntegrationTest AbstractClassCanBeConcreteClass:BaseTransportTest.kt:BaseTransportTest$BaseTransportTest CyclomaticComplexMethod:AbstractToolIntegrationTest.kt:AbstractToolIntegrationTest$private fun setupCalculatorTool - EmptyFunctionBlock:ClientTest.kt:ClientTest.<no name provided>${ } - EmptyFunctionBlock:ClientTest.kt:ClientTest.<no name provided>${} ForbiddenComment:StdioClientTransportTest.kt:StdioClientTransportTest$// TODO: fix running on windows InjectDispatcher:AbstractKotlinClientTsServerTest.kt:AbstractKotlinClientTsServerTest$IO InjectDispatcher:AbstractPromptIntegrationTest.kt:AbstractPromptIntegrationTest$IO @@ -21,19 +19,6 @@ InjectDispatcher:StreamableHttpIntegrationTest.kt:StreamableHttpIntegrationTest$IO InjectDispatcher:TsEdgeCasesTestSse.kt:TsEdgeCasesTestSse$IO InjectDispatcher:WebSocketIntegrationTest.kt:WebSocketIntegrationTest$IO - LargeClass:AbstractToolIntegrationTest.kt:AbstractToolIntegrationTest : KotlinTestBase - LargeClass:ClientTest.kt:ClientTest - LongMethod:AbstractPromptIntegrationTest.kt:AbstractPromptIntegrationTest$@Test fun testMissingRequiredArguments - LongMethod:AbstractPromptIntegrationTest.kt:AbstractPromptIntegrationTest$override fun configureServer - LongMethod:AbstractResourceIntegrationTest.kt:AbstractResourceIntegrationTest$override fun configureServer - LongMethod:AbstractToolIntegrationTest.kt:AbstractToolIntegrationTest$private fun setupCalculatorTool - LongMethod:ClientTest.kt:ClientTest$@Test fun `JSONRPCRequest with ToolsList method and default params returns list of tools` - LongMethod:ClientTest.kt:ClientTest$@Test fun `should handle logging setLevel request` - LongMethod:KotlinServerForTsClientSse.kt:HttpServerTransport$suspend fun handleRequest - LongMethod:KotlinServerForTsClientSse.kt:KotlinServerForTsClient$fun createMcpServer: Server - LongMethod:KotlinServerForTsClientSse.kt:KotlinServerForTsClient$fun start - LongMethod:ServerResourcesNotificationSubscribeTest.kt:ServerResourcesNotificationSubscribeTest$@Test fun `should send resource notifications` - LongMethod:TsEdgeCasesTestSse.kt:TsEdgeCasesTestSse$@Test @Timeout(30, unit = TimeUnit.SECONDS) fun testComplexConcurrentRequests: Unit MatchingDeclarationName:PromptIntegrationTestSse.kt:SchemaPromptIntegrationTestSse : AbstractPromptIntegrationTest SleepInsteadOfDelay:KotlinServerForTsClientSse.kt:KotlinServerForTsClient$sleep(500) ThrowsCount:AbstractPromptIntegrationTest.kt:AbstractPromptIntegrationTest$override fun configureServer diff --git a/kotlin-sdk-client/detekt-baseline-commonTestSourceSet.xml b/kotlin-sdk-client/detekt-baseline-commonTestSourceSet.xml index b73eb9f..cab4322 100644 --- a/kotlin-sdk-client/detekt-baseline-commonTestSourceSet.xml +++ b/kotlin-sdk-client/detekt-baseline-commonTestSourceSet.xml @@ -2,7 +2,6 @@ - LongMethod:StreamableHttpClientTransportTest.kt:StreamableHttpClientTransportTest$@Ignore @Test fun testNotificationSchemaE2E MaxLineLength:StreamableHttpClientTransportTest.kt:StreamableHttpClientTransportTest$"""data: {"jsonrpc":"2.0","method":"notifications/progress","params":{"progressToken":"upload-123","progress":50,"total":100}}""" MaxLineLength:StreamableHttpClientTransportTest.kt:StreamableHttpClientTransportTest$"""data: {"jsonrpc":"2.0","method":"notifications/resumed","params":{"fromToken":"$lastEventIdSent"}}""" diff --git a/kotlin-sdk-client/detekt-baseline-test.xml b/kotlin-sdk-client/detekt-baseline-test.xml index 30a384a..b16e8eb 100644 --- a/kotlin-sdk-client/detekt-baseline-test.xml +++ b/kotlin-sdk-client/detekt-baseline-test.xml @@ -6,8 +6,6 @@ ForbiddenComment:StreamableHttpClientTest.kt:StreamableHttpClientTest$// TODO: how to get notifications via Client API? InjectDispatcher:StdioClientTransportErrorHandlingTest.kt:StdioClientTransportErrorHandlingTest$IO InjectDispatcher:StreamableHttpClientTransportTest.kt:StreamableHttpClientTransportTest$Default - LongMethod:StreamableHttpClientTest.kt:StreamableHttpClientTest$@Test fun `test streamableHttpClient` - LongMethod:StreamableHttpClientTransportTest.kt:StreamableHttpClientTransportTest$@Ignore @Test fun testNotificationSchemaE2E LongParameterList:MockMcp.kt:MockMcp$fun handleJSONRPCRequest LongParameterList:MockMcp.kt:MockMcp$fun handleWithResult LongParameterList:MockMcp.kt:MockMcp$fun onInitialize