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

ENUMS_SEPARATED fails to converge if last enum entry has comment on same line #1286

Closed
HaukeRa opened this issue May 3, 2022 · 1 comment · Fixed by #1302
Closed

ENUMS_SEPARATED fails to converge if last enum entry has comment on same line #1286

HaukeRa opened this issue May 3, 2022 · 1 comment · Fixed by #1302
Assignees
Labels
bug Something isn't working
Milestone

Comments

@HaukeRa
Copy link

HaukeRa commented May 3, 2022

Describe the bug

The following code fails to converge with the ENUMS_SEPARATED inspection:

enum class Foo {
    A,
    B,
    C // some comment
}

It tries to ensure that the last enum entry has a trailing comma, but it is added at the end of the line.
Since the comma is part of the comment, this step will repeat and fails to converge.

Expected behavior

Independently of whether a comment on the same line is considered a good style or not, the inspection should converge even with a comment present.

Environment information

  • diktat version: 1.1.0
  • build tool (gradle): 7.4.2
  • how is diktat run (CLI, plugin, etc.): spotless
  • kotlin version: 1.6.20
  • operating system: windows/ubuntu
@HaukeRa HaukeRa added the bug Something isn't working label May 3, 2022
@orchestr7 orchestr7 added this to the 1.1.1 milestone May 3, 2022
@orchestr7
Copy link
Member

orchestr7 commented May 3, 2022

Yeah, definitely an urgent bug, will be fixed in the nearest time (1.1.0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants