https://kotlinlang.org logo
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
  • h

    hfhbd

    05/09/2022, 8:31 AM
    Hey, is it possible to exclude a rule based on the receiver Name/type?
    b
    • 2
    • 3
  • s

    seb

    05/10/2022, 8:39 AM
    Hi folks, after updating to 1.20.0, I get this error when building:
    Execution failed for task ':app:detekt'.
    > Run failed with 1 invalid config property.
      	- Property 'formatting' is misspelled or does not exist.
    If I take out the
    formatting
    section in the config (which is only setting
    active: false)
    , it works fine. Looking at the 1.20.0 release notes, there's a mention about something changing in how the formatting rules are configured, but there is no example, migration guide, nothing — only a link to a couple PRs with no documentation. I don't use the
    formatting
    plugin, so am I ok with just removing the corresponding section from the config? And how would it work if I actually wanted to use the plugin? I'm not super clear on this... do I need a separate config file? And if so, how do I associate it with the plugin?
    g
    • 2
    • 3
  • t

    Tim Oltjenbruns

    05/10/2022, 2:06 PM
    I’m trying to run both the compiler plugin and the main gradle plugin at the same time. When I do this, the main gradle plugin cannot find it’s
    versions.properties
    in resources anymore, and I’m struggling to figure out why. Any ideas that could get me unstuck?
    c
    • 2
    • 7
  • t

    Tim Oltjenbruns

    05/10/2022, 2:35 PM
    Happy to contribute to the compiler plugin. I think one of the important features is autocorrect. But I can’t imagine changing the source files during compile is allowed (or even a good idea?). Currently my solution is to load both plugins and rename the gradle extensions in the compiler plugin so they do not conflict. Then run the detekt task from
    io.gitlab.arturbosch.detekt
    with auto correct before the build. Should be fine because I don’t think any type resolution rules have auto correct? I have a very rough POC doing this now. Any feedback on this approach?
    g
    s
    • 3
    • 5
  • p

    PJ Walstrom

    05/13/2022, 3:51 PM
    Is it possible to configure detekt to allow characters outside of the
    a-z
    range in e.g. function names? I see that `parameterPattern: '[a-z][A-Za-z0-9]*'`is used, but I would like to use the Norwegian characters
    æ
    ,
    ø
    and
    å
    in function names, too. Any help would be highly appreciated!
    fun vilkårsØnske() {}
    ➕ 1
    g
    • 2
    • 3
  • z

    Zac Sweers

    05/16/2022, 5:43 PM
    how often is autocorrect implemented? I was surprised to see that
    VarCouldBeVal
    didn’t implement it for what seems like a trivial-ish change. In some quick testing, I don’t really see any other autocorrects kicking in when updating from 1.18 to 1.20
    s
    • 2
    • 2
  • b

    bobby

    05/18/2022, 1:15 AM
    hi everyone, is there a feature in Detekt like importing custom rule from community to our project? for example, I want to use all rules that widely use by Airbnb or Stream instead of the default one on my project. one of my friend told me that this feature is available in ESLInt, and its quite interesting actually to have it on Detekt too when digging to this, I come to conclusion that replacing the
    config.yml
    could be a way to do it, cmiiw thanks and have a great day
    g
    • 2
    • 4
  • j

    Javed Nissar

    05/18/2022, 6:22 PM
    Is there any reason to expect
    detektBaselineMain
    and
    detektBaseline
    to return different results? We're seeing that on our codebase. Specifically, in the sense that rules we've turned off are actually turned off in
    detektBaseline
    but do not seem to be turned off in
    detektBaselineMain
    g
    e
    • 3
    • 4
  • a

    alorma

    05/19/2022, 8:36 AM
    Hi all! I’ve a doubt on using detekt (:android: ). I’ve a rule that ?ve added a test for it, when running the test the rule complains sucesfully, but later on running
    ./gradlew deteket
    on the real app code doesn’t throw any smell… code in 🧵
    j
    g
    • 3
    • 7
  • d

    dimsuz

    05/19/2022, 12:54 PM
    We have released a set of Detekt rules which help us find common errors while working on Compose code. https://github.com/appKODE/detekt-rules-compose
    ❤️ 8
    b
    • 2
    • 11
  • p

    Peter Mandeljc

    05/31/2022, 9:00 AM
    hm, would it make sense to have a rule for defining exception as object? I think stacktrace would not be correct, if I do following:
    object TitanicSinking : RuntimeException()
    
    // somewhere else
    throw TitanicSinking
    b
    • 2
    • 12
  • b

    Big Chungus

    06/03/2022, 8:58 AM
    Detekt Ij plugin seems to be unable to support mpp projects. Is this a known issue or just me?
    g
    l
    • 3
    • 9
  • c

    Csabi Szenczi

    06/03/2022, 11:33 AM
    Hi, How can I include checking of xml files in detekt? I would like to apply to some rules on them. Can someone help me with this please?
    g
    • 2
    • 3
  • l

    LeoColman

    06/04/2022, 5:51 PM
    Hello guys! I think I might have found a bug in Detekt. https://github.com/LeoColman/Petals/commit/7c16d82a999f3f65b30f2c19bd411f6d3db1c8de#diff-6bbb3aa0c72ccab5cb844fd4b[…]8ab4c6110c06add1d36615718f64R62 In this commit we implemented an workaround to the following issue:
    AndroidView({ LineChart(it) }, Modifier) {
        val a = "abc"
        val b = "def
    }
    This codes makes detekt fail and autocorrect it to
    AndroidView({ LineChart(it) }, Modifier) {
    val a = "abc"
    val b = "def
    }
    A workaround for this case is
    AndroidView(::LineChart, Modifier) {
        val a = "abc"
    }
    Which is considered correct by
    ./gradlew detekt
    Is this a known/intended behaviour? Should I open an issue on this?
    e
    g
    • 3
    • 9
  • r

    Rodrigo Silva

    06/07/2022, 5:48 PM
    Hello all, How can i set the *detekt.yam*l path, using detekt.configure {} ?
    j
    g
    • 3
    • 7
  • p

    PJ Walstrom

    06/13/2022, 7:12 AM
    Hello there, we are running detekt as a plugin in our gradle-build, and also as a GitHub Action. Both are using the same configuration file. At least we hope they do 😅 Nonetheless, the local build fails with
    DataSource.kt:23:1: Unexpected indentation (20) (should be 16) [Indentation]
    Whereas the GHA-variant runs ok. Any suggestions to why? We are using the 1.20.0 version of the gradle plugin, and also the 1.20.0 version of the GHA. Any help would be highly appreciated 🙂
    b
    g
    • 3
    • 3
  • g

    Gouri Panda

    06/14/2022, 3:01 PM
    Hi there! After changing some code in
    detekt
    repo, i can’t see the new result in terminals. Is there something missing that i need to do before i see the new result? Thanks!
    b
    • 2
    • 12
  • e

    elect

    06/15/2022, 4:06 PM
    does anybody have a working prototype/example with a rule module and a consumer project module?
    g
    • 2
    • 1
  • b

    bbaldino

    06/16/2022, 7:55 PM
    I’ve got an empty override method that detekt 1.20.0 is complaining about (
    EmptyFunctionBlock
    ), but I found this bug which was fixed, which should allow overridden methods to have empty blocks. It was a while ago, though, has something changed since this?
    g
    • 2
    • 3
  • b

    bbaldino

    06/16/2022, 8:34 PM
    Should the intellij plugin “sync” with the ruleset file in the project? I’ve tweaked some rules, but still see warnings in intellij. Closing and reopening the project didn’t fix it either.
    • 1
    • 1
  • l

    Luka Štorek

    06/21/2022, 10:48 AM
    Hey, is it possible to ignore TrailingComma for unit tests? As it adds it to all Spek tests because of ({})
  • m

    mkrussel

    06/23/2022, 3:06 PM
    I recently reinstalled Android Studio version
    2021.1.1 Patch 2
    which then installed the latest version of the detekt plugin (
    1.20.1
    ). I'm using version
    1.19.0
    of detekt. After that I'm getting several false positives for
    Missing newline after "("
    and
    Missing newline before ")"
    warnings. They all report as being on at line 1 column 1. Running detekt from gradle does not report any issues. Not sure the plugin is incompatible with the version of Android Studio being used, or if I need to upgrade to a new version of detekt.
    c
    • 2
    • 11
  • t

    Tim Oltjenbruns

    06/30/2022, 8:37 PM
    Would there be any interest in an update to the XML report merger to filter out duplicate smell entries? We merge our detekt reports from multiple android flavors, and it creates duplicate smells in the merged report. Those duplicate smells are sent to our Sonar. Good value add for everyone or too specialized / not complexity we want in the detekt codebase?
    👍 2
    g
    • 2
    • 3
  • e

    eygraber

    06/30/2022, 9:49 PM
    Has anyone run into any issues with Detekt 1.21.0-RC2 and Kotlin 1.7 when using type resolution - https://github.com/detekt/detekt/issues/5021
    g
    m
    • 3
    • 7
  • k

    KamilH

    07/15/2022, 12:26 PM
    I’m trying to integrate
    detekt
    in my project. In the top level project’s
    build.gradle.kts
    file I have:
    apply(plugin = "io.gitlab.arturbosch.detekt")
    
    buildscript {
        repositories.applyDefault()
        dependencies {
            (...)
            classpath("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.20.0")
        }
    }
    it synchronizes just fine, but when I try to configure it in the
    detekt
    block I get
    Unresolved reference: detekt
    error. Is there anything I’m missing? I had very similar integration in another project and it worked as expected. The only difference was that I was using groovy instead of kotlin in gradle files there.
    • 1
    • 1
  • g

    Gouri Panda

    07/15/2022, 8:08 PM
    Hi there! I can’t find any jetbrain’s documentation about their API’s that’ll help me understand the project more. Is there any official or not official documentation, blog or talk anything helpful? Thanks in advance!
    t
    m
    • 3
    • 5
  • l

    LeoColman

    07/16/2022, 2:41 PM
    Hey guys! Do you usually display Detekt results in the README some way? I was thinking that it would be an interesting shield to have in projects, a code-quality based on detekt findings. I couldn't find anything that could help me with this in
    <http://shields.io|shields.io>
    . Do you have any ideas?
    b
    • 2
    • 12
  • j

    Javier

    07/18/2022, 10:26 PM
    After enabling Markdown, I have seen that it is being generated in a subfolder, in which html is included too, is it correct? Previously in detekt 1.20 I was getting the html at same level than the sarif and xml files.
    • 1
    • 1
  • e

    eygraber

    07/19/2022, 6:25 AM
    Would detekt ever expose something like registerDetektTask ? It would save a lot of headache when registering custom detekt tasks for things like intermediate KMP source sets.
    g
    t
    • 3
    • 7
  • l

    Lucas Mo

    07/21/2022, 8:43 PM
    hey people! Is this the place to ask questions related to migration across detekt versions?
Powered by Linen
Title
l

Lucas Mo

07/21/2022, 8:43 PM
hey people! Is this the place to ask questions related to migration across detekt versions?
View count: 5