github detekt/detekt v1.19.0-RC1

latest releases: v1.23.6, v1.23.5, v1.23.4...
2 years ago

v1.19.0-RC1 - 2021-10-31

Notable Changes
  • We now offer an ignoreAnnotated configuration key that you can use on all your rules to suppress findings if inside an annotated block (e.g. @Composable) - #4102
  • Report configuration is changing in the Gradle plugin. The reports extension on the detekt extension has been
    deprecated. See the Migration section below for steps to migrate to the new recommended configuration - #3687
  • The ExplicitCollectionElementAccessMethod rule is now a type-resolution only rule - #4201
  • The InvalidPackageDeclaration rule has been split to create the MissingPackageDeclaration rule - #4149
  • The ForbiddenComment rule now offer a customMessage configuration key - #4126
  • We bumped ktlint and updated the default enabled rules to mirror what ktlint is doing - #4179
  • Add a new ConsoleReport format - #4027
  • Gradle: We removed the afterEvaluate wrapper from the Android and KMM plugin - #4159
  • We now test against Java 17 and stopped testing against Java 16 - #4136
  • Remove library specific configurations like Jetpack Compose and Dagger from the default config - #4101
  • Remove detekt-bom module - #4043
  • Use reference in fallback property delegate - #3982
Migration

Configuring reports in the Gradle plugin should be done at the task level instead of at the extension (or global) level.
The previous recommendation resulted in the report output for multiple tasks overwriting each other when multiple detekt
tasks were executed in the same Gradle run.

Before this release the recommended way to configure reports was using the detekt extension:

detekt {
    reports {
        xml {
            enabled = true
            destination = file("build/reports/detekt/detekt.xml")
        }
    }
}

This meant all detekt tasks would output the report to the same destination. From this detekt release you should enable
and disable reports for all tasks using the withType Gradle method:

// Kotlin DSL
tasks.withType<Detekt>().configureEach {
    reports {
        xml.required.set(true)
    }
}
// Groovy DSL
tasks.withType(Detekt).configureEach {
    reports {
        xml.required.set(true)
    }
}

To customize the report output location configure the task individually:

tasks.detektMain {
    reports {
        xml {
            outputLocation.set(file("build/reports/detekt/customPath.xml"))
            required.set(true) // reports can also be enabled and disabled at the task level as needed
        }
    }
}
Changelog
  • ForbiddenMethodCall: report overriding method calls - #4205
  • ObjectLiteralToLambda: fix false positive when using Java interfaces with default methods - #4203
  • Unit tests for TooGenericExceptionThrown - #4198
  • Display correct --jvm-target values when using --help flag - #4195
  • Improved MaximumLineLength documentation - #4188
  • Report NewLineAtEndOfFile source location at end of file - #4187
  • #4169 OutdatedDocumentation rule - #4185
  • Don't report on platform types in NullableToStringCall - #4180
  • Fix #4140: Allow Bazel based tests to run with string test input - #4170
  • Improve ForbiddenMethodCall documentation - #4166
  • Report SwallowedException on catchParameter - #4158
  • Enable binary compatibility validator for detekt-test and detekt-test-api - #4157
  • Fix issues with Elvis operator in UnconditionalJumpStatementInLoop - #4150
  • Improve documentation for naming rules - #4146
  • Disable UnsafeCallOnNullableType on tests - #4123
  • Remove annotations from LateinitUsage noncompliant block - #4100
  • UnnecessaryAbstractClass: false positive when the abstract class has internal/protected abstract members - #4099
  • Deprecate DefaultContext - #4098
  • Fix confusing message when breaking the MultilineLambdaItParameter rule - #4089
  • Remove deprecated KotlinExtension - #4063
  • Add an alias for FunctionMinLength/FunctionMaxLength rules to be more descriptive - #4050
  • fix report path, default path is reports/detekt/... - #4034
  • Fix TextLocation of Indentation rule - #4030
  • detekt-bom is going away after 1.18.0 - #3988
  • UnderscoresInNumericLiterals acceptableDecimalLength is off by one - #3972
  • Create rule set configurations in a safe way - #3964
  • Remove UnnecessarySafeCall safeguard against ErrorType - #3439
Dependency Updates
Housekeeping & Refactorings
  • Simplify where casts used unnecessarily - #4213
  • Don't specify Gradle Enterprise Gradle Plugin version - #4210
  • Fix baserule import in tests - #4189
  • Run CLI sanity checks with Gradle - #4186
  • Use Codecov GitHub Action to upload coverage - #4184
  • Enable ParameterListWrapping rule on detekt codebase - #4178
  • Add test cases for MagicNumber - #4152
  • Fix FunctionParameterNamingSpec - #4145
  • Address feedback on #4139 - #4143
  • Don't skip tests that now pass - #4142
  • Fixes for Kotlin 1.6.0-M1 - #4139
  • Don't unnecessarily propogate opt-in requirement - #4116
  • Drop junit-platform-launcher dependency - #4115
  • Ensure detekt-tooling public API is stable - #4112
  • Fix globing typo - #4107
  • Rename and split ValidateConfig files - #4105
  • Dynamic deprecation - #4104
  • Fix indent issues with continuation indent - #4103
  • Refactor so detekt-gradle-plugin can be added as an included build - #4094
  • Migrate buildSrc to composite build - #4090
  • Fix broken applySelfAnalysisVersion task - #4082
  • Convert DetektJvmSpec to use ProjectBuilder - #4075
  • Upscale JVM settings - #4057
  • Gradle 7.2 - #4056
  • Verify at compile time that issue id matches rule name - #4047

See all issues at: 1.19.0

Don't miss a new detekt release

NewReleases is sending notifications on new releases.