saveourtool/diktat

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

Open

#1,934 opened on 2024年6月19日

GitHub で見る
 (5 comments) (0 reactions) (0 assignees)Kotlin (40 forks)github user discovery
buggood first issue

Repository metrics

Stars
 (571 stars)
PR merge metrics
 (PR metrics pending)

説明

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

コントリビューターガイド