Created
May 16, 2022 15:25
-
-
Save pavelkorolevxyz/08c474202f095e598514ecc6453997ed to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @file:DependsOn("io.github.ackeecz:danger-kotlin-detekt:0.1.4") | |
| import io.github.ackeecz.danger.detekt.DetektPlugin | |
| import systems.danger.kotlin.* | |
| import java.io.File | |
| register.plugin(DetektPlugin) | |
| danger(args) { | |
| warnDetekt() | |
| onGitHub { | |
| warnWorkInProgress() | |
| } | |
| } | |
| fun warnDetekt() { | |
| val detektReport = File("build/reports/detekt/report.xml") | |
| if (!detektReport.exists()) { | |
| warn( | |
| ":see_no_evil: No detekt report found", | |
| ) | |
| return | |
| } | |
| DetektPlugin.parseAndReport(detektReport) | |
| } | |
| fun GitHub.warnWorkInProgress() { | |
| if ("WIP" in pullRequest.title) { | |
| warn( | |
| ":construction: PR is marked with Work in Progress (WIP)", | |
| ) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment