Hi folks. I’m trying to use `Duration` type <https...
# detekt
t
Hi folks. I’m trying to use
Duration
type https://okkotlin.com/duration/ but it got flagged by the
MagicNumber
rule. Just wondering whether anyone knows how to configure the
MagicNumber
to exclude if I extract the whole
Duration
into a constant like below?
Copy code
@ExperimentalTime
class Operation {
    companion object {
        val DEFAULT_TIMEOUT = 3.seconds
    }

    @ExperimentalTime
    fun read(timeout: Duration = DEFAULT_TIMEOUT) {
    }
}
So w/ that example, detekt still complains that
3
should be constant.
s
How does your config for MagicNumber look like? Did you set
ignoreConstantDeclaration
to
true
?