Skip to content

Replace custom Git hook with Spotless pre-push hook #2500

Description

@tsaglam

With the upcoming Spotless version 2.46.0 (see #2509), Spotless offers a Git hook out of the box (see diffplug/spotless#2553).

We could replace our own custom hook with the spotless one to streamline contributing for external developers.

The Spotless hook works on a pre-push basis (while ours is a pre-commit hook). It can be installed with spotless:install-git-pre-push-hook. It works as follows:

  • Runs spotlessCheck
  • If issues are found:
    • It runs spotlessApply automatically
    • Prints a message: "Spotless found problems, running apply; commit the result and re-push"
    • Aborts the push with exit code 1

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementIssue/PR that involves features, improvements and other changesminorMinor issue/feature/contribution/changewikiRegards the documentation in the wiki

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions