Skip to content

Commit 1ec9f99

Browse files
authored
Upgrade ktlint (#167)
1 parent 537ff32 commit 1ec9f99

22 files changed

+47
-45
lines changed

.editorconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[*.{kt,kts}]
2-
disabled_rules=import-ordering,no-wildcard-imports
2+
ktlint_disabled_rules=import-ordering,no-wildcard-imports,trailing-comma-on-call-site,trailing-comma-on-declaration-site,multiline-if-else,filename

build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ plugins {
4141
java
4242
kotlin("jvm") version "1.8.20"
4343
id("com.github.johnrengelman.shadow") version "8.1.1"
44-
id("org.jlleitschuh.gradle.ktlint") version "10.3.0"
44+
id("org.jlleitschuh.gradle.ktlint") version "11.3.1"
4545
}
4646

4747
val githubUser: String by project

src/main/kotlin/no/nav/syfo/application/BlockingApplicationRunner.kt

+3-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ class BlockingApplicationRunner(
101101
logger.info("Received message, {}", StructuredArguments.fields(loggingMeta))
102102
if (innbyggerIdent.isNullOrEmpty() || !elevenDigits.matches(innbyggerIdent)) {
103103
handlePatientMissing(
104-
mqSender, fellesformat, loggingMeta,
104+
mqSender,
105+
fellesformat,
106+
loggingMeta,
105107
)
106108
return null
107109
}

src/main/kotlin/no/nav/syfo/application/DialogmeldingProcessor.kt

+3-1
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,9 @@ class DialogmeldingProcessor(
252252
if (dialogmeldingDokumentWithShaExists(receivedDialogmelding.dialogmelding.id, sha256String, database)) {
253253
val tidMottattOpprinneligMelding = database.hentMottattTidspunkt(sha256String)
254254
handleDuplicateDialogmeldingContent(
255-
loggingMeta, sha256String, tidMottattOpprinneligMelding
255+
loggingMeta,
256+
sha256String,
257+
tidMottattOpprinneligMelding,
256258
)
257259
} else if (!innbyggerOK) {
258260
handlePatientNotFound(loggingMeta)
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package no.nav.syfo.apprec
22

33
enum class ApprecConstant(val string: String) {
4-
apprec("APPREC"),
5-
apprecVersionV1_0("1.0 2004-11-21"),
6-
ebRoleSaksbehandler("Saksbehandler"),
7-
ebActionBekreftelse("Bekreftelse")
4+
APPREC("APPREC"),
5+
APPREC_VERSION_V1_0("1.0 2004-11-21"),
6+
EB_ROLE_SAKSBEHANDLER("Saksbehandler"),
7+
EB_ACTION_BEKREFTELSE("Bekreftelse")
88
}

src/main/kotlin/no/nav/syfo/apprec/ApprecMapper.kt

+4-4
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@ fun createApprec(fellesformat: XMLEIFellesformat, apprecStatus: ApprecStatus): X
2626
any.add(
2727
XMLMottakenhetBlokk().apply {
2828
ediLoggId = xmlMottakenhetBlokk.ediLoggId
29-
ebRole = ApprecConstant.ebRoleSaksbehandler.string
29+
ebRole = ApprecConstant.EB_ROLE_SAKSBEHANDLER.string
3030
ebService = xmlMottakenhetBlokk.ebService
31-
ebAction = ApprecConstant.ebActionBekreftelse.string
31+
ebAction = ApprecConstant.EB_ACTION_BEKREFTELSE.string
3232
}
3333
)
3434
any.add(
3535
XMLAppRec().apply {
3636
msgType = XMLCS().apply {
37-
v = ApprecConstant.apprec.string
37+
v = ApprecConstant.APPREC.string
3838
}
39-
miGversion = ApprecConstant.apprecVersionV1_0.string
39+
miGversion = ApprecConstant.APPREC_VERSION_V1_0.string
4040
genDate = LocalDateTime.now()
4141
id = xmlMottakenhetBlokk.ediLoggId
4242

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

33
enum class ApprecStatus(val v: String, val dn: String) {
4-
avvist("2", "Avvist"),
5-
ok("1", "OK")
4+
AVVIST("2", "Avvist"),
5+
OK("1", "OK")
66
}

src/main/kotlin/no/nav/syfo/handlestatus/HandleStatusInvalid.kt

+5-6
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ suspend fun handleStatusINVALID(
3636
navnSignerendeLege: String,
3737
innbyggerOK: Boolean,
3838
) {
39-
4039
if (innbyggerOK && !validationResult.isDuplicate()) {
4140
journalService.onJournalRequest(
4241
receivedDialogmelding,
@@ -61,7 +60,7 @@ suspend fun handleStatusINVALID(
6160
sendReceipt(
6261
mqSender = mqSender,
6362
fellesformat = fellesformat,
64-
apprecStatus = ApprecStatus.avvist,
63+
apprecStatus = ApprecStatus.AVVIST,
6564
apprecErrors = run {
6665
val errors = mutableListOf<XMLCV>()
6766
errors.addAll(validationResult.ruleHits.map { it.toApprecCV() })
@@ -151,10 +150,12 @@ fun handlePatientMissing(
151150
)
152151

153152
sendReceipt(
154-
mqSender, fellesformat, ApprecStatus.avvist,
153+
mqSender,
154+
fellesformat,
155+
ApprecStatus.AVVIST,
155156
listOf(
156157
createApprecError("Pasienten er ikke funnet i dialogmeldingen eller fnr er ugyldig")
157-
)
158+
),
158159
)
159160
logger.info("Apprec Receipt with status Avvist sent, {}", fields(loggingMeta))
160161

@@ -219,7 +220,6 @@ fun handleTestFnrInProd(
219220
fun handleMeldingsTekstMangler(
220221
loggingMeta: LoggingMeta
221222
): ValidationResult {
222-
223223
logger.warn(
224224
"TekstNotatInnhold mangler {}",
225225
createLogEntry(
@@ -246,7 +246,6 @@ fun handleMeldingsTekstMangler(
246246
fun handleInvalidDialogMeldingKodeverk(
247247
loggingMeta: LoggingMeta
248248
): ValidationResult {
249-
250249
logger.warn(
251250
"Det er brukt ein ugyldig kombinasjon av dialogmelding kodeverk {}",
252251
createLogEntry(

src/main/kotlin/no/nav/syfo/handlestatus/HandleStatusOK.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ suspend fun handleStatusOK(
7171
}
7272

7373
if (!database.erDialogmeldingOpplysningerSendtApprec(receivedDialogmelding.dialogmelding.id)) {
74-
sendReceipt(mqSender, fellesformat, ApprecStatus.ok)
74+
sendReceipt(mqSender, fellesformat, ApprecStatus.OK)
7575
logger.info("Apprec Receipt with status OK sent, {}", StructuredArguments.fields(loggingMeta))
7676
database.lagreSendtApprec(receivedDialogmelding.dialogmelding.id)
7777
}

src/main/kotlin/no/nav/syfo/model/DialogmeldingMapper.kt

-3
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ fun DialogmeldingKodeverk.toTypeMelding(): TemaKode {
8383
}
8484

8585
fun XMLNotat.toInnkallingMoterespons(): InnkallingMoterespons? {
86-
8786
return temaKodet.toTemaKode()?.let { it ->
8887
InnkallingMoterespons(
8988
temaKode = it,
@@ -95,7 +94,6 @@ fun XMLNotat.toInnkallingMoterespons(): InnkallingMoterespons? {
9594
}
9695

9796
fun XMLNotat.toForesporselFraSaksbehandlerForesporselSvar(): ForesporselFraSaksbehandlerForesporselSvar? {
98-
9997
return temaKodet.toTemaKode()?.let { it ->
10098
ForesporselFraSaksbehandlerForesporselSvar(
10199
temaKode = it,
@@ -107,7 +105,6 @@ fun XMLNotat.toForesporselFraSaksbehandlerForesporselSvar(): ForesporselFraSaksb
107105
}
108106

109107
fun XMLForesporsel.toForesporsel(): Foresporsel {
110-
111108
val description = typeForesp.dn ?: ""
112109

113110
return Foresporsel(

src/main/kotlin/no/nav/syfo/model/DialogmeldingType.kt

+9-6
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,33 @@ import no.nav.syfo.logger
44

55
enum class DialogmeldingType(val ebxmlService: String, val ebxmlAction: String, val dialogmeldingKodeverk: List<DialogmeldingKodeverk>, val brevkode: String) {
66
DIALOGMELDING_DIALOGMOTE_INNKALLING_MOTERESPONS(
7-
"DialogmoteInnkalling", "MoteRespons",
7+
"DialogmoteInnkalling",
8+
"MoteRespons",
89
listOf(
910
DialogmeldingKodeverk.SVAR_PAA_INNKALLING_DIALOGMOTE_JA_JEG_KOMMER,
1011
DialogmeldingKodeverk.SVAR_PAA_INNKALLING_DIALOGMOTE_JEG_ONSKER_NY_TID,
1112
DialogmeldingKodeverk.SVAR_PAA_INNKALLING_DIALOGMOTE_NEI_JEG_KAN_IKKE_KOMME
1213
),
13-
"900005"
14+
"900005",
1415
),
1516
DIALOGMELDING_FORESPORSEL_FRA_SAKSBEHANDLER_FORESPORSEL_SVAR(
16-
"ForesporselFraSaksbehandler", "ForesporselSvar",
17+
"ForesporselFraSaksbehandler",
18+
"ForesporselSvar",
1719
listOf(
1820
DialogmeldingKodeverk.FORESPORSEL_OM_PASIENT_FORESPORSEL_OM_PASIENT,
1921
DialogmeldingKodeverk.FORESPORSEL_OM_PASIENT_PAAMINNELSE_FORESPORSEL_OM_PASIENT,
2022
DialogmeldingKodeverk.OVERFORING_EPJ_INFORMASJON_SVAR_PAA_FORESPORSEL_OM_PASIENT
2123
),
22-
"900006"
24+
"900006",
2325
),
2426
DIALOGMELDING_HENVENDELSE_FRA_LEGE_HENDVENDELSE(
25-
"HenvendelseFraLege", "Henvendelse",
27+
"HenvendelseFraLege",
28+
"Henvendelse",
2629
listOf(
2730
DialogmeldingKodeverk.HENVENDELSE_OM_PASIENT_HENVENDELSE_IKKE_SYKMELDT_PASIENT,
2831
DialogmeldingKodeverk.HENVENDELSE_OM_PASIENT_HENVENDELSE_OM_SYKEFRAVARSOPPFOLGING
2932
),
30-
"900007"
33+
"900007",
3134
)
3235
}
3336

src/main/kotlin/no/nav/syfo/model/Vedlegg.kt

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ data class Vedlegg(
1010
)
1111

1212
fun XMLDocument.toVedlegg(): Vedlegg {
13-
1413
val base64Container = refDoc.content.any[0] as Base64Container
1514

1615
return Vedlegg(

src/main/kotlin/no/nav/syfo/persistering/HandleRecivedMessage.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ fun persistReceivedMessage(
1515
loggingMeta: LoggingMeta,
1616
database: DatabaseInterface,
1717
) {
18-
1918
if (database.erDialogmeldingOpplysningerLagret(
2019
receivedDialogmelding.dialogmelding.id
2120
)
2221
) {
2322
logger.warn(
2423
"Dialogmelding med dialogmeldingid {}, er allerede lagret i databasen, {}",
25-
receivedDialogmelding.dialogmelding.id, StructuredArguments.fields(loggingMeta)
24+
receivedDialogmelding.dialogmelding.id,
25+
StructuredArguments.fields(loggingMeta),
2626
)
2727
} else {
2828
database.lagreMottattDialogmelding(receivedDialogmelding, sha256String)

src/main/kotlin/no/nav/syfo/services/JournalService.kt

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ class JournalService(
2424
): String {
2525
val journalpostId = database.hentDialogmeldingOpplysningerJournalpostId(receivedDialogmelding.dialogmelding.id)
2626
return if (journalpostId == null) {
27-
2827
logger.info("Prover aa lagre i Joark {}", StructuredArguments.fields(loggingMeta))
2928

3029
val antallVedlegg = vedleggListe?.size ?: 0

src/main/kotlin/no/nav/syfo/services/RuleService.kt

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ class RuleService(
2828
suspend fun executeRuleChains(
2929
receivedDialogmelding: ReceivedDialogmelding,
3030
): ValidationResult {
31-
3231
val loggingMeta = LoggingMeta(
3332
mottakId = receivedDialogmelding.navLogId,
3433
orgNr = receivedDialogmelding.legekontorOrgNr,

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

-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ import java.io.OutputStream
1616
import javax.imageio.ImageIO
1717

1818
fun ImageToPDF(imageStream: InputStream, outputStream: OutputStream) {
19-
2019
PDDocument().use { document ->
21-
2220
val page = PDPage(PDRectangle.A4)
2321
document.addPage(page)
2422
val image = toPortait(ImageIO.read(imageStream))

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

+6-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,12 @@ import no.nav.helse.msgHead.XMLMsgHead
1616
import no.nav.helse.msgHead.XMLSender
1717

1818
val fellesformatJaxBContext: JAXBContext = JAXBContext.newInstance(
19-
XMLEIFellesformat::class.java, XMLMsgHead::class.java,
20-
XMLMottakenhetBlokk::class.java, XMLDialogmelding::class.java, Base64Container::class.java, XMLAppRec::class.java
19+
XMLEIFellesformat::class.java,
20+
XMLMsgHead::class.java,
21+
XMLMottakenhetBlokk::class.java,
22+
XMLDialogmelding::class.java,
23+
Base64Container::class.java,
24+
XMLAppRec::class.java,
2125
)
2226
val fellesformatUnmarshaller: Unmarshaller = fellesformatJaxBContext.createUnmarshaller().apply {
2327
setAdapter(LocalDateTimeXmlAdapter::class.java, XMLDateTimeAdapter())

src/main/kotlin/no/nav/syfo/validation/ValidateDialogMeldingKodeverk.kt

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import no.nav.syfo.model.DialogmeldingType
55
import no.nav.syfo.model.findDialogmeldingKodeverk
66

77
fun isKodeverkValid(xmlDialogmelding: XMLDialogmelding, dialogmeldingType: DialogmeldingType): Boolean {
8-
98
when (dialogmeldingType) {
109
DialogmeldingType.DIALOGMELDING_DIALOGMOTE_INNKALLING_MOTERESPONS -> {
1110
val kodeverkOID = xmlDialogmelding.notat.first().temaKodet.s

src/test/kotlin/no/nav/syfo/ApprecMapperTest.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ internal class ApprecMapperTest {
1818
StringReader(getFileAsStringISO88591("src/test/resources/dialogmelding_dialog_svar_foresporsel_om_pasient.xml"))
1919
) as XMLEIFellesformat
2020

21-
val apprec = createApprec(felleformatDm, ApprecStatus.ok)
21+
val apprec = createApprec(felleformatDm, ApprecStatus.OK)
2222
val apprecReceiverBlock = apprec.get<XMLMottakenhetBlokk>()
2323

2424
apprecReceiverBlock.ebAction shouldBeEqualTo "Bekreftelse"

src/test/kotlin/no/nav/syfo/ExtractFromFellesFormatTest.kt

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ class ExtractFromFellesFormatTest {
4747

4848
behandlerIdent shouldBeEqualTo null
4949
}
50+
5051
@Test
5152
internal fun `Reads GenDate without timezone as timezone Oslo and converts to correct LocalDateTime`() {
5253
val localDateTime = LocalDateTime.parse("2019-01-16T21:57:36")

src/test/kotlin/no/nav/syfo/PdfModelTest.kt

+4-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ internal class PdfModelTest {
1111

1212
@Test
1313
internal fun `Creates a static pdfpayload`() {
14-
1514
val dialogmeldingId = UUID.randomUUID().toString()
1615
val signaturDato = LocalDateTime.of(2017, 11, 5, 0, 0, 0)
1716
val navnHelsePersonellNavn = "Per Hansen"
@@ -40,7 +39,8 @@ internal class PdfModelTest {
4039
dokIdForesp = "OD1812186729156",
4140
rollerRelatertNotat = RollerRelatertNotat(
4241
rolleNotat = RolleNotat(
43-
"2.16.578.1.12.4.1.1.9057", "1"
42+
"2.16.578.1.12.4.1.1.9057",
43+
"1",
4444
),
4545
person = Person(
4646
"jon",
@@ -75,7 +75,8 @@ internal class PdfModelTest {
7575
dokIdForesp = "OD1812186729156",
7676
rollerRelatertNotat = RollerRelatertNotat(
7777
rolleNotat = RolleNotat(
78-
"2.16.578.1.12.4.1.1.9057", "1"
78+
"2.16.578.1.12.4.1.1.9057",
79+
"1",
7980
),
8081
person = Person(
8182
"jon",

src/test/kotlin/no/nav/syfo/rules/ValidationRuleChainSpek.kt

-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ internal class ValidationRuleChainSpek {
8888

8989
@Test
9090
internal fun `AVSENDER_FNR_ER_SAMME_SOM_PASIENT_FNR should not trigger on rule`() {
91-
9291
ValidationRuleChain.AVSENDER_FNR_ER_SAMME_SOM_INNBYGGER_FNR(
9392
ruleData(dialogmelding, avsenderfnr = "04030350265", patientPersonNumber = "04030350261")
9493
) shouldBeEqualTo false

0 commit comments

Comments
 (0)