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.

Formatting ratchet

See original GitHub issue
spotless {
  ratchetFrom 'origin/master'
  ...

In this mode, spotless will filter the target further, to only apply to files which have changed since origin/master. This is similar to https://github.com/diffplug/spotless/issues/178 (only apply to staged files), but imo strictly better.

Lots of people are reticent to the “mega-format-commit” that happens when you go from human-formatted to machine-formatted, and this would solve this issue. It also helps to keep copyright headers up-to-date (ours aren’t). Best of all, it doesn’t rely on you to run the formatter before you commit. If you commit without formatting, Spotless will still remind you in the PR, ensuring that there’s no need for humans to argue about formatting.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
t-rad679commented, Feb 18, 2020

If something “ratchets”, then it can get tighter but not looser. For example, let’s say you use something like SpotBugs for the first time on your project. You’ll get 1,000 errors, and it will take a long time to fix them. Rather than fixing them all right now, you can say “our CI policy is to create no new errors, and it’s okay if you remove old errors” aka “tighter but not looser” aka “ratchet”.

Thanks for the explanation! That’s clever naming and I think it does do what I would expect.

Based on our previous conversations, I think we have irreconcilable differences around “convention-over-configuration” and default behaviors 😃

Fair enough 😃.

I don’t understand either of these sentences, probably because target means “a group of files to format” to me, and you’re using it to mean something else. If the paragraphs above didn’t answer your question, try to write documentation for the flags you’d like to see - that would help me understand what you want.

By source and target, I mean the source and target branches of a merge…i.e., the source would be a feature branch or a working copy and the target is typically the default branch (usually master). In other words, the files I would want to run Spotless on in this more general case could be gotten with the following command:

git diff --name-status --diff-filter=dr <target> <source>

This is what I’ve been trying to use in the absence of the feature this ticket is about.

The feature I’m describing would be more versatile, but, after thinking about it some more, I don’t really think what I want to do is Spotless’s job. I think there is a way one could use git with Spotless to make this happen (once I can get -PspotlessFiles to work properly) and that honestly seems more appropriate, though I’m not sure I can articulate why my mind changed. I could still probably be convinced back

0reactions
nedtwiggcommented, Jul 2, 2020

Released in maven 2.0.0, and much-improved in plugin-gradle 4.5.0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ratchets in software development @ Things Of Interest - QNTM
Formatting rules are particularly prone to this, with the original goal (make the code more readable to other developers) often completely lost ...
Read more >
Ratchet wrench reversible 22mm FORMAT
Open-ended spanner with ring ratchet, reversible. Design: Precisely toothed ratchet mechanism with 72 teeth and a return angle of 5°. Jaw positioned at...
Read more >
Ratchet with 1/4 "rotating handle, 60 teeth 185mm FORMAT
Ratchet with interchangeable driver and 1/4 '' rotating handle Design: DIN 3122 D 6.3 - ISO 3315, chrome vanadium steel, chrome plated, with...
Read more >
Category:Formatting templates | Ratchet & Clank Wiki - Fandom
Category:Formatting templates contains templates used for the standardization and proper use of formatting on the Ratchet & Clank Wiki.
Read more >
docs/megolm.md · master · matrix-org / Olm · GitLab
Implementation of the olm and megolm cryptographic ratchets. ... the session data is formatted as described in Session-sharing format.
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