Skip to content

Instantly share code, notes, and snippets.

@IslamKhSh
Created May 29, 2021 12:08
Show Gist options
  • Save IslamKhSh/5a0c3c12f8def60ae1022311119a6f42 to your computer and use it in GitHub Desktop.
Save IslamKhSh/5a0c3c12f8def60ae1022311119a6f42 to your computer and use it in GitHub Desktop.
buildscript {
repositories {
mavenCentral()
gradlePluginPortal()
}
dependencies {
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.17.1"
}
}
apply plugin: 'io.gitlab.arturbosch.detekt'
subprojects {
apply plugin: 'io.gitlab.arturbosch.detekt'
tasks.withType(io.gitlab.arturbosch.detekt.Detekt).configureEach {
jvmTarget = "1.8"
}
}
configurations {
detekt
}
dependencies {
detekt 'io.gitlab.arturbosch.detekt:detekt-cli:1.17.1'
detektPlugins "io.gitlab.arturbosch.detekt:detekt-formatting:1.17.1"
}
tasks.register("detektAll", io.gitlab.arturbosch.detekt.Detekt) {
description = "Custom DETEKT build for all modules"
// Builds the AST in parallel. Rules are always executed in parallel.
// Can lead to speedups in larger projects. `false` by default.
parallel = true
// Define the detekt configuration(s) you want to use.
// Defaults to the default detekt configuration.
config.setFrom(files("$rootDir/detekt-config.yml"))
// Applies the config files on top of detekt's default config file. `false` by default.
buildUponDefaultConfig = true
autoCorrect = true
// Turns on all the rules. `false` by default.
allRules = false
// Disables all default detekt rulesets and will only run detekt with custom rules
// defined in plugins passed in with `detektPlugins` configuration. `false` by default.
disableDefaultRuleSets = false
// Adds debug output during task execution. `false` by default.
debug = true
// If set to `true` the build does not fail when the
// maxIssues count was reached. Defaults to `false`.
ignoreFailures = false
// Specify the base path for file paths in the formatted reports.
// If not set, all file paths reported will be absolute file path.
setSource(projectDir)
reports {
xml {
enabled = true
destination = file("build/reports/detekt.xml")
}
html {
enabled = true
destination = file("build/reports/detekt.html")
}
txt {
enabled = true
destination = file("build/reports/detekt.txt")
}
sarif {
enabled = true
destination = file("build/reports/detekt.sarif")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment