detekt: potential-bugs Deprecation does not work
fun deprecationSample() {
val r = 1 in 0.0..5.0
Date(2019, 5, 5)
}
- Operator
in
is deprecated in kotlin because “Thiscontains
operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.” - Constructor
Date
is deprecated in java because replaced byCalendar
Expected Behavior
The rule will work and the detekt will report an error.
Observed Behavior
Detekt does not report an error.
Steps to Reproduce
I use my task:
task<Detekt>("verifyQuality") {
source = files(subprojects.withPlugin("kotlin").srcDirs("main")).asFileTree
config = files(
"buildSrc/src/main/resources/detekt/config/potential_bugs.yml"
)
reports {
html {
enabled = true
destination = File(analysisQualityHtmlPath)
}
xml.enabled = false
txt.enabled = false
}
}
File potential_bugs.yml contains:
build:
maxIssues: 0
potential-bugs:
active: true
Deprecation:
active: true
processors:
active: false
Context
Detekt definitely works on other rule sets (for example, DuplicateCaseInWhenExpression). That is, the problem should not be in the source of the source code or the path to detekt configuration file. For some reason I can’t turn on this particular rule (Deprecation).
Environment
java 1.8.0_221 kotlin 1.3.50 detekt 1.1.1 Gradle 5.5.1 macOS Mojave Version 10.14.6 (18G87)
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 21 (13 by maintainers)
Thanks for the great issue report.
Deprecation
is a rule which relies on type resolution of the kotlin compiler which is experimental for now and needs two extra task propertiesclasspath
andjvmTarget
. We do not even ship documentation for them for now, sorry. The Cli documents the flags when--help
is used: https://github.com/arturbosch/detekt/blob/e3ab2f5454d4b60b45eda706ae17dcc36ea84682/detekt-cli/src/main/kotlin/io/gitlab/arturbosch/detekt/cli/CliArgs.kt#174