Skip to content

Commit 041201b

Browse files
committed
apply kotlinter v4
1 parent 3376763 commit 041201b

File tree

91 files changed

+1411
-1286
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+1411
-1286
lines changed

examples/ktor-example/src/main/kotlin/stove/ktor/example/Application.kt

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@ fun run(
3636
args: Array<String>,
3737
applicationOverrides: () -> Module = { module { } }
3838
): ApplicationEngine {
39-
val applicationEngine = embeddedServer(Netty, port = 8080, host = "0.0.0.0") {
40-
mainModule(args, applicationOverrides)
41-
}
39+
val applicationEngine =
40+
embeddedServer(Netty, port = 8080, host = "0.0.0.0") {
41+
mainModule(args, applicationOverrides)
42+
}
4243
applicationEngine.start(wait = false)
4344

4445
return applicationEngine
@@ -82,22 +83,25 @@ fun Application.mainModule(
8283
}
8384
}
8485

85-
fun dataModule(args: Array<String>) = module {
86-
val map = args.associate { it.split("=")[0] to it.split("=")[1] }
87-
single {
88-
val builder = PostgresqlConnectionConfiguration.builder().apply {
89-
host(map["database.host"]!!)
90-
database(map["database.databaseName"]!!)
91-
port(map["database.port"]!!.toInt())
92-
password(map["database.password"]!!)
93-
username(map["database.username"]!!)
86+
fun dataModule(args: Array<String>) =
87+
module {
88+
val map = args.associate { it.split("=")[0] to it.split("=")[1] }
89+
single {
90+
val builder =
91+
PostgresqlConnectionConfiguration.builder().apply {
92+
host(map["database.host"]!!)
93+
database(map["database.databaseName"]!!)
94+
port(map["database.port"]!!.toInt())
95+
password(map["database.password"]!!)
96+
username(map["database.username"]!!)
97+
}
98+
PostgresqlConnectionFactory(builder.connectTimeout(Duration.ofSeconds(10)).build())
9499
}
95-
PostgresqlConnectionFactory(builder.connectTimeout(Duration.ofSeconds(10)).build())
96100
}
97-
}
98101

99-
fun applicationModule() = module {
100-
singleOf(::JediRepository)
101-
singleOf(::JediService)
102-
singleOf(::MutexLockProvider) { bind<LockProvider>() }
103-
}
102+
fun applicationModule() =
103+
module {
104+
singleOf(::JediRepository)
105+
singleOf(::JediService)
106+
singleOf(::MutexLockProvider) { bind<LockProvider>() }
107+
}

examples/ktor-example/src/main/kotlin/stove/ktor/example/LockProvider.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import kotlinx.coroutines.sync.Mutex
44
import java.time.Duration
55

66
interface LockProvider {
7-
87
suspend fun acquireLock(
98
name: String,
109
duration: Duration
@@ -14,7 +13,6 @@ interface LockProvider {
1413
}
1514

1615
class MutexLockProvider : LockProvider {
17-
1816
private val mutex = Mutex()
1917

2018
override suspend fun acquireLock(

examples/ktor-example/src/test/kotlin/com/stove/ktor/example/e2e/ExampleTest.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ class ExampleTest : FunSpec({
2323
postgresql {
2424
shouldExecute(
2525
"""
26-
DROP TABLE IF EXISTS Jedis;
27-
CREATE TABLE IF NOT EXISTS Jedis (
28-
id serial PRIMARY KEY,
29-
name VARCHAR (50) NOT NULL
30-
);
26+
DROP TABLE IF EXISTS Jedis;
27+
CREATE TABLE IF NOT EXISTS Jedis (
28+
id serial PRIMARY KEY,
29+
name VARCHAR (50) NOT NULL
30+
);
3131
""".trimIndent()
3232
)
3333
shouldExecute("INSERT INTO Jedis (id, name) VALUES ('$givenId', 'Obi Wan Kenobi')")

examples/ktor-example/src/test/kotlin/com/stove/ktor/example/e2e/TestSystemConfig.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import org.slf4j.Logger
1212
import org.slf4j.LoggerFactory
1313

1414
class TestSystemConfig : AbstractProjectConfig() {
15-
1615
private val logger: Logger = LoggerFactory.getLogger("WireMockMonitor")
16+
1717
override suspend fun beforeProject() =
1818
TestSystem(baseUrl = "http://localhost:8080")
1919
.with {
@@ -40,9 +40,10 @@ class TestSystemConfig : AbstractProjectConfig() {
4040
)
4141
}
4242
ktor(
43-
withParameters = listOf(
44-
"ktor.server.port=8001"
45-
),
43+
withParameters =
44+
listOf(
45+
"ktor.server.port=8001"
46+
),
4647
runner = { parameters ->
4748
stove.ktor.example.run(parameters) {
4849
addTestSystemDependencies()

examples/ktor-example/src/test/kotlin/com/stove/ktor/example/e2e/TestSystemDIInterceptor.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ import org.koin.dsl.module
77
import stove.ktor.example.LockProvider
88
import java.time.Duration
99

10-
fun addTestSystemDependencies(): Module = module {
11-
singleOf(::NoOpLockProvider) { bind<LockProvider>() }
12-
}
10+
fun addTestSystemDependencies(): Module =
11+
module {
12+
singleOf(::NoOpLockProvider) { bind<LockProvider>() }
13+
}
1314

1415
class NoOpLockProvider : LockProvider {
1516
override suspend fun acquireLock(

examples/spring-example/src/main/kotlin/stove/spring/example/application/handlers/ProductCreator.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class ProductCreator(
2222
) {
2323
@Value("\${kafka.producer.product-created.topic-name}")
2424
lateinit var productCreatedTopic: String
25+
2526
suspend fun create(req: ProductCreateRequest): String {
2627
val supplierPermission = supplierHttpService.getSupplierPermission(req.id)
2728
if (!supplierPermission.isAllowed) {

examples/spring-example/src/main/kotlin/stove/spring/example/infrastructure/Constants.kt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ import java.net.UnknownHostException
66

77
class Defaults {
88
companion object {
9-
val HOST_NAME: String = try {
10-
InetAddress.getLocalHost().hostName
11-
} catch (e: UnknownHostException) {
12-
"stove-service-host"
13-
}
9+
val HOST_NAME: String =
10+
try {
11+
InetAddress.getLocalHost().hostName
12+
} catch (e: UnknownHostException) {
13+
"stove-service-host"
14+
}
1415

1516
const val AGENT_NAME = "stove-service"
1617
const val USER_EMAIL = "[email protected]"

examples/spring-example/src/main/kotlin/stove/spring/example/infrastructure/ObjectMapperConfig.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import org.springframework.context.annotation.Configuration
1010

1111
@Configuration
1212
class ObjectMapperConfig {
13-
1413
companion object {
1514
fun createObjectMapperWithDefaults(): ObjectMapper {
1615
val isoInstantModule = SimpleModule()

examples/spring-example/src/main/kotlin/stove/spring/example/infrastructure/api/ProductController.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,17 @@ import stove.spring.example.application.handlers.ProductCreator
1212
@RestController
1313
@RequestMapping("/api")
1414
class ProductController(private val productCreator: ProductCreator) {
15-
1615
@GetMapping("/index")
17-
suspend fun get(@RequestParam(required = false) keyword: String): String {
16+
suspend fun get(
17+
@RequestParam(required = false) keyword: String
18+
): String {
1819
return "Hi from Stove framework with $keyword"
1920
}
2021

2122
@PostMapping("/product/create")
22-
suspend fun createProduct(@RequestBody productCreateRequest: ProductCreateRequest): String {
23+
suspend fun createProduct(
24+
@RequestBody productCreateRequest: ProductCreateRequest
25+
): String {
2326
return productCreator.create(productCreateRequest)
2427
}
2528
}

examples/spring-example/src/main/kotlin/stove/spring/example/infrastructure/couchbase/CouchbaseConfiguration.kt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ class CouchbaseConfiguration(
2525
private val meterRegistry: MeterRegistry
2626
) {
2727
companion object {
28-
val objectMapper: ObjectMapper = ObjectMapperConfig.createObjectMapperWithDefaults()
29-
.registerModule(JsonValueModule())
28+
val objectMapper: ObjectMapper =
29+
ObjectMapperConfig.createObjectMapperWithDefaults()
30+
.registerModule(JsonValueModule())
3031
}
3132

3233
@Primary
@@ -50,9 +51,10 @@ class CouchbaseConfiguration(
5051
@Primary
5152
@Bean(destroyMethod = "disconnect")
5253
fun cluster(clusterEnvironment: ClusterEnvironment): ReactiveCluster {
53-
val clusterOptions = ClusterOptions
54-
.clusterOptions(couchbaseProperties.username, couchbaseProperties.password)
55-
.environment(clusterEnvironment)
54+
val clusterOptions =
55+
ClusterOptions
56+
.clusterOptions(couchbaseProperties.username, couchbaseProperties.password)
57+
.environment(clusterEnvironment)
5658

5759
return ReactiveCluster.connect(couchbaseProperties.hosts.joinToString(","), clusterOptions)
5860
}

0 commit comments

Comments
 (0)