There is no standard api in Gradle to mark a director to contain generated sources and there is no Kotlin annotation like Generated. The android Gradle plugin does have such Gradle api, but for IDE support it requires the Android IntelliJ plugin, bundled by AS.
Also, IntelliJ shows a warning if the folder is a children of build (or build/generated). That’s the location of the generated sources.
If you get a warning in detekt, you accidentally include the build folder. You should exclude this folder.