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

Method signature in baseline changes when adding/removing a doc comment #4767

Closed
roomscape opened this issue Apr 25, 2022 · 3 comments
Closed

Comments

@roomscape
Copy link

Expected Behavior

  • Given I have a method that exceeds the allowed method length or method complexity
  • And I have suppressed the warning via my baseline.xml
  • When I add a doc comment (/** ... */) to the method
  • Then detekt should continue to pass

Observed Behavior

After adding the doc comment, the suppression no longer works. Re-running detektBaseline shows that the signature has actually changed.

Steps to Reproduce

See https://github.com/roomscape/detekt-baseline-issue, or:

  • Create a long method in a class
  • Run detekt and observe that it fails
  • Run detektBaseline
  • Run detekt and observe that it passes
  • Add a doc comment to the long method
  • Run detekt and observe that it fails
  • Run detektBaseline and observe that the baseline.xml file has changed

Suppression for a method without a doc comment:

    <ID>LongMethod:Example.kt$Example$fun checkFoo()</ID>

Suppression for the same method after a doc comment is added:

    <ID>LongMethod:Example.kt$Example$ fun checkFoo()</ID>

Context

  • I tried to add a doc comment to an existing method in a large project
  • I had to regenerate the detekt baseline in order to push my changes

Your Environment

  • Version of detekt used: 1.20.0
  • Version of Gradle used (if applicable): 7.4
  • Operating System and version: macOS 12.2.1
@roomscape roomscape added the bug label Apr 25, 2022
@cortinico
Copy link
Member

Yeah that's a bug. I think we tried to address it once with #4335 but that had to be reverted as it was causing problems.

@VitalyVPinchuk
Copy link
Contributor

It's unreproducible on the latest main.
Seems to be fixed.

@BraisGabin
Copy link
Member

Closing then, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants