saveourtool/diktat

False positive `KDOC_WITHOUT_RETURN_TAG` for functions returning `Unit` (implicit) or `Nothing` (explicit)

Open

#1,406 创建于 2022年6月27日

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

仓库指标

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

描述

DiKTat should require no @return tags in KDoc comments for expression-body functions with an implicit Unit or an explicit Nothing return types. In the below cases, a KDoc without any @return tag is sufficient:

/**
 * This function does nothing.
 */
fun f1() = Unit

/**
 * This function does nothing.
 */
fun f2() = kotlin.Unit

/**
 * This function fails immediately.
 */
fun fail1(): Nothing = TODO()

/**
 * This function fails immediately.
 */
fun fail2(): kotlin.Nothing = TODO()

Environment information

  • diktat version: 1.2.0
  • build tool (maven/gradle): Maven
  • how is diktat run (CLI, plugin, etc.): Maven plug-in
  • kotlin version: 1.7.0
  • operating system: Windows

贡献者指南