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

    mauin

    02/05/2018, 6:13 AM
    Hey @Nanchen. Some rules do allow to change behavior depending on the class or depending on Annotations added to certain objects. But in general most projects (also Android) would use one configuration for the entire codebase.
    n
    a
    • 3
    • 10
  • m

    mauin

    02/06/2018, 6:42 AM
    If I understand correctly you’re only adding detekt to the top-level
    build.gradle
    file and then executing tasks for different gradle modules gives different results? And you also only define the config in the root project? If that’s the case it sounds weird. I agree, it makes sense only picking up the defined sourceSets and recursing in them to find all
    .kt
    files. However that will mean that the Gradle Plugin would have to automatically add detekt tasks to all submodules if the plugin is defined in the top-level. Otherwise we would never have any sourcesets to access.
    t
    s
    • 3
    • 4
  • a

    Artur Bosch

    02/07/2018, 12:20 PM
    @seb yep currently the detekt does not care about sourcesets and just parses from
    project.projectDir
    . In the rework I will make the gradle plugin sourceset aware ^^
    t
    • 2
    • 19
  • t

    toto

    02/07/2018, 12:55 PM
    @Artur Bosch I started to look at Detekt and the current plugin to get a better idea, but I find hard to wrap my head around the idea of profiles
    m
    a
    • 3
    • 8
  • a

    Artur Bosch

    03/04/2018, 5:33 PM
    we can still move it to its own repo later
    s
    • 2
    • 1
  • k

    kagomez

    03/20/2018, 11:17 PM
    is not generating reports I'm missing something?
    • 1
    • 2
  • k

    kagomez

    03/22/2018, 4:01 PM
    hey guys what you mean by
    optionally configure detekt for each sub module by using profiles (gradle-plugin)
    I have a modular project
    s
    • 2
    • 1
  • m

    mauin

    03/26/2018, 8:00 AM
    Yeah, I’ll make sure to mention all the changes in the notes and also updated all documentation already in the branch
    t
    s
    a
    • 4
    • 5
  • a

    Artur Bosch

    04/20/2018, 2:15 PM
    @sachin4203 please take a look at our build.gradle.kt file
    gradle
    	idea(Action {
    		path = "$userHome/.idea"
    		codeStyleScheme = "$userHome/.idea/idea-code-style.xml"
    		inspectionsProfile = "$userHome/.idea/inspect.xml"
    		report = "${rootProject.projectDir}/reports"
    		mask = "*.kt,"
    	})
    s
    • 2
    • 1
  • t

    Tobi

    04/23/2018, 9:46 AM
    Hey, we’re currently relying on
    1.0.0.RC6-3
    due to a breaking api change in
    1.0.0.RC6-4
    of the plugin. Since a couple of days we can’t resolve
    RC6-3
    anymore through the gradle plugins repo. Is this known?
    m
    • 2
    • 7
  • v

    vanniktech

    04/23/2018, 9:59 AM
    Is it possible to get a new version?
    t
    • 2
    • 5
  • e

    Eugen Martynov

    04/30/2018, 4:26 PM
    Are you team members using something else than AS or IDEA?
    s
    • 2
    • 1
  • a

    Artur Bosch

    05/01/2018, 11:11 AM
    @sachin4203 I don't know about android studio, but detekt expects the idea folder to have a subfolder bin which has inspect.sh and format.sh can you confirm that your Android Studio.app/Contents folder has them?
    s
    • 2
    • 2
  • c

    Czar

    05/15/2018, 11:17 PM
    checkstyle is the same, I believe. But there I understand why, because it's bundled with gradle it has to provide a way to utilize older rules configuration with newer checkstyle to avoid breaking the checks when gradle is upgraded. With detekt I do not see the rationale, maybe one of the authors would like to comment.
    x
    a
    • 3
    • 5
  • s

    seb

    06/21/2018, 10:05 AM
    Oh I thought you meant changed from the previous run/commit
    m
    t
    • 3
    • 3
  • t

    themishkun

    06/21/2018, 12:45 PM
    a-ha, found it!
    ruleSets
    is now gone, the right property is
    plugins
    . the docs here https://arturbosch.github.io/detekt/groovydsl.html#options-for-detekt-configuration-closure are outdated
    a
    • 2
    • 1
  • k

    kevinherron

    06/22/2018, 5:39 PM
    right now something like this:
    subprojects {
        apply plugin: "io.gitlab.arturbosch.detekt"
    
        detekt {
            version = "1.0.0.RC7-2"
            defaultProfile {
                input = file("src/main/kotlin")
                filters = ".*/resources/.*,.*/build/.*"
            }
        }
    }
    results :detektCheck running for each module… but analyzing the same module each time
    m
    • 2
    • 2
  • a

    Artur Bosch

    06/22/2018, 10:41 PM
    a gradle plugin rework will solve this sooner or later ...
    k
    • 2
    • 2
  • a

    Artur Bosch

    07/08/2018, 6:55 PM
    @Jukka Siivonen I answered in the issue, hope that helps, also I pushed a PR which documents how to add custom (or the formatting-jar) to the detekt tasks
    j
    • 2
    • 5
  • v

    vanniktech

    07/11/2018, 8:53 AM
    There's a ticket for snapshots but noone has tackled it yet
    m
    • 2
    • 5
  • s

    seb

    07/26/2018, 7:36 AM
    Cool, I need to submit a formal request for someone's time, hopefully to get both the Gradle plugin done/checked and to integrate it with our static analysis plugin
    ❤️ 1
    t
    • 2
    • 1
  • p

    pavlospt

    08/03/2018, 7:10 AM
    Currently what I have is
    expression.getCallNameExpression()?.textMatches("forEach")
    where
    expression
    is a
    KtCallExpression
    and I would like to also check that the class of the caller is a
    Map
    or something implementing a
    Map
    . This is the part though where I am getting it wrong, because it does not seem to be like UAST, where you can check the
    qualifiedName
    of elements.
    s
    • 2
    • 4
  • s

    ska

    08/03/2018, 8:35 AM
    a
    • 2
    • 1
  • a

    aandreyev

    08/07/2018, 9:30 PM
    m
    s
    a
    • 4
    • 16
  • k

    kenkyee

    08/13/2018, 4:54 PM
    is there a way prioritize a rule so it prints a warning but doesn't count in the issues calculation? I'm getting some pushback on leaving Detekt enabled for the LargeClass and TooManyFunctions rules because some of the older Java code is a bit monolithic and no one wants to refactor as part of the Kotlin conversion 😞
    a
    • 2
    • 6
  • p

    pavlospt

    08/23/2018, 6:57 AM
    hey everyone, we get the following exception when running Detekt.
    Running detekt 'unknown' on Java '1.8.0_144-b01' on OS 'Mac OS X'.
    ▸ Please create an issue and report this exception.
    ▸ java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:273)
    ▸ java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:280)
    ▸ java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1592)
    ▸ java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1582)
    ▸ java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
    ▸ java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
    ▸ java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
    ▸ java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
    I am not sure where to look for the cause. Does anyone have any idea?
    s
    • 2
    • 4
  • j

    Jukka Siivonen

    09/03/2018, 1:15 PM
    I can't find any documentation how to set up Detekt in multi module Gradle project, any tips?
    l
    • 2
    • 1
  • f

    fabio.carballo

    09/03/2018, 3:50 PM
    Hey! I'm trying to implement custom detekt rules: - I added a new module for the rules - Added the new rule and tests (and it's working) - Added the META-INFO/services/... to point to the custom rule set provider. - Integrate the new ruleset with my project. My problem is that I just can't get the rule to be flagged (although the new ruleset appears in the output). Even if call
    report
    without any condition. Has anyone faced this?
    m
    v
    a
    • 4
    • 16
  • a

    Artur Bosch

    09/08/2018, 2:44 PM
    only the register from configuration is still in incubating in 4.10
    v
    n
    • 3
    • 5
  • a

    Artur Bosch

    09/09/2018, 6:40 PM
    the gradle rework is merged - thanks to @mauin and @marschwar for the work! 🙂
    🎉 4
    m
    s
    v
    • 4
    • 10
Powered by Linen
Title
a

Artur Bosch

09/09/2018, 6:40 PM
the gradle rework is merged - thanks to @mauin and @marschwar for the work! 🙂
🎉 4
m

mauin

09/09/2018, 6:49 PM
Now a bit of testing (new RC?) And then v1?
The changelog for the new release should definitely contain a default description of how to migrate the plug-in
s

schalkms

09/09/2018, 7:24 PM
True. I agree.
a

Artur Bosch

09/09/2018, 7:34 PM
jep RC9 (after changelog + migration guide is generated/written) then v1!!
👏 1
I would also put a comment into the readme on how to migrate from RC8
v

vanniktech

09/09/2018, 8:27 PM
still feel like there are too many false positives and other improvements that should be fixed before v1 but maybe that’s just me
a

Artur Bosch

09/11/2018, 6:47 PM
there is plenty of time to fix them ^^ lets kill that shitty versioning :X
v

vanniktech

09/12/2018, 12:07 PM
I don't mind with that. Been used to that for detekt for the last years 😄
m

mauin

09/12/2018, 12:09 PM
RC as in Really Close to a real release 😛
a

Artur Bosch

09/23/2018, 9:41 PM
oh my, I have to the remember the
Really Close
😄
View count: 3