Skip to content

Repeated use of IDE hook hits the cache when it shouldn't #2365

Open
@micah-press

Description

@micah-press

If you are submitting a bug, please include the following:

  • summary of problem

When formatting an individual file using Spotless's IDE hook, repeatedly invoking spotlessApply fails to apply fixes to the file after the first run if the changes are undone in between runs. I can reproduce this using the Intellij plugin and directly on the command line. I've linked a repo below containing a reproduction of the issue.

Current behavior:

If I run spotlessApply -PspotlessIdeHook=/path/to/my/file more than once, undoing the formatting changes after the first invocation, subsequent invocations won't apply changes to the file.

Expected behavior:

Spotless should be consistent and idempotent, so I should be able to run it as many times as I want and get the same output each time.


  • Gradle or Maven version
    Gradle 8.11.1
  • spotless version
    7.0.0.BETA4
  • operating system and version
    Linux 5.15.0-126-generic amd64
  • copy-paste your full Spotless configuration block(s), and a link to a public git repo that reproduces the problem if possible
    https://github.com/micah-press/mp-spotless-bug-demo
spotless {
    java {
        endWithNewline()
    }
}
  • copy-paste the full content of any console errors emitted by gradlew spotless[Apply/Check] --stacktrace
    N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions