saveourtool/diktat

A generic type parameter in Kdoc should not be reported

Open

#1,929 创建于 2024年4月8日

在 GitHub 查看
 (4 评论) (2 反应) (0 负责人)Kotlin (40 fork)github user discovery
buggood first issue

仓库指标

Star
 (571 star)
PR 合并指标
 (PR 指标待抓取)

描述

Describe the bug

When documenting a type parameter in Kdoc, the only correct way to do it is using the @param tag, for example:

/**
 * @param T the target type to return
 */
fun <T> genericFunc(): T

Unfortunately Diktat reports:

[KDOC_WITHOUT_PARAM_TAG] all methods which take arguments should have @param tags in KDoc: T param isn't present in argument list

Which I believe is a wrong behavior, given that it's taking into consideration the formal parameters only.

Expected behavior

Diktat should not report a violation for the above example.

Observed behavior

Diktat reports a KDOC_WITHOUT_PARAM_TAG

Environment information

  • diktat version: 2.0.0
  • build tool (maven/gradle): gradle
  • how is diktat run (CLI, plugin, etc.): plugin
  • kotlin version: 1.9.23
  • operating system: MacOS 14.3.1

贡献者指南