https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
detekt
  • m

    mjthornton

    02/11/2021, 1:37 AM
    Is there a way to prevent Detekt from running on certain files?
    • 1
    • 1
  • i

    igor.wojda

    02/13/2021, 2:11 PM
    I noticed that detekt does not checks files in the
    test
    folder (Android). How cna I enable this?
    b
    s
    • 3
    • 5
  • p

    Petros Paraskevopoulos

    02/15/2021, 10:27 AM
    Hi everyone, I tried to search a bit but couldn’t find the answer I am looking for, apologies if that was already asked. 🙏 Currently, detekt-intellij-plugin works with Detekt’s
    1.14.2
    version. I am also seeing this PR being open by @chao. Do we know if we are going to have an update to the intellij plugin soonish? As far as I understand this intellij plugin is not working with Detekt’s latest, non-rc,
    1.15.0
    version, is that right?
    g
    • 2
    • 3
  • m

    mkrussel

    03/01/2021, 3:39 PM
    So the gradle plugin creates tasks for running rules that require type resolution for android and jvm modules, but it does not seem to for multiplatform modules. Does anyone have examples for manually creating them.
    g
    • 2
    • 5
  • g

    gabrielfv

    03/01/2021, 4:17 PM
    Has anybody successfully managed to run detekt with type resolution as triggers on their projects? Either CI after build or as pre-commit/pre-push git hooks?
    g
    • 2
    • 3
  • j

    Javier

    03/06/2021, 10:27 AM
    I am checking the compiler plugin and it has merged the sarif support, but the last release was in sep 2020. Are there plans to release a new version?
    g
    • 2
    • 2
  • g

    gammax

    03/06/2021, 10:29 AM
    As a sidenote, we’re looking for a logo for Detekt. There are already some ideas here: https://github.com/detekt/detekt/issues/2717 But if you have more, please drop them there 😄
    j
    • 2
    • 5
  • j

    Javier

    03/07/2021, 12:57 AM
    I am trying CodeQL Action + detekt. I can upload the sarif file without problems and it detects where are the code smells, but I get this error:
    Preview unavailable
    Sorry, we couldn't find this file in the repository.
    I am using it in a multiplatform project, can be related?
    g
    b
    c
    • 4
    • 31
  • a

    Andrew

    03/10/2021, 12:24 PM
    Hey folks 👋 I'm looking into removing jcenter given the news. But we I do that I run into an issue with detekt's dependency on:
    kotlinx-html-jvm-0.6.12.pom
    Could not resolve all files for configuration ':detekt'.
       > Could not find org.jetbrains.kotlinx:kotlinx-html-jvm:0.6.12.
         Searched in the following locations:
           - <https://dl.google.com/dl/android/maven2/org/jetbrains/kotlinx/kotlinx-html-jvm/0.6.12/kotlinx-html-jvm-0.6.12.pom>
           - <https://repo.maven.apache.org/maven2/org/jetbrains/kotlinx/kotlinx-html-jvm/0.6.12/kotlinx-html-jvm-0.6.12.pom>
           - <https://jitpack.io/org/jetbrains/kotlinx/kotlinx-html-jvm/0.6.12/kotlinx-html-jvm-0.6.12.pom>
         Required by:
             project : > io.gitlab.arturbosch.detekt:detekt-cli:1.2.1
    b
    • 2
    • 4
  • s

    seb

    03/10/2021, 5:05 PM
    Hey folks, your code runs Prime Video 😉 https://aws.amazon.com/blogs/opensource/adopting-kotlin-at-prime-video-for-higher-developer-satisfaction-and-less-code/
    :kotlin-intensifies: 3
    g
    • 2
    • 1
  • s

    Sebastian Schuberth

    03/10/2021, 11:02 PM
    I'm also trying to use detekt 1.16.0 + SARIF + CodeQL Action. But for some reason the SARIF has empty
    "results" : [ ]
    although on the CLI I see issues. Any idea why that could be? Who wants to try, use the
    detekt-action
    branch from https://github.com/oss-review-toolkit/ort.
    c
    • 2
    • 15
  • a

    alexfu

    03/13/2021, 1:35 PM
    Hi, new to detekt here. i’m setting it up in my android project and came across this in the default config:
    formatting:
      active: true
      android: false
    what does the
    android: false
    setting mean? i couldn’t find any documentation on it.
    g
    • 2
    • 4
  • a

    alorma

    03/15/2021, 5:29 PM
    Hi! One question, how can I check if a function is inside of
    interface
    or
    class
    ? I want to check if a method is anotated with
    @Deprecated
    but only need to check interfaces, not implementations Current code on thread
    g
    c
    • 3
    • 5
  • s

    spand

    03/18/2021, 10:31 AM
    I am having trouble getting
    NullableToStringCall
    rule to work. This is a new setup but I have done the following steps: 1. Setup detekt in gradle 2. Run generateDetektConfig task and edited the config to: 3. Set all rulesets to active false except
    potentialbugs
    4. Set all rules to active: false in the ruleset except
    IteratorNotThrowingNoSuchElementException
    and
    NullableToStringCall
    . Both are true 5. In the same file I have the example noncompliant code for
    NullableToStringCall
    and a noncompliant code for
    IteratorNotThrowingNoSuchElementException
    . 6. Only the
    IteratorNotThrowingNoSuchElementException
    code will fail the task. Any ideas of what I am doing wrong ? The only difference between the rules I can see is that
    NullableToStringCall
    is off by default.
    b
    • 2
    • 4
  • c

    chao

    03/18/2021, 4:26 PM
    Good day all 👋 We just dropped 
    detekt-intelllij-plugin
     version 
    1.15.0
     stable: This will align with the
    detekt:1.15.0
    . Please help us by playing around with the plugin and reporting bugs and features. If it looks good, we will continue to release
    detekt-intellij-plugin
    version
    1.16.0
    to catch up with the main
    detekt
    release.
    :kotlin-intensifies: 1
    🎉 4
    s
    p
    • 3
    • 7
  • j

    Joe

    03/19/2021, 8:01 PM
    I have factory methods in a companion object that are inline so that they can use a reified type parameter which are triggering the
    MemberNameEqualsClassName
    rule. Is inline factory functions a known issue with this rule (or am I perhaps doing something else wrong that's making it trigger)?
    b
    • 2
    • 7
  • c

    chao

    03/21/2021, 6:46 PM
    Hello folks, we just renamed the master branch to main in order to remove oppressive languages. If you have a local clone, you may need to run the following command to update
    git branch -m master main
    git fetch origin
    git branch -u origin/main main
    If you encounter any problems, please feel free to reply to this thread or open a Github issue
    ❤️ 6
    • 1
    • 1
  • j

    Javier

    03/22/2021, 8:28 AM
    I think Sarif file is not checking the multiple
    @Suppress
    annotations I have, is it a known issue or I have to configure something to get it working?
    g
    b
    • 3
    • 4
  • c

    chao

    03/24/2021, 4:06 PM
    Android Lint published api guidelines yesterday. This is a great read and can inspire more changes for Detekt http://googlesamples.github.io/android-custom-lint-rules/
    :kotlin-intensifies: 11
    n
    k
    w
    • 4
    • 14
  • c

    chao

    03/25/2021, 3:11 PM
    Good day all 👋 
    detekt-intelllij-plugin
     version 
    1.16.0
     stable is now available with the latest 
    detekt:1.16.0
    https://plugins.jetbrains.com/plugin/10761-detekt
    🎉 7
    s
    • 2
    • 2
  • h

    Henning B

    03/25/2021, 4:27 PM
    Hi there! I want to integrate Detekt in a large Android code base. We have multiple modules with different build variants. E.g. we got several modules with the variant free/pro. When I run detektFreeDebug for only one module a report is created. I can create reports for the other modules by executing moduleName:detektFreeDebug though. Is this normal? Is it possible to execute all matching modules with one task?
    g
    • 2
    • 12
  • h

    Henning B

    03/29/2021, 7:55 PM
    I am missing the gradle tasks
    detektIdeaInspect
    and
    detektIdeaFormat
    which are mentioned here: https://detekt.github.io/detekt/gradle.html#available-plugin-tasks Also I am also not able to include an
    idea { }
    configuration into my detekt block. It cannot be resolved. What am I missing? I would like to check if my code is formatted according to the android studio code style via gradle.
    c
    b
    • 3
    • 5
  • i

    Ihar S

    03/30/2021, 11:12 AM
    Hello Detekt Magicians, Small question, does detekt supports remote config files? We have dozens of kotlin repos and the centralized configuration file can improve some processes in the company Googling hasn't answered my question
    g
    j
    • 3
    • 2
  • c

    Coen

    04/01/2021, 1:19 PM
    Is there any popular detekt config used by big companies like there is for PMD's etc besides the default config?
    👀 1
    a
    • 2
    • 1
  • v

    vineethraj49

    04/04/2021, 5:52 AM
    hi, i'm trying to write a detekt extension; how do I know if a
    KtLambdaExpression
    is suspending in nature?
    ✅ 1
    e
    • 2
    • 5
  • v

    vineethraj49

    04/04/2021, 11:18 AM
    how do I know a KDoc annotation got added? am trying 1.16.0, (pre move to
    @RequiresTypeResolution
    , still uses kdoc
    @requiresTypeResolution
    ), but it doesn't seem to pick up/enable type inference for a rule how to check if kdoc annotation had been added?
    ✅ 1
    g
    • 2
    • 7
  • v

    vineethraj49

    04/05/2021, 3:56 AM
    context: i am trying to replicate the behavior of https://github.com/JetBrains/intellij-community/blob/master/jvm/jvm-analysis-impl/[…]ion/blockingCallsDetection/ThrowsTypeBlockingMethodChecker.java problem: KtCallExpression.getResolvedCall(bindingContext) gives JavaMethodDescriptor; the referenced PsiMethod for the JavaMethodDescriptor would be in rt.jar; 1. how to resolve to the PsiMethod from JavaMethodDescriptor? 2. or get the PsiMethod/PsiReferenceList some other way at analysis time? one way I can think of doing 2, is specifically just loading
    ((descriptor.source as JavaSourceElement).javaElement as BinaryJavaMethod).containingClass
    at runtime
    g
    • 2
    • 5
  • a

    Alex

    04/14/2021, 10:02 AM
    Hey, is there a detekt rule for failing builds if
    when
    branches are not exhaustive?
    g
    • 2
    • 4
  • y

    yahyabayramoglu

    04/15/2021, 8:24 AM
    Hey folks, I'm trying to write a check. Probably doing some rookie mistake there, but I couldn't find anything similar on stackoverflow nor a similar check in the repo 😅 So, I posted a question here - any help is appreciated 🙏
    g
    • 2
    • 4
  • v

    Vivek Krishnan

    04/15/2021, 9:40 AM
    I’m having some trouble setting up detekt in my gradle build script: 1. I have added
    id("io.gitlab.arturbosch.detekt") version "1.16.0" apply true
    in my plugins section 2. added
    jcenter()
    into my repositories section 3. In the subproject section, I’ve added a task to register detekAll
    * What went wrong:
    Script compilation errors:
    Line 58:         def autoFix = project.hasProperty('detektAutoFix')
    ^ Expecting an element
    Line 58:         def autoFix = project.hasProperty('detektAutoFix')
    ^ Expecting an element
    Line 55:     tasks.register()
    ^ None of the following functions can be called with the arguments supplied:
    public abstract fun register(p0: String!): TaskProvider<Task!>! defined in org.gradle.api.tasks.TaskContainer
    public abstract fun <T : Task!> register(p0: String!, p1: Class<TypeVariable(T)!>!): TaskProvider<TypeVariable(T)!>! defined in org.gradle.api.tasks.TaskContainer
    public abstract fun <T : Task!> register(p0: String!, p1: Class<TypeVariable(T)!>!, vararg p2: Any!): TaskProvider<TypeVariable(T)!>! defined in org.gradle.api.tasks.TaskContainer
    public abstract fun <T : Task!> register(p0: String!, p1: Class<TypeVariable(T)!>!, p2: Action<in TypeVariable(T)!>!): TaskProvider<TypeVariable(T)!>! defined in org.gradle.api.tasks.TaskContainer
    public abstract fun register(p0: String!, p1: Action<in Task!>!): TaskProvider<Task!>! defined in org.gradle.api.tasks.TaskContainer
    Line 57:     tasks.register("detektAll", io.gitlab.arturbosch.detekt.Detekt) {
    ^ Not enough information to infer type variable T
    Line 57:     tasks.register("detektAll", io.gitlab.arturbosch.detekt.Detekt) {
    ^ Classifier 'Detekt' does not have a companion object, and thus must be initialized here
    Line 58:         def autoFix = project.hasProperty('detektAutoFix')
    ^ Too many characters in a character literal ''detektAutoFix''
    Line 60:         description = "Custom DETEKT build for all modules"
    ^ Variable expected
    Line 61:         parallel = true
    ^ Variable expected
    Line 62:         ignoreFailures = false
    ^ Variable expected
    Line 63:         autoCorrect = autoFix
    ^ Variable expected
    Line 64:         buildUponDefaultConfig = true
    ^ Variable expected
    Line 71:             html.enabled = true
    ^ Variable expected
    Line 72:             xml.enabled = false
    ^ Variable expected
    Line 73:             txt.enabled = false
    ^ Variable expected
    g
    • 2
    • 4
Powered by Linen
Title
v

Vivek Krishnan

04/15/2021, 9:40 AM
I’m having some trouble setting up detekt in my gradle build script: 1. I have added
id("io.gitlab.arturbosch.detekt") version "1.16.0" apply true
in my plugins section 2. added
jcenter()
into my repositories section 3. In the subproject section, I’ve added a task to register detekAll
* What went wrong:
Script compilation errors:
Line 58:         def autoFix = project.hasProperty('detektAutoFix')
^ Expecting an element
Line 58:         def autoFix = project.hasProperty('detektAutoFix')
^ Expecting an element
Line 55:     tasks.register()
^ None of the following functions can be called with the arguments supplied:
public abstract fun register(p0: String!): TaskProvider<Task!>! defined in org.gradle.api.tasks.TaskContainer
public abstract fun <T : Task!> register(p0: String!, p1: Class<TypeVariable(T)!>!): TaskProvider<TypeVariable(T)!>! defined in org.gradle.api.tasks.TaskContainer
public abstract fun <T : Task!> register(p0: String!, p1: Class<TypeVariable(T)!>!, vararg p2: Any!): TaskProvider<TypeVariable(T)!>! defined in org.gradle.api.tasks.TaskContainer
public abstract fun <T : Task!> register(p0: String!, p1: Class<TypeVariable(T)!>!, p2: Action<in TypeVariable(T)!>!): TaskProvider<TypeVariable(T)!>! defined in org.gradle.api.tasks.TaskContainer
public abstract fun register(p0: String!, p1: Action<in Task!>!): TaskProvider<Task!>! defined in org.gradle.api.tasks.TaskContainer
Line 57:     tasks.register("detektAll", io.gitlab.arturbosch.detekt.Detekt) {
^ Not enough information to infer type variable T
Line 57:     tasks.register("detektAll", io.gitlab.arturbosch.detekt.Detekt) {
^ Classifier 'Detekt' does not have a companion object, and thus must be initialized here
Line 58:         def autoFix = project.hasProperty('detektAutoFix')
^ Too many characters in a character literal ''detektAutoFix''
Line 60:         description = "Custom DETEKT build for all modules"
^ Variable expected
Line 61:         parallel = true
^ Variable expected
Line 62:         ignoreFailures = false
^ Variable expected
Line 63:         autoCorrect = autoFix
^ Variable expected
Line 64:         buildUponDefaultConfig = true
^ Variable expected
Line 71:             html.enabled = true
^ Variable expected
Line 72:             xml.enabled = false
^ Variable expected
Line 73:             txt.enabled = false
^ Variable expected
g

gammax

04/15/2021, 9:43 AM
Can you post your whole build.gradle file?
v

Vivek Krishnan

04/15/2021, 9:46 AM
message has been deleted
import org.gradle.plugins.ide.idea.model.IdeaLanguageLevel
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.springframework.boot.gradle.plugin.SpringBootPlugin
import org.springframework.boot.gradle.tasks.run.BootRun

plugins {
    base
    id("com.dorongold.task-tree") version "1.4"
    id("org.springframework.boot") version "2.4.1" apply false
    kotlin("jvm") version "1.4.21"
    kotlin("plugin.spring") version "1.4.21" apply false
    id("org.sonarqube") version "3.1.1"
    idea
    jacoco
    id("io.gitlab.arturbosch.detekt") version "1.16.0" apply true
}

group = "com.abc.engine"

allprojects {
    val runningOnGitlabCI = System.getenv("GITLAB_CI")?.toBoolean() == true

    version = when {
        runningOnGitlabCI -> System.getenv("CI_COMMIT_TAG") ?: System.getenv("CI_PIPELINE_ID") ?: "ci_undefined"
        else -> "undefined"
    }

    repositories {
        mavenCentral()
        maven(url = "<https://oss.jfrog.org/artifactory/oss-snapshot-local/>")
        jcenter()
    }
}

val SRC_ENCODING = "UTF-8"
val SRC_VERSION = 11

idea {
    project {
        jdkName = "$SRC_VERSION"
        languageLevel = IdeaLanguageLevel("$SRC_VERSION")
        vcs = "Git"
    }

    module {
        excludeDirs = excludeDirs + file(".gradle/")
    }
}

subprojects {
    apply(plugin = "kotlin")
    apply(plugin = "jacoco")
    apply(plugin = "detek")

//    tasks.register()

//    tasks.register("detektAll", io.gitlab.arturbosch.detekt.Detekt) {
//        def autoFix = project.hasProperty('detektAutoFix')
//
//        description = "Custom DETEKT build for all modules"
//        parallel = true
//        ignoreFailures = false
//        autoCorrect = autoFix
//        buildUponDefaultConfig = true
//        setSource(projectSource)
//        baseline.set(baselineFile)
//        config.setFrom(configFile)
//        include(kotlinFiles)
//        exclude(resourceFiles, buildFiles)
//        reports {
//            html.enabled = true
//            xml.enabled = false
//            txt.enabled = false
//        }
//    }

//    tasks.register("detektGenerateBaseline", io.gitlab.arturbosch.detekt.DetektCreateBaselineTask) {
//        description = "Custom DETEKT build to build baseline for all modules"
//        parallel = true
//        ignoreFailures = false
//        buildUponDefaultConfig = true
//        setSource(projectSource)
//        baseline.set(baselineFile)
//        config.setFrom(configFile)
//        include(kotlinFiles)
//        exclude(resourceFiles, buildFiles)
//    }

    tasks.withType<Test>().configureEach {
        useJUnitPlatform()
        testLogging {
            events("failed")
        }
        maxParallelForks = Runtime.getRuntime().availableProcessors()

    }

    tasks.withType<KotlinCompile>().configureEach {
        kotlinOptions {
            jvmTarget = "11"
            kotlinOptions.useIR = true
        }
    }

    tasks.withType<BootRun>().configureEach {
        val profiles = System.getenv("SPRING_PROFILES_ACTIVE")
        if (profiles == null || profiles.trim() == "") {
            val springProfilesActive = project.gradle.startParameter.systemPropertiesArgs["spring.profiles.active"]
                    ?: "localdev"
            args = ((args ?: emptyList()) + "--spring.profiles.active=$springProfilesActive")
        }
        jvmArgs = listOf("-Xmx512m")
    }

    tasks.check {
        finalizedBy(tasks.jacocoTestReport)
    }

    tasks.jacocoTestReport {
        dependsOn(tasks.test)
        reports {
            xml.isEnabled = true
            csv.isEnabled = false
            html.isEnabled = false
        }
    }

    // global dependencies configuration
    dependencies {
        "annotationProcessor"(platform(SpringBootPlugin.BOM_COORDINATES))

        "implementation"(platform(SpringBootPlugin.BOM_COORDINATES))
        "implementation"(enforcedPlatform("com.amazonaws:aws-java-sdk-bom:1.11.862")) // amazon v1 bom
        "implementation"(enforcedPlatform("software.amazon.awssdk:bom:2.14.19")) // amazon v2 bom
        "implementation"(kotlin("stdlib"))
        "implementation"(kotlin("reflect"))

        "compileOnly"(platform(SpringBootPlugin.BOM_COORDINATES))
        "compileOnly"("org.springframework.boot:spring-boot-configuration-processor")

        "testImplementation"(platform(SpringBootPlugin.BOM_COORDINATES))
        "testImplementation"("org.junit.jupiter:junit-jupiter-api")
        "testImplementation"("org.junit.jupiter:junit-jupiter-params")

        "testRuntimeOnly"(platform(SpringBootPlugin.BOM_COORDINATES))
        "testRuntimeOnly"("org.junit.jupiter:junit-jupiter-engine")
//        "detektPlugins"("io.gitlab.arturbosch.detekt:detekt-formatting:1.16.0")
    }
}
I’ve commented as I was getting errors
View count: 45