Skip to content

Commit e7015df

Browse files
committed
Update README.md
Signed-off-by: yongjunhong <[email protected]>
1 parent 62eb863 commit e7015df

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

plugin-gradle/README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ Spotless supports all of Gradle's built-in performance features (incremental bui
8888
- [Multiple (or custom) language-specific blocks](#multiple-or-custom-language-specific-blocks)
8989
- [Inception (languages within languages within...)](#inception-languages-within-languages-within)
9090
- [Disabling warnings and error messages](#disabling-warnings-and-error-messages)
91+
- [Reviewdog integration for CI](#reviewdog-integration-for-ci)
9192
- [Dependency resolution modes](#dependency-resolution-modes)
9293
- [How do I preview what `spotlessApply` will do?](#how-do-i-preview-what-spotlessapply-will-do)
9394
- [Example configurations (from real-world projects)](#example-configurations-from-real-world-projects)
@@ -1768,6 +1769,42 @@ spotless {
17681769
ignoreErrorForPath('path/to/file.java') // ignore errors by all steps on this specific file
17691770
```
17701771
1772+
<a name="reviewdog"></a>
1773+
1774+
## Reviewdog integration for CI
1775+
1776+
Spotless can generate reports compatible with [Reviewdog](https://github.com/reviewdog/reviewdog), a tool that automates code review tasks by posting formatting issues as comments on pull requests.
1777+
1778+
### Enabling Reviewdog integration
1779+
1780+
To enable Reviewdog output:
1781+
1782+
```gradle
1783+
spotless {
1784+
reviewdogOutput file("${buildDir}/spotless-reviewdog.json")
1785+
}
1786+
```
1787+
1788+
### Automatic report generation on check failure
1789+
1790+
To generate reports when `spotlessCheck` fails:
1791+
1792+
```gradle
1793+
tasks.named('spotlessCheck').configure {
1794+
ignoreFailures = true
1795+
finalizedBy tasks.register('generateReviewdogReport') {
1796+
doLast {
1797+
if (spotlessCheck.outcome.failure) {
1798+
logger.lifecycle("Spotless check failed - Reviewdog report generated")
1799+
}
1800+
}
1801+
}
1802+
}
1803+
```
1804+
1805+
For Reviewdog setup instructions, visit: https://github.com/reviewdog/reviewdog#installation
1806+
1807+
17711808
<a name="dependency-resolution-modes"></a>
17721809
## Dependency resolution modes
17731810

0 commit comments

Comments
 (0)