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

A generic type parameter in Kdoc should not be reported #1929

Open polarene opened 7 months ago

polarene commented 7 months ago

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

orchestr7 commented 5 months ago

Sounds very reasonable, but looks to be fixed @DrAlexD please check

orchestr7 commented 5 months ago

https://github.com/saveourtool/diktat/pull/1873/files ?

polarene commented 5 months ago

Thanks for getting back to this bug. The PR you cited seems to be resolving a different problem, that is parameter names enclosed by backticks, not type parameters.

DrAlexD commented 5 months ago

Sounds very reasonable, but looks to be fixed @DrAlexD please check

The PR you referred to was related to properties of class, as was this PR (https://github.com/saveourtool/diktat/pull/1892). Current issue is related to parameters of methods.