saveourtool/diktat

New rule: Empty functions should be one-liner and return `Unit`

Open

#1,701 创建于 2023年6月29日

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

仓库指标

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

描述

If for some reasons, function have no any logic, but exists only for some kind of execution: in cases of testing via JUnit Runners or JUnit Rules or some other purposes, it shouldn't have any body and should be fixed in the following way

@Test
@SomeAnnotation
fun foo() {
// no-op here
}
// no-op here
@Test
@SomeAnnotation
fun foo() = Unit

贡献者指南