question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

using ratchetFrom in a branch fails to detect the previous index in origin/main

See original GitHub issue

Hi,

I’m using maven (wrapper) 3.8.4 with spotless-maven-plugin 2.27.1 with the configuration defined as follows

<configuration>
	<ratchetFrom>origin/main</ratchetFrom>
	<java>
		<palantirJavaFormat>
			<version>xxx</version>
		</palantirJavaFormat>
		<removedUnusedImports/>
	</java>
	<upToDateChecking>
		<enabled>true</enabled>
		<indexFile>${project.basedir/.spotless-index</indexFile>
	</upToDateChecking>
</configuration>

So I have been working on main for a while, and it already has a .spotless-index file with the checksum and the listing of all the files. So far, no issue with that. But recently, I created a branch off my main called feature-a, and after the first commit in feature-a branch, I ran spotless:apply, then the .spotless-index file now has a new checksum and only listing files that was changed in feature-a branch.

Imagine in main branch

ajoicjaicjoiajscoijasjc098-
// listing all my source files (say 50 lines)

Then in feature-a branch (after a commit, and ran spotless:apply)

osdjvoidjsoyfboudf0bd= // new checksum
// listing 3 files (those that was changed in this new branch commit)

There was a log indicating

[INFO] Up-to-date checking enabled
[INFO] Fingerprint mismatch in the index file. Fallback to an empty index

I can’t have the full logs pasted as this occurs in an air-gapped repo, so if there is further information required, please let me know.

However, based on one of my previous feature branch, it doesn’t seem to suffer the same issue. So I don’t quite understand if there was something that I did wrong when creating the branch, or some mis-configuration on my end.

Thanks!

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
lutovichcommented, Nov 7, 2022

Thanks for reporting this problem and sorry for the delay! I will investigate this week.

0reactions
bwgjosephcommented, Nov 19, 2022

I understand that Fingerprint mismatch ... is to be expected when I change spotless configuration, and I generally agree with the approach as you have explained previously.

But I’m more concerned on how to use spotless when working with others, and what to expect. Given that, this index file can change quite frequently (with the current setup) and whatever tracked changes may frequently get reset, and thus, making the index file pretty much “not as useful” as one might have thought.

I think as you have explained before, fingerprint mismatch should only happen when spotless plugin configuration changes and not any other configuration within pom.xml which should greatly reduce the chance for the index file to keep resetting.

And I still have concern when using with large codebase, if the index file resets, how much impact would it make (as it needs to rebuild the index again each time spotless version gets upgraded - non-configuration change)? And how would it work in a monorepo (maven multi-module) project setup

Thanks for investigating, and answering to my queries. Appreciate it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ratchetFrom 'origin/main' does not fetch if not present #710
The problem is that the GitHub checkout action that is normally used doesn't checkout the main branch, only the branch being worked on....
Read more >
diffplug/spotless - Gitter
hi, I am having sudden issues formatting a project which uses spotless for a ... hmm, still fails because of the ratchet not...
Read more >
Maven - GitHub
To people who use your build, it looks like this: ```console user@machine repo % mvn spotless:check [ERROR] > The following files had format...
Read more >
Fixing - OSCHINA - 中文开源技术交流社区
So today people are still connecting applications using raw UDP and TCP, ... with spotless:off and spotless:on ⬜ ⬜ Ratchet from origin/main or...
Read more >
Diffplug Spotless Issues - IssueHint
using ratchetFrom in a branch fails to detect the previous index in origin/main, open, 10, 2022-10-17, 2022-11-13. allprojects doesn't appear to work, open ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found