gammax
09/02/2019, 9:37 AMAnthony f
09/05/2019, 9:07 AMAnthony f
09/06/2019, 7:21 AMxenomachina
09/12/2019, 12:37 AMinternal
(rather than private
) properties?Suraj Bokey
09/13/2019, 10:03 AMformatting:
active: true
android: false
autoCorrect: true
ImportOrdering:
active: false
autoCorrect: true
Indentation:
active: true
autoCorrect: true
indentSize: 2
continuationIndentSize: 2
dr.dreigh
09/16/2019, 1:58 PMhttps://gauthamprabhuk.files.wordpress.com/2014/12/cyclomatic-complexity-numbers.png▾
dr.dreigh
09/16/2019, 1:59 PM68
in relation to?dr.dreigh
09/17/2019, 8:03 AMAbstractProcessor.kt
and thought it may add up the complexity of all the methods of all the files. Our score of 68 is only over 39 functions, so it seems low enough - it's a new service, so fairly small. What do you think about reporting on average McCabe complexity per method in the detekt report? As the sum is only relevant to the project, but an average would be comparable to other applications.cmgurba
10/04/2019, 3:11 PMfun myFun(a,b) = logic()
. Rather than police improper usage of single expression i thought it'd just be easier to enforce return types across the board.Brais Gabin
10/12/2019, 11:58 AMEllen Spertus
10/18/2019, 8:20 PMadam-mcneilly
10/20/2019, 1:47 AMEllen Spertus
10/29/2019, 8:32 PMstop()
method that currently doesn’t do anything. I want the API to say that the stop()
method should be called when it is no longer needed. It’s not the caller’s business whether any instructions are there or not. There may be in the future. Or is this a case of YAGNI?sanogueralorenzo
11/06/2019, 9:39 PMKonstantin Petrukhnov
11/07/2019, 3:20 PMsanogueralorenzo
11/09/2019, 12:50 AMfilters = ".*build.*,.*/resources/"
excludes = ["**/build/**", "**/resources/**"]
sanogueralorenzo
11/09/2019, 1:24 AMplugins {
id "io.gitlab.arturbosch.detekt" version "1.1.1"
}
dependencies {
detektPlugins "io.gitlab.arturbosch.detekt:detekt-formatting:1.1.1"
}
task detektAll(type: io.gitlab.arturbosch.detekt.Detekt) {
description = "Runs detekt for the entire project."
input = files("$projectDir")
config = files("$rootDir/config/detekt/detekt.yml")
parallel = false
includes = ["**/*.kt", "**/*.kts"]
excludes = ["**/resources/**", "**/build/**", "**/buildSrc/**", "**/test/**/*.kt"]
baseline = file("$rootDir/config/detekt/baseline.xml")
reports {
xml { enabled = false }
html { enabled = false }
txt { enabled = false }
}
}
The detektFormat has disableDefaultRuleSets
& buildUponDefaultConfig
which I'm not sure if I should apply.
Also noticed that there is no need for a detekt format task if you just set autoCorrect
to true in the detektAll
Only thing I find a bit confusing is that if it can fix all the issues it will fix them but still fail. While on ktlintFormat it would only fail if it is not able to fix any of the issues. The reason I say it is confusing is because I can have 5 issues that only 3 have been fixed but all will be marked as failure. Which leaves the developer in the situation to not know for which ones to look because some of them might have already been fixed.
On the other hand for CI this is great because even if it is able to fix them it will fail and sends a clear message of: you have detektIssues run it locally, commit & pushsanogueralorenzo
11/18/2019, 6:04 PMmarschwar
11/18/2019, 8:48 PMadam-mcneilly
11/21/2019, 4:01 PMthuytrinh
11/22/2019, 10:23 AMDuration
type https://okkotlin.com/duration/ but it got flagged by the MagicNumber
rule. Just wondering whether anyone knows how to configure the MagicNumber
to exclude if I extract the whole Duration
into a constant like below?
@ExperimentalTime
class Operation {
companion object {
val DEFAULT_TIMEOUT = 3.seconds
}
@ExperimentalTime
fun read(timeout: Duration = DEFAULT_TIMEOUT) {
}
}
So w/ that example, detekt still complains that 3
should be constant.Jukka Siivonen
11/26/2019, 10:45 AMCzar
11/28/2019, 5:04 AMkotlin.spring
plugin applied and a class annotated with @Configuration
, but ProtectedMemberInFinalClass
is still triggered. The class is effectively open due to `kotlin.spring`plugin and this worked before on detekt 1.0.1, Boot 2.2.0.RC1, Kotlin 1.3.50.
Should I try to downgrade them one by one to find which version upgrade caused this or is it a known issue?robstoll
12/02/2019, 7:34 AMCould not set unknown property 'filters' for object of type io.gitlab.arturbosch.detekt.extensions.DetektExtension.
is this on purpose?sanogueralorenzo
12/03/2019, 1:22 AMdetektAll
a centric baseline is ignored. I switched to build.gradle.kts
to ensure that wasn't the issue and was checking detekt project and it is set the same way (and also have the same path)
baseline.set(file("$rootDir/config/detekt/baseline.xml"))
Was there any change regarding baseline? I don't seem to find it looking through 1.2.0 and 1.2.1Czar
12/08/2019, 11:39 AMtodo:
, but only in IntelliJ, because I use todo:
comments when working on a changeset. Showing those as errors kinda messes with the flow. On the other hand I wouldn't want to commit them, so I need them to be reported when I run gradle checkCzar
12/09/2019, 7:12 AMclass MyEntity {
val id: Long? = null
var prop1: String? = null
var prop2: String? = null
// ...
var propN: String? = null
}
and an update command:
class UpdateEntityCommand {
val myEntityId: Long
var prop1: String? = null
var prop2: String? = null
// ...
var propN: String? = null
}
the handler should only change property of the entity if corresponding property of the command is not null
:
class MyHandler(private val repo: MyEntityRepository) {
fun handle(command: UpdateEntityCommand) {
with(repository.getOne(command.myEntityId)) {
// (1)
if (command.prop1 != null) prop1 = command.prop1
// (2)
command.prop2?.let { prop2 = it }
// (3)
ifNotNull(command.propN) { propN = it }
}
}
}
If all the properties are set using method (1) or (3), detekt is happy, if method (2) is used, detekt is complaining about "ComplexMethod"
Should I report this to the issue tracker, or is it as it should be? If the latter, I wonder why?Eugen Martynov
12/11/2019, 2:54 PMabstract class MemoryCache<T> {
private val cachedValue = AtomicReference<T>()
fun getOrEmpty(): Maybe<T> = Maybe.fromCallable { cachedValue.get() }
fun set(value: T) {
this.cachedValue.set(value)
}
fun invalidate() {
cachedValue.set(null)
}
}
This class has concrete methodsEugen Martynov
12/16/2019, 1:06 PMoleg_osipenko
12/28/2019, 2:40 PMProperty 'custom-rules' is misspelled or does not exist
where 'custom-rules' is my custom ruleset's id.
How is it possible to fix this and enable my custom rules again?oleg_osipenko
12/28/2019, 2:40 PMProperty 'custom-rules' is misspelled or does not exist
where 'custom-rules' is my custom ruleset's id.
How is it possible to fix this and enable my custom rules again?schalkms
12/30/2019, 4:42 PMArtur Bosch
01/01/2020, 2:22 PMconfig:
validation: true
excludes: "sample-rules.*"
schalkms
01/01/2020, 8:52 PM--generate-config
. This means that by default detekt does not know about your new properties. Therefore we need to mention them in the configuration under `config>excludes`:oleg_osipenko
01/01/2020, 9:48 PM