KT.UNNECESSARY_ANNOTATION_USE_SITE_TARGET

Unnecessary Annotation use-site Target

This rule inspects the use of the Annotation use-site Target. In case that the use-site Target is not needed it can be removed. For more information check the kotlin documentation: https://kotlinlang.org/docs/annotations.html#annotation-use-site-targets

Noncompliant Code

Copy
@property:Inject private val foo: String = "bar" // violation: unnecessary @property:

class Module(@param:Inject private val foo: String) // violation: unnecessary @param:

Compliant Code

Copy
class Module(@Inject private val foo: String)

The content on this page is adapted from the Detekt Docs. Copyright ©2022 The Detekt Team. All rights reserved. https://detekt.dev/comments.html