Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#22] Configure Detekt #47

Merged
merged 3 commits into from
May 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 34 additions & 34 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,40 +42,40 @@ jobs:
timeout-minutes: 15
uses: ./.github/actions/setup

# static_analysis_detekt:
# needs: prime_cache
# runs-on: ubuntu-latest
# permissions:
# contents: read
# steps:
# - name: Checkout
# timeout-minutes: 1
# uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
# - name: Setup
# id: setup
# timeout-minutes: 5
# uses: ./.github/actions/setup
# - name: Detekt
# timeout-minutes: 4
# run: |
# ./gradlew detektAll
# - name: Collect Artifacts
# timeout-minutes: 1
# if: ${{ always() }}
# env:
# ARTIFACTS_DIR_PATH: ${{ format('{0}/artifacts', env.home) }}
# REPORTS_ZIP_PATH: ${{ format('{0}/artifacts/static_analysis_detekt.zip', env.home) }}
# run: |
# mkdir ${ARTIFACTS_DIR_PATH}
#
# zip -r ${REPORTS_ZIP_PATH} . -i build/reports/detekt/\*
# - name: Upload Artifacts
# if: ${{ always() }}
# uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
# timeout-minutes: 1
# with:
# name: Detekt static analysis results
# path: ~/artifacts
static_analysis_detekt:
needs: prime_cache
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
timeout-minutes: 1
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
- name: Setup
id: setup
timeout-minutes: 5
uses: ./.github/actions/setup
- name: Detekt
timeout-minutes: 4
run: |
./gradlew detektAll
- name: Collect Artifacts
timeout-minutes: 1
if: ${{ always() }}
env:
ARTIFACTS_DIR_PATH: ${{ format('{0}/artifacts', env.home) }}
REPORTS_ZIP_PATH: ${{ format('{0}/artifacts/static_analysis_detekt.zip', env.home) }}
run: |
mkdir ${ARTIFACTS_DIR_PATH}

zip -r ${REPORTS_ZIP_PATH} . -i build/reports/detekt/\*
- name: Upload Artifacts
if: ${{ always() }}
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
timeout-minutes: 1
with:
name: Detekt static analysis results
path: ~/artifacts

static_analysis_ktlint:
needs: prime_cache
Expand Down
23 changes: 23 additions & 0 deletions .run/detektAll.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="detektAll" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="detektAll" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<method v="2" />
</configuration>
</component>
18 changes: 18 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,22 @@ dependencyLocking {

plugins {
id("bip39.ktlint-conventions")
alias(libs.plugins.detekt)
}

tasks {
register("detektAll", io.gitlab.arturbosch.detekt.Detekt::class) {
parallel = true
setSource(files(projectDir))
include("**/*.kt")
//include("**/*.kts")
exclude("**/resources/**")
exclude("**/build/**")
exclude("**/commonTest/**")
exclude("**/jvmTest/**")
exclude("**/androidTest/**")
config.setFrom(files("${rootProject.projectDir}/tools/detekt.yml"))
baseline.set(file("$rootDir/tools/detekt-baseline.xml"))
buildUponDefaultConfig = true
}
}
11 changes: 11 additions & 0 deletions buildscript-gradle.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ com.google.guava:guava:29.0-jre=classpath
com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava=classpath
com.google.j2objc:j2objc-annotations:1.3=classpath
de.undercouch:gradle-download-task:4.1.1=classpath
io.github.detekt.sarif4k:sarif4k:0.0.1=classpath
io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.20.0=classpath
io.gitlab.arturbosch.detekt:detekt-utils:1.20.0=classpath
io.gitlab.arturbosch.detekt:io.gitlab.arturbosch.detekt.gradle.plugin:1.20.0=classpath
net.java.dev.jna:jna:5.6.0=classpath
org.checkerframework:checker-qual:2.11.1=classpath
org.jetbrains.intellij.deps:trove4j:1.0.20200330=classpath
Expand All @@ -30,8 +34,15 @@ org.jetbrains.kotlin:kotlin-scripting-common:1.6.21=classpath
org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:1.6.21=classpath
org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:1.6.21=classpath
org.jetbrains.kotlin:kotlin-scripting-jvm:1.6.21=classpath
org.jetbrains.kotlin:kotlin-stdlib-common:1.5.31=classpath
org.jetbrains.kotlin:kotlin-stdlib:1.5.31=classpath
org.jetbrains.kotlin:kotlin-tooling-metadata:1.6.21=classpath
org.jetbrains.kotlin:kotlin-util-io:1.6.21=classpath
org.jetbrains.kotlin:kotlin-util-klib:1.6.21=classpath
org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.5.0=classpath
org.jetbrains.kotlinx:kotlinx-serialization-core-jvm:1.1.0=classpath
org.jetbrains.kotlinx:kotlinx-serialization-core:1.1.0=classpath
org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:1.1.0=classpath
org.jetbrains.kotlinx:kotlinx-serialization-json:1.1.0=classpath
org.jetbrains:annotations:13.0=classpath
empty=
55 changes: 40 additions & 15 deletions gradle.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# This file is expected to be part of source control.
ch.qos.logback:logback-classic:1.2.9=ktlint
ch.qos.logback:logback-core:1.2.9=ktlint
com.beust:jcommander:1.82=detekt
com.github.shyiko.klob:klob:0.2.1=ktlint
com.pinterest.ktlint:ktlint-core:0.45.2=ktlint
com.pinterest.ktlint:ktlint-reporter-baseline:0.45.2=ktlint
Expand All @@ -16,23 +17,47 @@ com.pinterest.ktlint:ktlint-ruleset-standard:0.45.2=ktlint
com.pinterest.ktlint:ktlint-ruleset-test:0.45.2=ktlint
com.pinterest:ktlint:0.45.2=ktlint
info.picocli:picocli:3.9.6=ktlint
io.github.detekt.sarif4k:sarif4k:0.0.1=ktlint
io.github.detekt.sarif4k:sarif4k:0.0.1=detekt,ktlint
io.github.microutils:kotlin-logging-jvm:2.1.21=ktlint
net.java.dev.jna:jna:5.6.0=ktlint
io.gitlab.arturbosch.detekt:detekt-api:1.20.0=detekt
io.gitlab.arturbosch.detekt:detekt-cli:1.20.0=detekt
io.gitlab.arturbosch.detekt:detekt-core:1.20.0=detekt
io.gitlab.arturbosch.detekt:detekt-metrics:1.20.0=detekt
io.gitlab.arturbosch.detekt:detekt-parser:1.20.0=detekt
io.gitlab.arturbosch.detekt:detekt-psi-utils:1.20.0=detekt
io.gitlab.arturbosch.detekt:detekt-report-html:1.20.0=detekt
io.gitlab.arturbosch.detekt:detekt-report-sarif:1.20.0=detekt
io.gitlab.arturbosch.detekt:detekt-report-txt:1.20.0=detekt
io.gitlab.arturbosch.detekt:detekt-report-xml:1.20.0=detekt
io.gitlab.arturbosch.detekt:detekt-rules-complexity:1.20.0=detekt
io.gitlab.arturbosch.detekt:detekt-rules-coroutines:1.20.0=detekt
io.gitlab.arturbosch.detekt:detekt-rules-documentation:1.20.0=detekt
io.gitlab.arturbosch.detekt:detekt-rules-empty:1.20.0=detekt
io.gitlab.arturbosch.detekt:detekt-rules-errorprone:1.20.0=detekt
io.gitlab.arturbosch.detekt:detekt-rules-exceptions:1.20.0=detekt
io.gitlab.arturbosch.detekt:detekt-rules-naming:1.20.0=detekt
io.gitlab.arturbosch.detekt:detekt-rules-performance:1.20.0=detekt
io.gitlab.arturbosch.detekt:detekt-rules-style:1.20.0=detekt
io.gitlab.arturbosch.detekt:detekt-rules:1.20.0=detekt
io.gitlab.arturbosch.detekt:detekt-tooling:1.20.0=detekt
io.gitlab.arturbosch.detekt:detekt-utils:1.20.0=detekt
net.java.dev.jna:jna:5.6.0=detekt,ktlint
org.ec4j.core:ec4j-core:0.3.0=ktlint
org.jetbrains.intellij.deps:trove4j:1.0.20200330=ktlint
org.jetbrains.kotlin:kotlin-compiler-embeddable:1.6.20=ktlint
org.jetbrains.kotlin:kotlin-daemon-embeddable:1.6.20=ktlint
org.jetbrains.kotlin:kotlin-reflect:1.6.20=ktlint
org.jetbrains.kotlin:kotlin-script-runtime:1.6.20=ktlint
org.jetbrains.kotlin:kotlin-stdlib-common:1.6.20=ktlint
org.jetbrains.intellij.deps:trove4j:1.0.20200330=detekt,ktlint
org.jetbrains.kotlin:kotlin-compiler-embeddable:1.6.20=detekt,ktlint
org.jetbrains.kotlin:kotlin-daemon-embeddable:1.6.20=detekt,ktlint
org.jetbrains.kotlin:kotlin-reflect:1.6.20=detekt,ktlint
org.jetbrains.kotlin:kotlin-script-runtime:1.6.20=detekt,ktlint
org.jetbrains.kotlin:kotlin-stdlib-common:1.6.20=detekt,ktlint
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.20=ktlint
org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.20=ktlint
org.jetbrains.kotlin:kotlin-stdlib:1.6.20=ktlint
org.jetbrains.kotlinx:kotlinx-serialization-core-jvm:1.1.0=ktlint
org.jetbrains.kotlinx:kotlinx-serialization-core:1.1.0=ktlint
org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:1.1.0=ktlint
org.jetbrains.kotlinx:kotlinx-serialization-json:1.1.0=ktlint
org.jetbrains:annotations:13.0=ktlint
org.jetbrains.kotlin:kotlin-stdlib:1.6.20=detekt,ktlint
org.jetbrains.kotlinx:kotlinx-html-jvm:0.7.5=detekt
org.jetbrains.kotlinx:kotlinx-serialization-core-jvm:1.1.0=detekt,ktlint
org.jetbrains.kotlinx:kotlinx-serialization-core:1.1.0=detekt,ktlint
org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:1.1.0=detekt,ktlint
org.jetbrains.kotlinx:kotlinx-serialization-json:1.1.0=detekt,ktlint
org.jetbrains:annotations:13.0=detekt,ktlint
org.slf4j:slf4j-api:1.7.32=ktlint
empty=annotationProcessor,compileClasspath,runtimeClasspath,testAnnotationProcessor,testCompileClasspath,testRuntimeClasspath
org.yaml:snakeyaml:1.30=detekt
empty=annotationProcessor,compileClasspath,detektPlugins,runtimeClasspath,testAnnotationProcessor,testCompileClasspath,testRuntimeClasspath
3 changes: 2 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ moshi-core = { module = "com.squareup.moshi:moshi", version.ref = "moshi" }
moshi-kotlin = { module = "com.squareup.moshi:moshi-kotlin", version.ref = "moshi" }

[plugins]
detekt = "io.gitlab.arturbosch.detekt:1.20.0"
dokka = "org.jetbrains.dokka:1.6.20"
versions = "com.github.ben-manes.versions:0.42.0"
publish = "com.vanniktech.maven.publish:0.18.0"
versions = "com.github.ben-manes.versions:0.42.0"
Loading