From bb952acd2efed9aea5e94258c2d6cd94540cb2b6 Mon Sep 17 00:00:00 2001 From: Levi Hoogenberg Date: Mon, 4 Nov 2024 16:36:44 +0100 Subject: [PATCH] changed Spotless formatting style to Kotlin default Signed-off-by: Levi Hoogenberg --- build.gradle.kts | 8 +++----- .../servicetemplate/kafka/MeasurementGenerator.kt | 6 ++++-- .../kafka/configuration/KafkaConfiguration.kt | 13 +++++++------ 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 749501e..ebf6f57 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -57,13 +57,11 @@ subprojects { extensions.configure { kotlin { // by default the target is every '.kt' and '.kts' file in the java source sets - ktfmt().dropboxStyle().configure { + ktfmt().kotlinlangStyle().configure { it.setMaxWidth(120) } - licenseHeaderFile( - "${project.rootDir}/license-template.kt", - "package") - .updateYearWithLatest(false) + + licenseHeaderFile("${project.rootDir}/license-template.kt", "package").updateYearWithLatest(false) } } diff --git a/components/kafka/src/main/kotlin/org/gxf/servicetemplate/kafka/MeasurementGenerator.kt b/components/kafka/src/main/kotlin/org/gxf/servicetemplate/kafka/MeasurementGenerator.kt index 78e9db1..b1ddd21 100644 --- a/components/kafka/src/main/kotlin/org/gxf/servicetemplate/kafka/MeasurementGenerator.kt +++ b/components/kafka/src/main/kotlin/org/gxf/servicetemplate/kafka/MeasurementGenerator.kt @@ -11,9 +11,11 @@ import org.springframework.stereotype.Service @Service class MeasurementGenerator { - fun generateMeasurement(deviceId: Long): Measurement { return Measurement( - Instant.now().toEpochMilli(), deviceId, listOf(VoltageMeasurement(Random.nextDouble(), "one"))) + Instant.now().toEpochMilli(), + deviceId, + listOf(VoltageMeasurement(Random.nextDouble(), "one")) + ) } } diff --git a/components/kafka/src/main/kotlin/org/gxf/servicetemplate/kafka/configuration/KafkaConfiguration.kt b/components/kafka/src/main/kotlin/org/gxf/servicetemplate/kafka/configuration/KafkaConfiguration.kt index 5fdbb2c..0e1b34a 100644 --- a/components/kafka/src/main/kotlin/org/gxf/servicetemplate/kafka/configuration/KafkaConfiguration.kt +++ b/components/kafka/src/main/kotlin/org/gxf/servicetemplate/kafka/configuration/KafkaConfiguration.kt @@ -18,11 +18,8 @@ import org.springframework.kafka.core.* @Configuration class KafkaConfiguration(val kafkaProperties: KafkaProperties, private val sslBundles: SslBundles) { - @Bean - fun kafkaListenerContainerFactory( - consumerFactory: ConsumerFactory - ): ConcurrentKafkaListenerContainerFactory = + fun kafkaListenerContainerFactory(consumerFactory: ConsumerFactory) = ConcurrentKafkaListenerContainerFactory().apply { this.consumerFactory = consumerFactory } @@ -35,10 +32,14 @@ class KafkaConfiguration(val kafkaProperties: KafkaProperties, private val sslBu DefaultKafkaConsumerFactory( kafkaProperties.buildConsumerProperties(sslBundles), StringDeserializer(), - AvroDeserializer(listOf(Measurement.getClassSchema()))) + AvroDeserializer(listOf(Measurement.getClassSchema())) + ) @Bean fun producerFactory(): ProducerFactory = DefaultKafkaProducerFactory( - kafkaProperties.buildProducerProperties(sslBundles), StringSerializer(), AvroSerializer()) + kafkaProperties.buildProducerProperties(sslBundles), + StringSerializer(), + AvroSerializer() + ) }