saveourtool / diktat

Strict coding standard for Kotlin and a custom set of rules for detecting code smells, code style issues and bugs
https://diktat.saveourtool.com
MIT License
544 stars 39 forks source link

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

Open kgevorkyan opened 1 year ago

kgevorkyan commented 1 year ago

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
WizCoderr commented 1 year ago

please assign me this issue @kgevorkyan

kgevorkyan commented 1 year ago

Hi, @WizCoderr! You are welcome

Also, please check Contributing guide before contribution