Skip to content

Commit b276f99

Browse files
committed
Fix future linting errors
1 parent 81ffa8b commit b276f99

File tree

14 files changed

+11
-37
lines changed

14 files changed

+11
-37
lines changed

build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ dependencies {
7272

7373
implementation("com.github.kittinunf.fuel:fuel:$fuelVersion")
7474

75-
//Database
75+
// Database
7676
implementation("org.postgresql:postgresql:$postgresVersion")
7777
implementation("com.h2database:h2:$h2Version")
7878
implementation("com.zaxxer:HikariCP:$hikariVersion")

settings.gradle.kts

-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
rootProject.name = "syfooversiktsrv"
2-

src/main/kotlin/no/nav/syfo/SyfooversiktApplication.kt

-4
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,10 @@ fun main() {
7878
server.start(wait = false)
7979
}
8080

81-
8281
lateinit var database: DatabaseInterface
8382
val state: ApplicationState = ApplicationState(running = false, initialized = false)
8483
val env: Environment = getEnvironment()
8584

86-
8785
fun Application.init() {
8886
isDev {
8987
database = DevDatabase(DbConfig(
@@ -155,7 +153,6 @@ fun Application.kafkaModule() {
155153
}
156154
}
157155

158-
159156
fun Application.serverModule() {
160157

161158
val env = getEnvironment()
@@ -245,7 +242,6 @@ fun Application.serverModule() {
245242
state.initialized = true
246243
}
247244

248-
249245
fun CoroutineScope.createListener(applicationState: ApplicationState, action: suspend CoroutineScope.() -> Unit): Job =
250246
launch {
251247
try {

src/main/kotlin/no/nav/syfo/db/Database.kt

+7-8
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,17 @@ import java.sql.ResultSet
99

1010
enum class Role {
1111
ADMIN, USER, READONLY;
12+
1213
override fun toString() = name.toLowerCase()
1314
}
1415

1516
data class DbConfig(
16-
val jdbcUrl: String,
17-
val password: String,
18-
val username: String,
19-
val databaseName: String,
20-
val poolSize: Int = 2,
21-
val runMigrationsOninit: Boolean = true
17+
val jdbcUrl: String,
18+
val password: String,
19+
val username: String,
20+
val databaseName: String,
21+
val poolSize: Int = 2,
22+
val runMigrationsOninit: Boolean = true
2223
)
2324

2425
class DevDatabase(daoConfig: DbConfig) : Database(daoConfig, null)
@@ -78,10 +79,8 @@ abstract class Database(val daoConfig: DbConfig, private val initBlock: ((contex
7879
dataSource(jdbcUrl, username, password)
7980
load().migrate()
8081
}
81-
8282
}
8383

84-
8584
fun <T> ResultSet.toList(mapper: ResultSet.() -> T) = mutableListOf<T>().apply {
8685
while (next()) {
8786
add(mapper())

src/main/kotlin/no/nav/syfo/db/VaultCredentialService.kt

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package no.nav.syfo.db
22

33
import com.bettercloud.vault.VaultException
4-
import com.zaxxer.hikari.HikariDataSource
54
import kotlinx.coroutines.delay
65
import no.nav.syfo.vault.Vault
76
import org.slf4j.LoggerFactory

src/main/kotlin/no/nav/syfo/kafka/Kafka.kt

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ private val objectMapper: ObjectMapper = ObjectMapper().apply {
3030
configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false)
3131
}
3232

33-
3433
private val LOG: Logger = LoggerFactory.getLogger("no.nav.syfo.Kafka")
3534

3635
suspend fun CoroutineScope.setupKafka(

src/main/kotlin/no/nav/syfo/metric/Metrics.kt

-12
Original file line numberDiff line numberDiff line change
@@ -18,39 +18,34 @@ val COUNT_CALL_TILGANGSKONTROLL_PERSONS_FAIL: Counter = Counter.build()
1818
.help("Counts the number of failed calls to syfo-tilgangskontroll - persons")
1919
.register()
2020

21-
2221
const val PERSONOVERSIKTSTATUS_ENHET_HENTET = "success_personoversikt_hentet_count"
2322
val COUNT_PERSONOVERSIKTSTATUS_ENHET_HENTET: Counter = Counter.build()
2423
.namespace(METRICS_NS)
2524
.name(PERSONOVERSIKTSTATUS_ENHET_HENTET)
2625
.help("Counts database.oppdaterPersonMedMotebehovBehandlet(oversiktHendelse) the number of completed calls to personoversikt/enhet/{enhet}")
2726
.register()
2827

29-
3028
const val METRIC_NAME_PERSONTILDELING_TILDEL = "call_persontildeling_tildel_count"
3129
val COUNT_PERSONTILDELING_TILDEL: Counter = Counter.build()
3230
.namespace(METRICS_NS)
3331
.name(METRIC_NAME_PERSONTILDELING_TILDEL)
3432
.help("Counts the number of POST-calls to endpoint persontildeling/registrer")
3533
.register()
3634

37-
3835
const val METRIC_NAME_PERSONTILDELING_TILDELT = "success_persontildeling_tildelt_count"
3936
val COUNT_PERSONTILDELING_TILDELT: Counter = Counter.build()
4037
.namespace(METRICS_NS)
4138
.name(METRIC_NAME_PERSONTILDELING_TILDELT)
4239
.help("Counts the number of updated in db completed as a result of calls to persontildeling/registrer")
4340
.register()
4441

45-
4642
const val OVERSIKTHENDELSE_UKJENT_MOTTATT = "oversikthendelse_ukjent_count"
4743
val COUNT_OVERSIKTHENDELSE_UKJENT_MOTTATT: Counter = Counter.build()
4844
.namespace(METRICS_NS)
4945
.name(OVERSIKTHENDELSE_UKJENT_MOTTATT)
5046
.help("Counts the number of oversikthendelse of unknown type received}")
5147
.register()
5248

53-
5449
const val OVERSIKTHENDELSE_MOTEBEHOV_SVAR_MOTTATT_OPPRETT = "oversikthendelse_motebehov_svar_mottatt_opprett_count"
5550
const val OVERSIKTHENDELSE_MOTEBEHOV_SVAR_MOTTATT_OPPDATER = "oversikthendelse_motebehov_svar_mottatt_oppdater_count"
5651
const val OVERSIKTHENDELSE_MOTEBEHOV_SVAR_MOTTATT_OPPDATER_ENHET = "oversikthendelse_motebehov_svar_mottatt_oppdater_enhet_count"
@@ -73,7 +68,6 @@ val COUNT_OVERSIKTHENDELSE_MOTEBEHOV_SVAR_MOTTATT_OPPDATER_ENHET: Counter = Coun
7368
.help("Counts the number of oversikthendelse of type motebehovsvar-mottatt resulting in update with new enhetId}")
7469
.register()
7570

76-
7771
const val OVERSIKTHENDELSE_MOTEBEHOV_SVAR_BEHANDLET = "oversikthendelse_motebehov_svar_behandlet_count"
7872
const val OVERSIKTHENDELSE_MOTEBEHOV_SVAR_BEHANDLET_OPPDATER_ENHET = "oversikthendelse_motebehov_svar_behandlet_oppdater_enhet_count"
7973
const val OVERSIKTHENDELSE_MOTEBEHOV_SVAR_BEHANDLET_FEILET = "oversikthendelse_motebehov_svar_behandlet_feilet_count"
@@ -96,7 +90,6 @@ val COUNT_OVERSIKTHENDELSE_MOTEBEHOVSSVAR_BEHANDLET_FEILET: Counter = Counter.bu
9690
.help("Counts the number of oversikthendelse of type motebehovsvar-behandlet that failed to update missing person")
9791
.register()
9892

99-
10093
const val OVERSIKTHENDELSE_MOTEPLANLEGGER_ALLE_SVAR_MOTTATT_OPPRETT = "oversikthendelse_moteplanlegger_alle_svar_mottatt_opprett_count"
10194
const val OVERSIKTHENDELSE_MOTEPLANLEGGER_ALLE_SVAR_MOTTATT_OPPDATER = "oversikthendelse_moteplanlegger_alle_svar_mottatt_oppdater_count"
10295
const val OVERSIKTHENDELSE_MOTEPLANLEGGER_ALLE_SVAR_MOTTATT_OPPDATER_ENHET = "oversikthendelse_moteplanlegger_alle_svar_mottatt_oppdater_enhet_count"
@@ -117,7 +110,6 @@ val COUNT_OVERSIKTHENDELSE_MOTEPLANLEGGER_ALLE_SVAR_MOTTATT_OPPDATER_ENHET: Coun
117110
.help("Counts the number of oversikthendelse of type moteplanlegger-alle-svar-mottatt resulting in update with new enhetId}")
118111
.register()
119112

120-
121113
const val OVERSIKTHENDELSE_MOTEPLANLEGGER_ALLE_SVAR_BEHANDLET_OPPDATER = "oversikthendelse_moteplanlegger_alle_svar_behandlet_oppdater_count"
122114
const val OVERSIKTHENDELSE_MOTEPLANLEGGER_ALLE_SVAR_BEHANDLET_OPPDATER_ENHET = "oversikthendelse_moteplanlegger_alle_svar_behandlet_oppdater_enhet_count"
123115
const val OVERSIKTHENDELSE_MOTEPLANLEGGER_ALLE_SVAR_BEHANDLET_FEILET = "oversikthendelse_moteplanlegger_alle_svar_behandlet_feilet_count"
@@ -138,15 +130,13 @@ val COUNT_OVERSIKTHENDELSE_MOTEPLANLEGGER_ALLE_SVAR_BEHANDLET_FEILET: Counter =
138130
.help("Counts the number of oversikthendelse of type moteplanlegger-alle-svar-behandlet that failed to update missing person")
139131
.register()
140132

141-
142133
const val OVERSIKTHENDELSETILFELLE_UGYLDIG_MOTTATT = "oversikthendelsetilfelle_ugyldig_mottatt"
143134
val COUNT_OVERSIKTHENDELSETILFELLE_UGDYLGIG_MOTTATT: Counter = Counter.build()
144135
.namespace(METRICS_NS)
145136
.name(OVERSIKTHENDELSETILFELLE_UGYLDIG_MOTTATT)
146137
.help("Counts the number of oversikthendelsetilfeller skipped due to invalid data}")
147138
.register()
148139

149-
150140
const val OVERSIKTHENDELSETILFELLE_INGEN_AKTIVITET_OPPRETT = "oversikthendelsetilfelle_ingen_aktivitet_opprett_count"
151141
const val OVERSIKTHENDELSETILFELLE_INGEN_AKTIVITET_OPPDATER = "oversikthendelsetilfelle_ingen_aktivitet_oppdater_count"
152142
const val OVERSIKTHENDELSETILFELLE_INGEN_AKTIVITET_ENHET = "oversikthendelsetilfelle_ingen_aktivitet_oppdater_enhet_count"
@@ -167,7 +157,6 @@ val COUNT_OVERSIKTHENDELSETILFELLE_INGEN_AKTIVITET_OPPDATER_ENHET: Counter = Cou
167157
.help("Counts the number of oversikthendelsetilfeller with Ingen Aktivitet resulting in update with new enhetId}")
168158
.register()
169159

170-
171160
const val OVERSIKTHENDELSETILFELLE_GRADERT_OPPRETT = "oversikthendelsetilfelle_gradert_opprett_count"
172161
const val OVERSIKTHENDELSETILFELLE_GRADERT_OPPDATER = "oversikthendelsetilfelle_gradert_oppdater_count"
173162
const val OVERSIKTHENDELSETILFELLE_GRADERT_OPPDATER_ENHET = "oversikthendelsetilfelle_gradert_oppdater_enhet_count"
@@ -188,7 +177,6 @@ val COUNT_OVERSIKTHENDELSETILFELLE_GRADERT_OPPDATER_ENHET: Counter = Counter.bui
188177
.help("Counts the number of graderte oversikthendelsetilfeller resulting in update with new enhetId}")
189178
.register()
190179

191-
192180
const val SYFOTILGANGSKONTROLL_HISTOGRAM_ENHET = "syfotilgangskontroll_histogram_enhet"
193181
const val SYFOTILGANGSKONTROLL_HISTOGRAM_PERSONER = "syfotilgangskontroll_histogram_personer"
194182

src/main/kotlin/no/nav/syfo/personstatus/PersonTildelingApi.kt

-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ fun Route.registerPersonTildelingApi(
4040
log.warn("Kan ikke hente tilknytninger: {}, {}", e.message, callIdArgument(getCallId()))
4141
call.respond(HttpStatusCode.BadRequest, e.message ?: "Kan ikke hente tilknytninger")
4242
}
43-
4443
}
4544

4645
post("/registrer") {

src/main/kotlin/no/nav/syfo/tilgangskontroll/TilgangskontrollConsumer.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class TilgangskontrollConsumer(
5151

5252
fun harVeilederTilgangTilEnhet(enhet: String, token: String, callId: String): Boolean {
5353
val requestTimer = HISTOGRAM_SYFOTILGANGSKONTROLL_ENHET.startTimer()
54-
val (_, response, _) = getTilgangskontrollUrl("$pathTilgangTilEnhet?${paramEnhet}=$enhet").httpGet()
54+
val (_, response, _) = getTilgangskontrollUrl("$pathTilgangTilEnhet?$paramEnhet=$enhet").httpGet()
5555
.header(mapOf(
5656
"Authorization" to bearerHeader(token),
5757
"Accept" to "application/json",

src/main/kotlin/no/nav/syfo/util/RequestUtil.kt

+1-3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,4 @@ fun callIdArgument(callId: String) = StructuredArguments.keyValue("callId", call
2323

2424
private val kafkaCounter = AtomicInteger(0)
2525

26-
fun kafkaCallId(): String
27-
= "${LocalDateTime.now().format(DateTimeFormatter.ofPattern("dd-MM-HHmm"))}-syfooversiktsrv-kafka-${kafkaCounter.incrementAndGet()}"
28-
26+
fun kafkaCallId(): String = "${LocalDateTime.now().format(DateTimeFormatter.ofPattern("dd-MM-HHmm"))}-syfooversiktsrv-kafka-${kafkaCounter.incrementAndGet()}"

src/main/kotlin/no/nav/syfo/vault/Vault.kt

-1
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,4 @@ object Vault {
6161
duration < MIN_REFRESH_MARGIN * 2 -> duration / 2
6262
else -> duration - MIN_REFRESH_MARGIN
6363
}
64-
6564
}

src/test/kotlin/no/nav/syfo/kafka/KafkaITSpek.kt

-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ object KafkaITSpek : Spek({
9494
consumer.poll(Duration.ofMillis(5000)).forEach {
9595
val hendelse: KOversikthendelse = objectMapper.readValue(it.value())
9696
messages.add(hendelse)
97-
9897
}
9998
messages.size shouldEqual 1
10099
messages.first() shouldEqual oversikthendelse

src/test/kotlin/no/nav/syfo/testutil/TestDB.kt

-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ fun Connection.opprettVeilederBrukerKnytning(veilederBrukerKnytning: VeilederBru
5959
}
6060
}
6161

62-
6362
fun Connection.tildelVeilederTilPerson(veilederBrukerKnytning: VeilederBrukerKnytning) {
6463
val updateQuery = """
6564
UPDATE PERSON_OVERSIKT_STATUS

src/test/kotlin/no/nav/syfo/testutil/TestEnvironment.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ val testEnvironment = Environment(
1717
syfotilgangskontrollUrl = "",
1818
clientid = "",
1919
syfoveilederUrl = ""
20-
)
20+
)

0 commit comments

Comments
 (0)