refactor: explicit locked detekt config (#729)

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
- [x] 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)
- [x] Documentation 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
- [x] I have added appropriate error handling
- [x] I have added or updated documentation as needed
This commit is contained in:
Pavel Gorgulov 2026-04-29 12:31:49 +02:00 • committed by GitHub
commit 64804a05c2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 1106 additions and 507 deletions

View file

@ -27,9 +27,8 @@ import kotlinx.coroutines.yield
* communication of JSON-RPC messages. This is useful in scenarios where communication is
* message-based and channels are used as the underlying mechanism for delivery.
*
* @constructor Initializes the transport with the specified [SendChannel] and [ReceiveChannel].
* @property sendChannel The channel used to send JSON-RPC messages.
* @property receiveChannel The channel used to receive JSON-RPC messages.
* @param sendChannel The channel used to send JSON-RPC messages.
* @param receiveChannel The channel used to receive JSON-RPC messages.
* @param dispatcher The coroutine dispatcher for the event loop. Defaults to [Dispatchers.Default].
*/
@ExperimentalMcpApi
@ -75,11 +74,19 @@ public class ChannelTransport(
/**
* Creates a pair of interconnected [ChannelTransport] objects for bidirectional communication.
*
* This method sets up a client and server transport using Kotlin channels, enabling messages sent
* through one transport to be received by the other. It is typically used for testing or in-memory
* communication without external networking.
* Sets up a client and server transport using Kotlin channels, so that messages sent through one
* transport are received by the other. Typically used for testing or in-memory communication
* without external networking.
*
* Example:
* ```kotlin
* val (clientTransport, serverTransport) = ChannelTransport.createLinkedPair()
* server.connect(serverTransport)
* client.connect(clientTransport)
* ```
*
* @param capacity The buffer capacity of the internal channels used for communication. Defaults to 256.
* @param dispatcher The coroutine dispatcher for the event loop. Defaults to [Dispatchers.Default].
* @return A [LinkedTransports] instance containing the client and server transports.
*/
public fun createLinkedPair(
@ -106,7 +113,6 @@ public class ChannelTransport(
override suspend fun initialize() {
logger.info { "ChannelTransport starting message processing" }
val started = CompletableDeferred<Unit>()
@Suppress("TooGenericExceptionCaught")
scope.launch(CoroutineName("ChannelTransport#${hashCode()}-event-loop")) {
try {
// Signal that event loop has started, then yield to ensure we're ready

View file

@ -186,7 +186,6 @@ class ChannelTransportTest {
val id = ((msg as JSONRPCRequest).id as RequestId.NumberId).value.toInt()
received.add(id)
if (id == 2) {
@Suppress("TooGenericExceptionThrown")
throw RuntimeException("Error processing message 2")
}
if (received.size == 4) {