Skip to content

Commit

Permalink
TECH: add detekt to danger inline comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Vacxe committed Jun 25, 2024
1 parent 958d6cb commit b93fdce
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
24 changes: 24 additions & 0 deletions .danger/pr_detekt.df.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@file:DependsOn("io.github.vacxe.danger.kotlin:detekt:1.1.0")

import systems.danger.kotlin.danger
import systems.danger.kotlin.plugin
import io.github.vacxe.danger.kotlin.detekt.DetektPlugin
import java.io.File

val detektPlugin = DetektPlugin { it.removePrefix("/home/runner/work/Kaspresso/Kaspresso/") }
register.plugin(detektPlugin)

danger(args) {
detektReport()
}

fun detektReport() {
val detektReportFile = File("build/reports/detekt/detekt.xml")
if (!detektReportFile.exists()) {
warn(
"Detekt report not exist",
)
} else {
detektPlugin.parseAndReport(detektReportFile)
}
}
11 changes: 10 additions & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,21 @@ jobs:
restore-keys: |
${{ runner.os }}-gradle-
- name: Set up JDK
uses: actions/setup-java@v2
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 17
cache: gradle
- name: Run static analysis
run: make static_analysis
- name: Detekt to Danger
uses: danger/[email protected]
if: always()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
dangerfile: ".danger/pr_detekt.df.kts"
args: "--failOnErrors --no-publish-check"
- name: Run unit tests
run: make unit_tests
- name: Build project
Expand Down

0 comments on commit b93fdce

Please sign in to comment.