mirror of
https://github.com/jlengrand/detekt.git
synced 2026-03-10 08:11:23 +00:00
Add dependency-analysis plugin and implement some recommendations (#4798)
Co-authored-by: schalkms <30376729+schalkms@users.noreply.github.com>
This commit is contained in:
@@ -6,6 +6,7 @@ plugins {
|
|||||||
id("io.gitlab.arturbosch.detekt")
|
id("io.gitlab.arturbosch.detekt")
|
||||||
alias(libs.plugins.gradleVersions)
|
alias(libs.plugins.gradleVersions)
|
||||||
alias(libs.plugins.sonarqube)
|
alias(libs.plugins.sonarqube)
|
||||||
|
alias(libs.plugins.dependencyAnalysis)
|
||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
@@ -44,6 +45,16 @@ allprojects {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dependencyAnalysis {
|
||||||
|
issues {
|
||||||
|
all {
|
||||||
|
onUsedTransitiveDependencies {
|
||||||
|
severity("ignore")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
val analysisDir = file(projectDir)
|
val analysisDir = file(projectDir)
|
||||||
val baselineFile = file("$rootDir/config/detekt/baseline.xml")
|
val baselineFile = file("$rootDir/config/detekt/baseline.xml")
|
||||||
val configFile = file("$rootDir/config/detekt/detekt.yml")
|
val configFile = file("$rootDir/config/detekt/detekt.yml")
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
api(projects.detektApi)
|
||||||
|
api(projects.detektParser)
|
||||||
|
api(projects.detektTooling)
|
||||||
implementation(libs.snakeyaml)
|
implementation(libs.snakeyaml)
|
||||||
implementation(projects.detektApi)
|
|
||||||
implementation(projects.detektMetrics)
|
implementation(projects.detektMetrics)
|
||||||
implementation(projects.detektParser)
|
|
||||||
implementation(projects.detektPsiUtils)
|
implementation(projects.detektPsiUtils)
|
||||||
implementation(projects.detektTooling)
|
|
||||||
implementation(projects.detektReportHtml)
|
implementation(projects.detektReportHtml)
|
||||||
implementation(projects.detektReportTxt)
|
implementation(projects.detektReportTxt)
|
||||||
implementation(projects.detektReportXml)
|
implementation(projects.detektReportXml)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(projects.detektApi)
|
compileOnly(projects.detektApi)
|
||||||
implementation(libs.ktlint.rulesetStandard) {
|
implementation(libs.ktlint.rulesetStandard) {
|
||||||
exclude(group = "org.jetbrains.kotlin")
|
exclude(group = "org.jetbrains.kotlin")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(libs.kotlin.compilerEmbeddable)
|
api(libs.kotlin.compilerEmbeddable)
|
||||||
|
|
||||||
testImplementation(libs.assertj)
|
testImplementation(libs.assertj)
|
||||||
testImplementation(projects.detektTest)
|
testImplementation(projects.detektTest)
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import io.gitlab.arturbosch.detekt.api.Location
|
|||||||
import io.gitlab.arturbosch.detekt.api.RuleSetId
|
import io.gitlab.arturbosch.detekt.api.RuleSetId
|
||||||
import io.gitlab.arturbosch.detekt.api.SeverityLevel
|
import io.gitlab.arturbosch.detekt.api.SeverityLevel
|
||||||
|
|
||||||
fun toResults(detektion: Detektion): List<io.github.detekt.sarif4k.Result> =
|
internal fun toResults(detektion: Detektion): List<io.github.detekt.sarif4k.Result> =
|
||||||
detektion.findings.flatMap { (ruleSetId, findings) ->
|
detektion.findings.flatMap { (ruleSetId, findings) ->
|
||||||
findings.map { it.toResult(ruleSetId) }
|
findings.map { it.toResult(ruleSetId) }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import java.util.ServiceLoader
|
|||||||
/**
|
/**
|
||||||
* Given the existing config, return a list of [ReportingDescriptor] for the rules.
|
* Given the existing config, return a list of [ReportingDescriptor] for the rules.
|
||||||
*/
|
*/
|
||||||
fun toReportingDescriptors(config: Config): List<ReportingDescriptor> {
|
internal fun toReportingDescriptors(config: Config): List<ReportingDescriptor> {
|
||||||
val sets =
|
val sets =
|
||||||
ServiceLoader.load(RuleSetProvider::class.java, SarifOutputReport::class.java.classLoader)
|
ServiceLoader.load(RuleSetProvider::class.java, SarifOutputReport::class.java.classLoader)
|
||||||
.map { it.instance(config.subConfig(it.ruleSetId)) }
|
.map { it.instance(config.subConfig(it.ruleSetId)) }
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(projects.detektApi)
|
compileOnly(projects.detektApi)
|
||||||
testImplementation(testFixtures(projects.detektApi))
|
testImplementation(testFixtures(projects.detektApi))
|
||||||
testImplementation(libs.assertj)
|
testImplementation(libs.assertj)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(projects.detektApi)
|
compileOnly(projects.detektApi)
|
||||||
testImplementation(testFixtures(projects.detektApi))
|
testImplementation(testFixtures(projects.detektApi))
|
||||||
testImplementation(libs.assertj)
|
testImplementation(libs.assertj)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ plugins {
|
|||||||
dependencies {
|
dependencies {
|
||||||
// When creating a sample extension, change this dependency to the detekt-api version you build against
|
// When creating a sample extension, change this dependency to the detekt-api version you build against
|
||||||
// e.g. io.gitlab.arturbosch.detekt:detekt-api:1.x.x
|
// e.g. io.gitlab.arturbosch.detekt:detekt-api:1.x.x
|
||||||
implementation(projects.detektApi)
|
compileOnly(projects.detektApi)
|
||||||
// When creating a sample extension, change this dependency to the detekt-test version you build against
|
// When creating a sample extension, change this dependency to the detekt-test version you build against
|
||||||
// e.g. io.gitlab.arturbosch.detekt:detekt-test:1.x.x
|
// e.g. io.gitlab.arturbosch.detekt:detekt-test:1.x.x
|
||||||
testImplementation(projects.detektTest)
|
testImplementation(projects.detektTest)
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ plugins {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api(libs.kotlin.stdlibJdk8)
|
api(libs.kotlin.stdlibJdk8)
|
||||||
|
api(libs.junit.api)
|
||||||
compileOnly(libs.spek.dsl)
|
compileOnly(libs.spek.dsl)
|
||||||
implementation(projects.detektParser)
|
implementation(projects.detektParser)
|
||||||
implementation(libs.kotlin.scriptUtil)
|
implementation(libs.kotlin.scriptUtil)
|
||||||
implementation(libs.junit.api)
|
|
||||||
|
|
||||||
testImplementation(libs.assertj)
|
testImplementation(libs.assertj)
|
||||||
runtimeOnly(libs.kotlin.scriptingCompilerEmbeddable)
|
runtimeOnly(libs.kotlin.scriptingCompilerEmbeddable)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
kotlin.code.style=official
|
kotlin.code.style=official
|
||||||
systemProp.sonar.host.url=http://localhost:9000
|
systemProp.sonar.host.url=http://localhost:9000
|
||||||
|
systemProp.dependency.analysis.test.analysis=false
|
||||||
org.gradle.parallel=true
|
org.gradle.parallel=true
|
||||||
org.gradle.caching=true
|
org.gradle.caching=true
|
||||||
org.gradle.jvmargs=-Xmx1g -XX:MaxMetaspaceSize=512m -Dfile.encoding=UTF-8
|
org.gradle.jvmargs=-Xmx1g -XX:MaxMetaspaceSize=512m -Dfile.encoding=UTF-8
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ contester-driver = { module = "io.github.davidburstrom.contester:contester-drive
|
|||||||
|
|
||||||
[plugins]
|
[plugins]
|
||||||
binaryCompatibilityValidator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version = "0.10.0" }
|
binaryCompatibilityValidator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version = "0.10.0" }
|
||||||
|
dependencyAnalysis = { id = "com.autonomousapps.dependency-analysis", version = "1.2.1" }
|
||||||
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
|
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
|
||||||
gradleVersions = { id = "com.github.ben-manes.versions", version = "0.42.0" }
|
gradleVersions = { id = "com.github.ben-manes.versions", version = "0.42.0" }
|
||||||
pluginPublishing = { id = "com.gradle.plugin-publish", version = "0.21.0" }
|
pluginPublishing = { id = "com.gradle.plugin-publish", version = "0.21.0" }
|
||||||
|
|||||||
Reference in New Issue
Block a user