Skip to content

Commit

Permalink
Add linting in CI using Detekt with Sarif output
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsvanvelzen committed Apr 17, 2021
1 parent 4d1e1e3 commit 793f928
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
35 changes: 35 additions & 0 deletions .github/workflows/sdk-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: SDK Lint

on:
push:
branches:
- master
- release-*
pull_request:

jobs:
test:
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Java
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: 11
- name: Setup Gradle cache
uses: actions/cache@v2.1.5
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Run detekt task
run: ./gradlew --build-cache --no-daemon --info detekt
- name: Upload SARIF files
uses: github/codeql-action/upload-sarif@v1
with:
sarif_file: .
4 changes: 4 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,9 @@ subprojects {
buildUponDefaultConfig = true
ignoreFailures = true
config = files("$rootDir/detekt.yml")

reports {
sarif.enabled = true
}
}
}
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ object Plugins {
object Versions {
const val kotlin = "1.4.30"
const val binaryCompatibilityValidatorVersion = "0.5.0"
const val detekt = "1.14.2"
const val detekt = "1.16.0"
const val nexusPublish = "1.0.0"
const val dokka = "1.4.30"
const val androidBuildTools = "4.1.2"
Expand Down

0 comments on commit 793f928

Please sign in to comment.