pinterest / ktlint

An anti-bikeshedding Kotlin linter with built-in formatter
https://pinterest.github.io/ktlint/
MIT License
6.18k stars 507 forks source link

No semi-colons false positive with enums #2351

Closed rocketraman closed 9 months ago

rocketraman commented 10 months ago

(From https://github.com/detekt/detekt/issues/6615)

Expected Behavior

I have a class like this:

enum class Foo {
  FOO,
  BAR,
  ;

  fun foo() = Unit
}

This should not report any error from NoSemicolons, because the ; here is necessary.

My detekt configuration I have

  NoSemicolons:
    active: true
    autoCorrect: true

Observed Behavior

The NoSemicolons rule is triggered with detekt 1.23.3. It is not triggered with detekt 1.22.0.

Your Environment

paul-dingemans commented 10 months ago

I can not reproduce this with ktlint CLI (0.49.1, 0.50.0, '1.0.1`). I have no knowledge of Detekt. So I do not know how Detekts invokes ktlint. As long as it can not be reproduced with CLI, I can not be of help.