You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -142,34 +142,19 @@ Spotless requires JRE 11+ and Gradle 6.1.1 or newer.
142
142
- If you're stuck on JRE 8, use [`id 'com.diffplug.spotless' version '6.13.0'` or older](https://github.com/diffplug/spotless/blob/main/plugin-gradle/CHANGES.md#6130---2023-01-14).
143
143
- If you're stuck on an older version of Gradle, [`id 'com.diffplug.gradle.spotless' version '4.5.1'` supports all the way back to Gradle 2.x](https://github.com/diffplug/spotless/blob/main/plugin-gradle/CHANGES.md#451---2020-07-04).
144
144
145
-
### Git pre-push hook
145
+
### Git hook
146
146
147
-
You can install a Git pre-push hook that ensures code is properly formatted before being pushed to a remote repository.
148
-
This helps catch formatting issues early — before CI fails — and is especially useful for teams not using IDE integrations or pre-commit tools.
147
+
If you want, you can run `./gradlew spotlessInstallGitPrePushHook` and it will install a hook such that
149
148
150
-
#### What the hook does
151
-
152
-
When installed, the Git `pre-push` hook will:
153
-
154
-
1. Run `spotlessCheck`
149
+
1. When you push, it runs `spotlessCheck`
155
150
2. If formatting issues are found:
156
151
- It automatically runs `spotlessApply` to fix them
157
152
- Aborts the push with a message
158
153
- You can then commit the changes and push again
159
154
160
155
This ensures your code is always clean before it leaves your machine.
161
156
162
-
#### Installation
163
-
164
-
Run the following task once in your project:
165
-
```console
166
-
gradle spotlessInstallGitPrePushHook
167
-
```
168
-
169
-
This installs a `.git/hooks/pre-push` script that runs `spotlessCheck`, and runs `spotlessApply` if needed.
170
-
171
-
> [!WARNING]
172
-
> The hook will not install automatically — you must run the install command manually.
157
+
If you prefer instead to have a "pre-commit" hook so that every single commit is clean, see [#623](https://github.com/diffplug/spotless/issues/623) for a workaround or to contribute a permanent fix.
@@ -147,34 +147,19 @@ Spotless consists of a list of formats (in the example above, `misc` and `java`)
147
147
Spotless requires Maven to be running on JRE 11+. To use JRE 8, go back to [`2.30.0` or older](https://github.com/diffplug/spotless/blob/main/plugin-maven/CHANGES.md#2300---2023-01-13).
148
148
149
149
150
-
### Git pre-push hook
150
+
### Git hook
151
151
152
-
You can install a Git pre-push hook that ensures code is properly formatted before being pushed to a remote repository.
153
-
This helps catch formatting issues early — before CI fails — and is especially useful for teams not using IDE integrations or pre-commit tools.
152
+
If you want, you can run `mvn spotless:install-git-pre-push-hook` and it will install a hook such that
154
153
155
-
#### What the hook does
156
-
157
-
When installed, the Git `pre-push` hook will:
158
-
159
-
1. Run `spotless:check`
154
+
1. When you push, it runs `spotless:check`
160
155
2. If formatting issues are found:
161
-
- It automatically runs `spotless:apply` to fix them
162
-
- Aborts the push with a message
163
-
- You can then commit the changes and push again
156
+
- It automatically runs `spotless:apply` to fix them
157
+
- Aborts the push with a message
158
+
- You can then commit the changes and push again
164
159
165
160
This ensures your code is always clean before it leaves your machine.
166
161
167
-
#### Installation
168
-
169
-
Run the following task once in your project:
170
-
```console
171
-
mvn spotless:install-git-pre-push-hook
172
-
```
173
-
174
-
This installs a `.git/hooks/pre-push` script that runs `spotless:check`, and runs `spotless:apply` if needed.
175
-
176
-
> [!WARNING]
177
-
> The hook will not install automatically — you must run the install command manually.
162
+
If you prefer instead to have a "pre-commit" hook so that every single commit is clean, see [#623](https://github.com/diffplug/spotless/issues/623) for a workaround or to contribute a permanent fix.
0 commit comments