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

Divergent loop (each application of the formatter causes new changes) #89

Closed
nedtwigg opened this issue Oct 27, 2016 · 0 comments
Closed

Comments

@nedtwigg
Copy link
Contributor

nedtwigg commented Oct 27, 2016

There's a reproducible divergent loop on this file:

apache-geode/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java

Each time the formatter is called, it adds two newlines above the <pre> tag on line 684, and two newlines above the closing </code> tag on line 695.

Perhaps related to #84? If you call the formatter 10 times, then you end up with 20 newlines in each of these places.

We found this bug using the "padded cell" functionality in Spotless, which checks that Formatter(Formatter(input)) == Formatter(input), and handles misbehaving rules by resolving cycles, ignoring divergence, etc. Whenever a violation is found, it generates a set of files for reproducing the issue which demonstrate the cycle or divergence.

There's an open PR on this project to point gradle users to this Spotless plugin. People who use it will likely be able to find other helpful testcases, while insulating them from the bug in the short-term.

If you'd like to reproduce this for yourself, clone https://github.com/nedtwigg/incubator-geode, and checkout tag Bug37. Run gradlew spotlessCheck and it'll tell you which files are divergent and the testcases will be in build/spotless-diagnose-java.

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

No branches or pull requests

1 participant