Skip to content

Commit

Permalink
Merge pull request #21 from OSGP/feature/spotless
Browse files Browse the repository at this point in the history
changed Spotless formatting style to Kotlin default
  • Loading branch information
levi-h authored Nov 4, 2024
2 parents eb2ddf7 + bb952ac commit 53297a8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
8 changes: 3 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,11 @@ subprojects {
extensions.configure<SpotlessExtension> {
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)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,8 @@ import org.springframework.kafka.core.*

@Configuration
class KafkaConfiguration(val kafkaProperties: KafkaProperties, private val sslBundles: SslBundles) {

@Bean
fun kafkaListenerContainerFactory(
consumerFactory: ConsumerFactory<String, SpecificRecordBase>
): ConcurrentKafkaListenerContainerFactory<String, SpecificRecordBase> =
fun kafkaListenerContainerFactory(consumerFactory: ConsumerFactory<String, SpecificRecordBase>) =
ConcurrentKafkaListenerContainerFactory<String, SpecificRecordBase>().apply {
this.consumerFactory = consumerFactory
}
Expand All @@ -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<String, SpecificRecordBase> =
DefaultKafkaProducerFactory(
kafkaProperties.buildProducerProperties(sslBundles), StringSerializer(), AvroSerializer())
kafkaProperties.buildProducerProperties(sslBundles),
StringSerializer(),
AvroSerializer()
)
}

0 comments on commit 53297a8

Please sign in to comment.