Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False negative for companion object in UndocumentedPublicClass #7217

Closed
TWiStErRob opened this issue Apr 23, 2024 · 0 comments · Fixed by #7219
Closed

False negative for companion object in UndocumentedPublicClass #7217

TWiStErRob opened this issue Apr 23, 2024 · 0 comments · Fixed by #7219
Labels

Comments

@TWiStErRob
Copy link
Member

TWiStErRob commented Apr 23, 2024

Steps to Reproduce

public object PublicObject

public class PublicClass {

	public companion object;
}

Configuration:

detekt.allRules = true
// Does not contain relevant lines, just a few rules deactivated or fine tuned.
detekt.config.from(rootProject.file("config/detekt/detekt.yml"))
dependencies { detektPlugins(libs.detekt.rules.libraries) }

Observed Behavior

src\main\kotlin\com\example\PublicTest.kt:21:15: PublicObject is missing required documentation. [UndocumentedPublicClass]
src\main\kotlin\com\example\PublicTest.kt:23:14: PublicClass is missing required documentation. [UndocumentedPublicClass]

Expected Behavior

The 2 findings are fine, but there are 3 public classes in the above code:

  • PublicObject
  • PublicClass
  • PublicClass.Companion

So the false negative is the companion object.

Context

I'm relying on detekt to ensure that all my public API surface is documented.

Your Environment

  • Version of detekt used: 1.23.5
  • Version of Gradle used (if applicable): 8.7
  • Gradle scan link (add --scan option when running the gradle task): N/A
  • Operating System and version: Windows 10 / GitHub Actions Ubuntu 22.04
  • Link to your project (if it's a public repository): N/A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant