Skip to content

Commit

Permalink
Remove ignoreFailures in the detekt config and fix some detekt is…
Browse files Browse the repository at this point in the history
…sues
  • Loading branch information
AzimMuradov committed Dec 23, 2023
1 parent d94b77b commit 75cb886
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 30 deletions.
1 change: 0 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ tasks {
detekt {
buildUponDefaultConfig = true
parallel = true
ignoreFailures = true

config.setFrom(files(rootDir.resolve("detekt.yml")))
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
@file:Suppress("TooManyFunctions")
@file:Suppress("PrivatePropertyName", "TooManyFunctions", "VariableNaming")

package io.github.oshai.kotlinlogging.slf4j.internal

import io.github.oshai.kotlinlogging.DelegatingKLogger
import io.github.oshai.kotlinlogging.KLogger
import io.github.oshai.kotlinlogging.KLoggingEventBuilder
import io.github.oshai.kotlinlogging.Level
import io.github.oshai.kotlinlogging.Marker
import io.github.oshai.kotlinlogging.*
import io.github.oshai.kotlinlogging.internal.toStringSafe
import io.github.oshai.kotlinlogging.slf4j.toSlf4j
import org.slf4j.event.EventConstants
Expand All @@ -26,15 +22,13 @@ internal class LocationAwareKLogger(override val underlyingLogger: LocationAware

private val fqcn: String = LocationAwareKLogger::class.java.name

private val ENTRY = io.github.oshai.kotlinlogging.KMarkerFactory.getMarker("ENTRY").toSlf4j()
private val EXIT = io.github.oshai.kotlinlogging.KMarkerFactory.getMarker("EXIT").toSlf4j()
private val ENTRY = KMarkerFactory.getMarker("ENTRY").toSlf4j()
private val EXIT = KMarkerFactory.getMarker("EXIT").toSlf4j()

private val THROWING =
io.github.oshai.kotlinlogging.KMarkerFactory.getMarker("THROWING").toSlf4j()
private val CATCHING =
io.github.oshai.kotlinlogging.KMarkerFactory.getMarker("CATCHING").toSlf4j()
private val EXITONLY = "exit"
private val EXITMESSAGE = "exit with ({})"
private val THROWING = KMarkerFactory.getMarker("THROWING").toSlf4j()
private val CATCHING = KMarkerFactory.getMarker("CATCHING").toSlf4j()
private val EXIT_ONLY = "exit"
private val EXIT_MESSAGE = "exit with ({})"

override fun isLoggingEnabledFor(level: Level, marker: Marker?): Boolean {
return isLoggingEnabledFor(underlyingLogger, level, marker)
Expand Down Expand Up @@ -147,13 +141,13 @@ internal class LocationAwareKLogger(override val underlyingLogger: LocationAware

override fun exit() {
if (underlyingLogger.isTraceEnabled(EXIT)) {
underlyingLogger.log(EXIT, fqcn, EventConstants.TRACE_INT, EXITONLY, null, null)
underlyingLogger.log(EXIT, fqcn, EventConstants.TRACE_INT, EXIT_ONLY, null, null)
}
}

override fun <T : Any?> exit(result: T): T {
if (underlyingLogger.isTraceEnabled(EXIT)) {
val tp = MessageFormatter.format(EXITMESSAGE, result)
val tp = MessageFormatter.format(EXIT_MESSAGE, result)
underlyingLogger.log(
EXIT,
fqcn,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.github.oshai.kotlinlogging.coroutines

import io.github.oshai.kotlinlogging.*
import kotlinx.coroutines.*
import kotlinx.coroutines.slf4j.*
import io.github.oshai.kotlinlogging.withLoggingContext
import kotlinx.coroutines.slf4j.MDCContext
import kotlinx.coroutines.withContext

/**
* Use a pair in an asynchronous MDC context. Example:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package io.github.oshai.kotlinlogging.coroutines

import kotlin.test.*
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertNull
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.runTest
import org.apache.logging.log4j.*
import org.apache.logging.log4j.core.config.*
import org.apache.logging.log4j.Level
import org.apache.logging.log4j.core.config.Configurator
import org.junit.jupiter.api.BeforeEach
import org.slf4j.*
import org.slf4j.MDC

@ExperimentalCoroutinesApi
class KotlinLoggingAsyncMDCTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class KLoggerNameResolverTest {
assertEquals(expectedName, KLoggerNameResolver.name(clazz))
}

@Suppress("UnusedPrivateMember")
private fun testNames(): Stream<Arguments> =
Stream.of(
Arguments.of("io.github.oshai.kotlinlogging.internal.BaseClass", BaseClass::class.java),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("TooGenericExceptionThrown")

package io.github.oshai.kotlinlogging.internal

import kotlin.test.assertEquals
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
package io.github.oshai.kotlinlogging.jul.internal

import io.github.oshai.kotlinlogging.AppenderWithWriter
import io.github.oshai.kotlinlogging.KLogger
import io.github.oshai.kotlinlogging.KotlinLogging
import io.github.oshai.kotlinlogging.addAppender
import io.github.oshai.kotlinlogging.removeAppender
import io.github.oshai.kotlinlogging.*
import java.util.logging.Level
import java.util.logging.Logger
import org.junit.jupiter.api.AfterAll
import org.junit.jupiter.api.Assertions.*
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.api.BeforeAll
import org.junit.jupiter.api.Test
import org.slf4j.bridge.SLF4JBridgeHandler
Expand Down

0 comments on commit 75cb886

Please sign in to comment.