Skip to content

refactor: explicit locked detekt config#729

Merged
devcrocod merged 15 commits intomainfrom
devcrocod/config-detekt
Apr 29, 2026
Merged

refactor: explicit locked detekt config#729
devcrocod merged 15 commits intomainfrom
devcrocod/config-detekt

Conversation

@devcrocod
Copy link
Copy Markdown
Contributor

Migrate detekt to a convention plugin in buildSrc, switch the project to a fully explicit YAML config (buildUponDefaultConfig = false), fix the real findings that this stricter setup revealed, and remove @Suppress annotations that became unnecessary after the rule changes.

Motivation and Context

  • Explicit visibility into the rule set
  • Lock against detekt version upgrades

Breaking Changes

None

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

@devcrocod devcrocod force-pushed the devcrocod/config-detekt branch from f152fa2 to bd2bff8 Compare April 27, 2026 23:38
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors Detekt configuration to be explicitly defined and centrally applied via a buildSrc convention plugin, while updating code/KDoc and baselines to comply with (or baseline) the stricter ruleset.

Changes:

  • Introduce mcp.detekt convention plugin and apply it across modules; move Detekt plugin dependency into buildSrc.
  • Replace implicit/default Detekt rules with a fully explicit config/detekt/detekt.yml (buildUponDefaultConfig = false) and update/remap baselines accordingly.
  • Clean up codebase to satisfy the stricter configuration (remove unnecessary @Suppress, improve KDoc consistency, minor refactors).

Reviewed changes

Copilot reviewed 79 out of 80 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test-utils/src/jvmMain/kotlin/io/modelcontextprotocol/kotlin/test/utils/processUtils.kt Removes now-unnecessary suppression annotation.
test-utils/src/jvmMain/kotlin/io/modelcontextprotocol/kotlin/test/utils/TypeScriptRunner.kt Removes now-unnecessary suppression annotations.
test-utils/src/jvmMain/kotlin/io/modelcontextprotocol/kotlin/test/utils/Retry.kt Removes now-unnecessary suppression annotation.
test-utils/detekt-baseline.xml Removes old baseline file.
test-utils/detekt-baseline-main.xml Adds updated baseline for main source set findings.
test-utils/build.gradle.kts Applies new mcp.detekt convention plugin.
kotlin-sdk/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/package.kt Replaces package-level documentation with a stub placeholder.
kotlin-sdk-testing/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/testing/ChannelTransportTest.kt Removes now-unnecessary suppression annotation.
kotlin-sdk-testing/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/testing/ChannelTransport.kt KDoc updates; removes now-unnecessary suppression.
kotlin-sdk-testing/build.gradle.kts Applies new mcp.detekt convention plugin.
kotlin-sdk-server/src/jvmTest/kotlin/io/modelcontextprotocol/kotlin/sdk/server/StdioServerTransportTest.kt Removes unused suppressions for private helpers.
kotlin-sdk-server/src/jvmTest/kotlin/io/modelcontextprotocol/kotlin/sdk/server/AbstractKtorExtensionsTest.kt Removes now-unnecessary suppression annotation.
kotlin-sdk-server/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/server/WebSocketMcpKtorServerExtensions.kt Removes file-level TooManyFunctions suppression.
kotlin-sdk-server/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/server/StreamableHttpServerTransport.kt Removes suppressions; adds/adjusts documentation for sessionId.
kotlin-sdk-server/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/server/StdioServerTransport.kt Removes now-unnecessary suppressions in try/catch blocks.
kotlin-sdk-server/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/server/ServerSession.kt Improves class/property KDoc; removes TooManyFunctions suppression.
kotlin-sdk-server/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/server/Server.kt KDoc adjustments; removes suppressions; minor capability-check refactor.
kotlin-sdk-server/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/server/SSEServerTransport.kt Documents sessionId and constructor params.
kotlin-sdk-server/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/server/KtorServer.kt Removes file/function suppressions; keeps KDoc consistent.
kotlin-sdk-server/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/server/FeatureNotificationService.kt KDoc tweak; avoids unused lambda parameter warning.
kotlin-sdk-server/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/server/Feature.kt Adds missing property documentation.
kotlin-sdk-server/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/server/ClientConnection.kt Removes TooManyFunctions suppressions.
kotlin-sdk-server/detekt-baseline-main.xml Updates baseline to match new ruleset/scope.
kotlin-sdk-server/detekt-baseline-commonMainSourceSet.xml Removes old baseline file.
kotlin-sdk-server/build.gradle.kts Applies new mcp.detekt convention plugin.
kotlin-sdk-core/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/types/dsl/SamplingDslTest.kt Removes now-unnecessary suppression annotation.
kotlin-sdk-core/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/types/ToolsTest.kt Removes now-unnecessary suppression annotation.
kotlin-sdk-core/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/types/SamplingTest.kt Removes now-unnecessary suppression annotation.
kotlin-sdk-core/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/types/PrimitiveSchemaTest.kt Removes now-unnecessary deprecation suppressions.
kotlin-sdk-core/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/types/InitializeTest.kt Removes now-unnecessary suppression annotation.
kotlin-sdk-core/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/types/ElicitationTest.kt Removes now-unnecessary deprecation suppressions.
kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/utils/ResourceTemplateMatcher.kt Moves property docs inline for Detekt KDoc rules.
kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/utils/PathSegmentTemplateMatcher.kt KDoc normalization; removes now-unnecessary suppression.
kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/tools.kt Moves type docs inline.
kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/tasks.kt Adds inline KDoc for interface properties; clarifies meta accessor.
kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/serializers.kt Removes now-unnecessary suppressions in serializers.
kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/schema.kt Moves discriminator docs inline for schema types.
kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/roots.kt Adds meta convenience accessor doc.
kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/resources.kt Clarifies WithMeta usage and adds property docs.
kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/request.kt Moves property docs inline; clarifies metadata and pagination docs.
kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/notification.kt Moves interface/property docs inline; adds meta convenience accessor doc.
kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/methods.kt Moves property docs inline.
kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/jsonRpc.kt Moves jsonrpc property docs inline across message types.
kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/elicitation.kt Moves docs inline; adjusts suppress to match aliases; documents mode/type.
kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/content.kt Moves property docs inline for Detekt KDoc rules.
kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/completion.kt Adds meta accessor doc; clarifies request params KDoc.
kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/common.kt Moves interface/property docs inline; trims enum entry commentary.
kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/PingRequest.kt Fixes KDoc to refer to params; adds meta convenience accessor.
kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/McpException.kt KDoc normalization and tag alignment.
kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/shared/WebSocketMcpTransport.kt Removes now-unnecessary suppression annotation.
kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/shared/Transport.kt Fixes KDoc tags (@param vs @property) for function.
kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/shared/ReadBuffer.kt Removes now-unnecessary suppression; minor formatting.
kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/shared/Protocol.kt KDoc reshaping; minor assertion refactor (checkNotNull).
kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/shared/AbstractTransport.kt Expands class KDoc; removes property-name suppression.
kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/shared/AbstractClientTransport.kt KDoc alignment for parameters.
kotlin-sdk-core/detekt-baseline-main.xml Updates baseline to match new ruleset/scope.
kotlin-sdk-core/detekt-baseline-commonMainSourceSet.xml Removes old baseline file.
kotlin-sdk-core/build.gradle.kts Applies new mcp.detekt convention plugin.
kotlin-sdk-client/src/jvmTest/kotlin/io/modelcontextprotocol/kotlin/sdk/client/StreamableHttpClientTest.kt Removes inline suppressions and normalizes assignment formatting.
kotlin-sdk-client/src/jvmTest/kotlin/io/modelcontextprotocol/kotlin/sdk/client/MockMcp.kt Removes now-unnecessary suppression annotations.
kotlin-sdk-client/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/client/streamable/http/StreamableHttpClientTransportTest.kt Removes now-unnecessary deprecation suppression.
kotlin-sdk-client/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/client/StreamableHttpClientTransport.kt KDoc rewrite; removes suppressions; documents properties.
kotlin-sdk-client/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/client/StdioClientTransport.kt Removes suppression; minor lambda style tweak.
kotlin-sdk-client/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/client/Client.kt KDoc tag fix; removes suppressions; uses check/checkNotNull patterns.
kotlin-sdk-client/detekt-baseline-test.xml Removes old test baseline file.
kotlin-sdk-client/detekt-baseline-main.xml Updates baseline to match new ruleset/scope.
kotlin-sdk-client/detekt-baseline-commonTestSourceSet.xml Removes old baseline file.
kotlin-sdk-client/detekt-baseline-commonMainSourceSet.xml Removes old baseline file.
kotlin-sdk-client/build.gradle.kts Applies new mcp.detekt convention plugin.
integration-test/detekt-baseline-test.xml Removes old test baseline file.
integration-test/build.gradle.kts Applies new mcp.detekt convention plugin.
gradle/libs.versions.toml Bumps Detekt version; adds detekt-gradle plugin artifact; removes plugin alias entry.
conformance-test/src/main/kotlin/io/modelcontextprotocol/kotlin/sdk/conformance/ConformanceTools.kt Removes now-unnecessary suppression annotation.
config/detekt/detekt.yml Replaces partial config with fully explicit, locked Detekt configuration.
buildSrc/src/main/kotlin/mcp.multiplatform.gradle.kts Removes Detekt task dependency wiring from multiplatform convention.
buildSrc/src/main/kotlin/mcp.detekt.gradle.kts Adds new Detekt convention plugin with explicit config and task excludes.
buildSrc/build.gradle.kts Adds Detekt Gradle plugin dependency to buildSrc.
build.gradle.kts Stops applying Detekt plugin/config globally to subprojects (moved to convention plugin usage).
.github/workflows/build.yml Updates CI task list for Linux job.
.claude/skills/kdoc/SKILL.md Updates internal KDoc guidance to match stricter Detekt expectations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 1 to +3
package io.modelcontextprotocol.kotlin.sdk

private class Stub
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

private class Stub appears to be an unused placeholder and also removes the previous package-level/module documentation from this file. Consider restoring the package KDoc (or moving it to a Module.md/README) and deleting the stub class; leaving an unused private class around is likely to trigger unused-code checks if detekt is applied to this module later.

Copilot uses AI. Check for mistakes.
e5l
e5l previously approved these changes Apr 28, 2026
Copy link
Copy Markdown
Contributor

@e5l e5l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copilot AI review requested due to automatic review settings April 28, 2026 17:31
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 79 out of 80 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread buildSrc/src/main/kotlin/mcp.detekt.gradle.kts
Comment thread config/detekt/detekt.yml
@devcrocod devcrocod merged commit 64804a0 into main Apr 29, 2026
20 checks passed
@devcrocod devcrocod deleted the devcrocod/config-detekt branch April 29, 2026 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants