saveourtool/diktat

`MAGIC_NUMBER` false positive when `Long` constants are used together with `kotlin.time.Duration` extensions

Open

#1934 aperta il 19 giu 2024

Vedi su GitHub
 (5 commenti) (0 reazioni) (0 assegnatari)Kotlin (40 fork)github user discovery
buggood first issue

Metriche repository

Star
 (571 star)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

Describe the bug

The following constant declarations trigger the MAGIC_NUMBER false positive:

import kotlin.time.Duration.Companion.minutes
import kotlin.time.Duration.Companion.seconds

val fooTimeout = 10L.seconds

val barTimeout = 10L.minutes

Environment information

  • diktat version: 2.0.0
  • build tool: Maven
  • how is diktat run: plugin
  • kotlin version: 1.7.22
  • operating system: Any

Guida contributor