Skip to content

Releases: detekt/detekt

v1.19.0

30 Nov 22:25
a42a63d
Compare
Choose a tag to compare

Please welcome the next upcoming stable release of Detekt: 1.19.0 🎉
This release is coming with a lot of new features, new rules, evolution in the API and stability improvements.

Specifically, we've shipped some features that will allow you to better adapt detekt to run on codebases
that are using JetPack compose with features such as ignoreAnnotated and ignoreFunction.

As always, we want to take the opportunity to thank our contributors for testing, bug reporting and helping
us release this new version of Detekt. You're more than welcome to join our community on the #detekt channel on KotlinLang's Slack (you can get an invite here).

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 and #4241
  • Similarly, we now offer also an ignoreFunction configuration key that you can use to suppress findings if inside a function with a given name - #4148
  • 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 offers a customMessage configuration key - #4126
  • We bumped ktlint and updated the default enabled rules to mirror what ktlint is doing - #4179
  • Added a new LambdaParameterNaming rule, to enforce a naming convention of parameter inside lambdas - #4147
  • Added a new InjectDispatcher rule, to check if dispatchers are injectable - #4222
  • Added a new ConsoleReport format - #4027
  • Gradle: We added the --auto-correct cmdline option to gradle tasks - #4202
  • Gradle: We removed the afterEvaluate wrapper from the Android and KMM plugin - #4159 and #4271
  • 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

  • trim values when parsing the baseline - #4335
  • Fix #4332 by widening the scope to all JDKs - #4333
  • Bugfix provided by #4225 needs wider scope - #4332
  • Avoid false positives in MemberNameEqualsClassName - #4329
  • Add two new config steps for Compose - #4322
  • Set DetektJvm task source with SourceDirectorySet instead of file list - #4151
  • Add documentation about how to configure Baseline task with type resolution - #4285
  • Remove kotlin-gradle-plugin-api from runtime classpath - #4275
  • Use appropriate annotations on source properties in Gradle tasks - #4264
  • Replace usage of deprecated ConfigureUtil - #4263
  • Fix test failure of ReportMergeSpec - #4262
  • Revert "Remove afterEvaluate wrapper (#4159)" - #4259
  • ExplicitCollectionElementAccessMethodSpec: does not report methods that is called on implicit receiver - #4256
  • UnusedPrivateMember: fix false positive with operator in - #4249
  • Introduce UseAnyOrNoneInsteadOfFind rule - #4247
  • OptionalWhenBraces: fix false negative for nested when - #4246
  • Handle MultiRules in Suppressors - #4239
  • Fix UselessCallOnNotNull rule - #4237
  • Make detekt a bit less noisy when mixing java and kotlin files - #4231
  • Workaround for JDK 8 instability when reading config - #4225
  • Define FunctionSignature - #4176
  • 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

  • Update dependency org...
Read more

v1.19.0-RC2

18 Nov 18:00
d761725
Compare
Choose a tag to compare

v1.19.0-RC1 - 2021-11-18

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 and #4241
  • 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 offers a customMessage configuration key - #4126
  • We bumped ktlint and updated the default enabled rules to mirror what ktlint is doing - #4179
  • Added a new LambdaParameterNaming rule, to enfornce a naming convention of paramter inside lambdas - #4147
  • Added a new InjectDispatcher rule, to check if dispatchers are injectable - #4222
  • Added a new ConsoleReport format - #4027
  • Gradle: We added the --auto-correct cmdline option to gradle tasks - #4202
  • Gradle: We removed the afterEvaluate wrapper from the Android and KMM plugin - #4159 and #4271
  • 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
  • Add documentation about how to configure Baseline task with type resolution - #4285
  • Remove kotlin-gradle-plugin-api from runtime classpath - #4275
  • Use appropriate annotations on source properties in Gradle tasks - #4264
  • Replace usage of deprecated ConfigureUtil - #4263
  • Fix test failure of ReportMergeSpec - #4262
  • Revert "Remove afterEvaluate wrapper (#4159)" - #4259
  • ExplicitCollectionElementAccessMethodSpec: does not report methods that is called on implicit receiver - #4256
  • UnusedPrivateMember: fix false positive with operator in - #4249
  • Introduce UseAnyOrNoneInsteadOfFind rule - #4247
  • OptionalWhenBraces: fix false negative for nested when - #4246
  • Handle MultiRules in Suppressors - #4239
  • Fix UselessCallOnNotNull rule - #4237
  • Make detekt a bit less noisy when mixing java and kotlin files - #4231
  • Workaround for JDK 8 instability when reading config - #4225
  • Define FunctionSignature - #4176
  • 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
  • Gradle Publishing Plugin 0.17.0 - #4270
  • Shadow 7.1.0 - #4269
  • Dokka 1.5.31 - #4268
  • Binary Compatibility Validator 0.8.0 - #4267
  • Reflections 0.10.2 - #4266
  • Upgrade to Gradle 7.3 - #4254
  • Dokka 1.5.30 - #4114
  • Kotlin 1.5.31 - #4113
  • Update dependencies - #4065
Housekeeping & Refactorings
  • Minor typo fix and code refactoring - #4284
  • Improve Tests of UnnecesaryLet - #4282
  • Fix typo in UnnecessaryLet - #4281
  • Fix typo in Gradle lib definition - #4255
  • Rename DoubleMutabilityInCollectionSpec to DoubleMutabilityForCollectionSpec - #4251
  • Simplify conditional checks to improve coverage - #4221
  • Refactor NoTabs to remove DetektVisitor - #4220
  • Fix typos and grammar in rule descriptions - #4219
  • Use Kotlin's ArrayDeque implementation - [#4218](https://githu...
Read more

v1.19.0-RC1

01 Nov 19:31
891bf5d
Compare
Choose a tag to compare

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

v1.18.1

30 Aug 17:25
85c9a62
Compare
Choose a tag to compare
  • 2021-08-30

This is a point release for Detekt 1.18.0 containing bugfixes for problems that got discovered just after the release.

Notable Changes

  • MultiRule should pass correctly the BindingContext - #4071
  • Allow active, excludes and includes in the rule-set configuration - #4045
  • Remove Error from ThrowingExceptionsWithoutMessageOrCause because is a common name - #4046
  • Fix issue IDs for ReferentialEquality and DoubleMutability - #4040

See all issues at: 1.18.1

v1.18.0

12 Aug 16:37
9d4ae9d
Compare
Choose a tag to compare

1.18.0 - 2021-08-12

We're more than excited to introduce you a next stable release of Detekt: 1.18.0 🎉
This release is coming with a lot of changes, new rules, evolution in the API and stability improvements.

We want to take the opportunity to thank our contributors for testing, bug reporting and helping
us release this new version of Detekt.

Notable Changes

  • We've added two new rules: AvoidReferentialEquality and BooleanPropertyNaming (see #3924 and #3795)
  • This version of Detekt ships with Kotlin 1.5.21, and we're compiling with apiVersion set to 1.4 - #3956 and #3852
  • The minimum version of Gradle to use Detekt Gradle Plugin is now 6.1 - #3830
  • This version of Detekt has been tested against Java 16 - #3698
  • We fixed a long-standing bug related to parallel execution (#3248) - #3799 and #3822
  • We now use multi-line format for list options in the default detekt config file - #3827
  • The rule VarCouldBeVal has been updated and now works only with type resolution to provide more precise findings - #3880
  • We removed all the references to Extensions.getRootArea that is now deprecated from our codebase. This was affecting users with sporadic crashes. - #3848
  • For detekt rule authors: We created a Github Template that you can use to bootstrap your custom rule project: detekt-custom-rule-template. You can use JitPack to host it and share your rule easily with other members of the community.
  • For detekt rule authors: We finished the rework to use the annotations instead of kdoc tags in rules. Specifically configurations must be configured using @Configuration while auto-correction capability should be specified with the @AutoCorrectable annotation #3820.

Migration

  • We renamed the input property inside the detekt{} extension of the Gradle plugin to source. The input property has been deprecated, and we invite you to migrate to the new property (see #3951)
// BEFORE
detekt {
    input = files(...)
}

// AFTER
detekt {
    source = files(...)
}
  • For all rule authors: When accessing a config value within a rule, using valueOrDefault and valueOrDefaultCommaSeparated is no longer recommended. While both will remain part of the public api, they should be replaced by one of the config delegates (see #3891). The key that is used to lookup the configured value is derived from the property name.
/* simple property */
// BEFORE
val ignoreDataClasses = valueOrDefault("ignoreDataClasses", true)
// AFTER
val ignoreDataClasses: Boolean by config(true)

/* transformed simple property */
// BEFORE
val ignoredName = valueOrDefault("ignoredName", "").trim()
// AFTER
val ignoredName: String by config("", String::trim)

/* transformed list property */
// BEFORE
val ignoreAnnotated = valueOrDefaultCommaSeparated("ignoreAnnotated", listOf("Inject", "Value"))
        .map(String::trim)
// AFTER
val ignoreAnnotated: List<String> by config(listOf("Inject", "Value")) { list -> 
    list.map(String::trim) 
}
  • For all rule authors: The types ThresholdRule and LazyRegex have been marked as deprecated and will be removed in a future release. Please migrate to config delegates.
/* ThresholdRule */
// BEFORE
class MyRule(config: Config, threshold: Int = 10) : ThresholdRule(config, threshold) {
    // ...
}
// AFTER
class MyRule(config: Config) : Rule(config) {
    private val threshold: Int by config(10)
    // ...
}

/* LazyRegex */
// BEFORE
private val allowedPattern: Regex by LazyRegex("allowedPatterns", "")
// AFTER
private val allowedPattern: Regex by config("", String::toRegex)
  • For custom rule authors: This will be the last version of detekt where we publish the detekt-bom artifact. This change should not affect anyone. If it affects you, please let us know.

Changelog

  • [KMP] Fix resolution of Android test classpaths - #4026
  • Sort config lists - #4014
  • Multiplatform tasks should not depend on check - #4025
  • mark configWithFallback as unstable - #4028
  • UseDataClass: fix false positive on value classes - #4016
  • ImplicitUnitReturnType: don't report when expression body is 'Unit' - #4011
  • Fix false positive with UnusedPrivateMember on parameter of a protected function - #4007
  • ClassNaming: Don't treat Kotlin syntax ` as part of class name - #3977
  • IgnoredReturnValue: fix false negative when annotation is on the class - #3979
  • NoNameShadowing: fix false positive with nested lambda has implicit parameter - #3991
  • UnusedPrivateMember - added handling of overloaded array get operator - #3666
  • Publish bundled/Shadow JAR artifact to Maven repos - #3986
  • EmptyDefaultConstructor false positive with expect and actual classes - #3970
  • FunctionNaming - Allow factory function names - fix #1639 - #3973
  • EndOfSentenceFormat - Fix #3893 by only calling super.visit once - #3904
  • UndocumentedPublicFunction: don't report when nested class is inside not public class #3962
  • Fail with a meaningful error message for invalid boolean - #3931
  • UndocumentedPublicProperty and UndocumentedPublicFunction should include objects - #3940
  • Fix exclusion pattern for InvalidPackageDeclaration - #3907
  • Allow else when {...} in MandatoryBracesIfStatements rule - #3905
  • Remove unnecessary constant declaration - #3903
  • Check bindingContext only once in MemberNameEqualsClassName - #3899
  • LongMethod: add 'ignoreAnnotated' configuration option - #3892
  • Fix Deprecation rule message - #3885
  • Improve LongParameterList rule by supporting ignoring annotated parameters - #3879
  • OptionalUnit: fix false positive when function initializer is Nothing type - #3876
  • UnnecessaryParentheses: fix false positive for delegated expressions - #3858
  • Fix UnnecessaryLet false positive in inner lambdas - #3841
  • Fix false positive for UnusedPrivateMember - Backtick identifiers - #3828
  • Properly apply test excludes for comments - #3815
  • Fix generation issues around (deprecated) list properties - #3813
  • Update the implementation of ClassOrdering to handle false negatives - #3810
  • [comments] Do not exclude tests globally - #3801
  • UnnecessaryLet: report when implicit parameter isn't used - #3794
  • NoNameShadowing: don't report when implicit 'it' parameter isn't used - #3793
  • Fix ModifierOrder to support value class - #3719
  • Remove inline value class to stay compatible with Kotlin 1.4 API - #3871
  • [FunctionNaming] Revert annotations that are ignored by default - #3948
  • Android: add javac intermediates to classpath - [#3867]((#3867)
  • Revert "Android: add javac intermediates to classpath (#3867)" - [#3958]((#3958)
  • Use annotations to configure rules in detekt-rules-exceptions - #3798
  • Use @configuration in detekt-rules-style - #3774
  • Use annotations to configure rules in custom-checks - #3773
  • Use @configuration for rules-errorprone - #3772
  • Use annotation to configure rules in rules-empty - #3771
  • Use annotation to configure rules in rules-documentation - #3770
  • Use annotations to configure rules in rules-naming - [#3769](http...
Read more

v1.18.0-RC3

05 Aug 23:26
3710da1
Compare
Choose a tag to compare

1.18.0-RC3 - 2021-08-05

Notable Changes

  • We've added two new rules: AvoidReferentialEquality and BooleanPropertyNaming (see #3924 and #3795)
  • This version of Detekt ships with Kotlin 1.5.21, and we're compiling with apiVersion set to 1.4 - #3956 and #3852
  • The minimum version of Gradle to use Detekt Gradle Plugin is now 6.1 - #3830
  • This version of Detekt has been tested against Java 16 - #3698
  • We fixed a long-standing bug related to parallel execution (#3248) - #3799 and #3822
  • We now use multi-line format for list options in the default detekt config file - #3827
  • The rule VarCouldBeVal has been updated and now works only with type resolution to provide more precise findings - #3880
  • We removed all the references to Extensions.getRootArea that is now deprecated from our codebase. This was affecting users with sporadic crashes. - #3848

Migration

  • We renamed the input property inside the detekt{} extension of the Gradle plugin to source. The input property has been deprecated, and we invite you to migrate to the new property (see #3951)
// BEFORE
detekt {
    input = files(...)
}

// AFTER
detekt {
    source = files(...)
}
  • For custom rule authors: we finished the rework to use the annotations in custom rules. Specifically configurations should be configured with @Configuration and a config delegate (see #3891) while auto-correction capability should be specified with the @AutoCorrectable annotation #3820.

  • For custom rule authors: This will be the last version of detekt where we publish the detekt-bom artifact. This change should not affect anyone. If it affects you, please let us know.

Changelog

  • ClassNaming: Don't treat Kotlin syntax ` as part of class name - #3977
  • IgnoredReturnValue: fix false negative when annotation is on the class - #3979
  • NoNameShadowing: fix false positive with nested lambda has implicit parameter - #3991
  • UnusedPrivateMember - added handling of overloaded array get operator - #3666
  • Publish bundled/Shadow JAR artifact to Maven repos - #3986
  • EmptyDefaultConstructor false positive with expect and actual classes - #3970
  • FunctionNaming - Allow factory function names - fix #1639 - #3973
  • EndOfSentenceFormat - Fix #3893 by only calling super.visit once - #3904
  • UndocumentedPublicFunction: don't report when nested class is inside not public class #3962
  • Fail with a meaningful error message for invalid boolean - #3931
  • UndocumentedPublicProperty and UndocumentedPublicFunction should include objects - #3940
  • Fix exclusion pattern for InvalidPackageDeclaration - #3907
  • Allow else when {...} in MandatoryBracesIfStatements rule - #3905
  • Remove unnecessary constant declaration - #3903
  • Check bindingContext only once in MemberNameEqualsClassName - #3899
  • LongMethod: add 'ignoreAnnotated' configuration option - #3892
  • Fix Deprecation rule message - #3885
  • Improve LongParameterList rule by supporting ignoring annotated parameters - #3879
  • OptionalUnit: fix false positive when function initializer is Nothing type - #3876
  • UnnecessaryParentheses: fix false positive for delegated expressions - #3858
  • Fix UnnecessaryLet false positive in inner lambdas - #3841
  • Fix false positive for UnusedPrivateMember - Backtick identifiers - #3828
  • Properly apply test excludes for comments - #3815
  • Fix generation issues around (deprecated) list properties - #3813
  • Update the implementation of ClassOrdering to handle false negatives - #3810
  • [comments] Do not exclude tests globally - #3801
  • UnnecessaryLet: report when implicit parameter isn't used - #3794
  • NoNameShadowing: don't report when implicit 'it' parameter isn't used - #3793
  • Fix ModifierOrder to support value class - #3719
  • Remove inline value class to stay compatible with Kotlin 1.4 API - #3871
  • [FunctionNaming] Revert annotations that are ignored by default - #3948
  • Android: add javac intermediates to classpath - [#3867]((#3867)
  • Revert "Android: add javac intermediates to classpath (#3867)" - [#3958]((#3958)
  • Use annotations to configure rules in detekt-rules-exceptions - #3798
  • Use @configuration in detekt-rules-style - #3774
  • Use annotations to configure rules in custom-checks - #3773
  • Use @configuration for rules-errorprone - #3772
  • Use annotation to configure rules in rules-empty - #3771
  • Use annotation to configure rules in rules-documentation - #3770
  • Use annotations to configure rules in rules-naming - #3769
  • Use annotations to configure rules in rules-complexity - #3768
  • Move formatting rules to @configuration - #3847

Dependency Updates

  • Bump Kotlin to 1.5.21 - #3956
  • Revert "Bump Kotlin to v1.5.20" - #3941
  • Bump Kotlin to v1.5.20 - #3921
  • Kotlin 1.5.10 - #3826
  • Update assertj to v3.20.2 - #3912
  • Update snakeyaml to v1.29 - #3911
  • Bump byte-buddy from 1.11.2 to 1.11.5 - #3886
  • Bump byte-buddy from 1.11.1 to 1.11.2 - #3872
  • Bump byte-buddy from 1.11.0 to 1.11.1 - #3861
  • Update mockk to 1.12.0 - #3937

Housekeeping & Refactorings

  • Enable UseEmptyCounterpart for detekt code base - #4000
  • enable coroutine rules for detekt code base - #3994
  • Remove "plugin" suffix from version catalog aliases - #3987
  • Fix ClassCastException in test on java 11 openjdk9 - #3984
  • Activate IgnoredReturnValue on detekt code base - #3974
  • Add missing test in FunctionNaming - #3976
  • Fix trunk compilation - #3968
  • Reformat internal detekt.yml using multi line lists - #3936
  • Increase memory available to gradle integration test daemon - #3938
  • Avoid empty lines when running detekt with type resolution - #3909
  • Fix java.lang.ClassCastException is reading default yaml config - #3920
  • Refactor + rename util function inside MandatoryBracesIfStatement rule - #3908
  • Rename Tests to Spec - #3906
  • verify that no rule is configured with kdoc tags - #3870
  • Setup FOSSA - #3836
  • jvmTarget can't be null - #3818
  • Add test for ruleset provider configuration - #3814
  • Merge JaCoCo coverage reports the "right" way - [#3650](https://github.com/detekt/detek...
Read more

v1.18.0-RC2

16 Jul 23:19
1026a01
Compare
Choose a tag to compare

2021-07-16

Notable Changes

  • This version of Detekt ships with Kotlin 1.5.21, and we're compiling with apiVersion set to 1.4 - #3956 and #3852
  • The minimum version of Gradle to use Detekt Gradle Plugin is now 6.1 - #3830
  • This version of Detekt has been tested against Java 16 - #3698
  • We fixed a long-standing bug related to parallel execution (#3248) - #3799 and #3822
  • We now use multi-line format for list options in the default detekt config file - #3827
  • The rule VarCouldBeVal has been updated and now works only with type resolution to provide more precise findings - #3880
  • We removed all the references to Extensions.getRootArea that is now deprecated from our codebase. This was affecting users with sporadic crashes. - #3848
  • We continued the work to introduce annotations to declare rules metadata. Specifically the @Autocorrect annotation has been added - #3820

Changelog

  • UndocumentedPublicProperty and UndocumentedPublicFunction should include objects - #3940
  • Fix exclusion pattern for InvalidPackageDeclaration - #3907
  • Allow else when {...} in MandatoryBracesIfStatements rule - #3905
  • Remove unnecessary constant declaration - #3903
  • Check bindingContext only once in MemberNameEqualsClassName - #3899
  • LongMethod: add 'ignoreAnnotated' configuration option - #3892
  • Fix Deprecation rule message - #3885
  • Improve LongParameterList rule by supporting ignoring annotated parameters - #3879
  • OptionalUnit: fix false positive when function initializer is Nothing type - #3876
  • UnnecessaryParentheses: fix false positive for delegated expressions - #3858
  • Fix UnnecessaryLet false positive in inner lambdas - #3841
  • Fix false positive for UnusedPrivateMember - Backtick identifiers - #3828
  • Properly apply test excludes for comments - #3815
  • Fix generation issues around (deprecated) list properties - #3813
  • Update the implementation of ClassOrdering to handle false negatives - #3810
  • [comments] Do not exclude tests globally - #3801
  • UnnecessaryLet: report when implicit parameter isn't used - #3794
  • NoNameShadowing: don't report when implicit 'it' parameter isn't used - #3793
  • Fix ModifierOrder to support value class - #3719
  • Remove inline value class to stay compatible with Kotlin 1.4 API - #3871
  • [FunctionNaming] Revert annotations that are ignored by default - #3948
  • Android: add javac intermediates to classpath - [#3867]((#3867)
  • Revert "Android: add javac intermediates to classpath (#3867)" - [#3958]((#3958)
  • Use annotations to configure rules in detekt-rules-exceptions - #3798
  • Use @configuration in detekt-rules-style - #3774
  • Use annotations to configure rules in custom-checks - #3773
  • Use @configuration for rules-errorprone - #3772
  • Use annotation to configure rules in rules-empty - #3771
  • Use annotation to configure rules in rules-documentation - #3770
  • Use annotations to configure rules in rules-naming - #3769
  • Use annotations to configure rules in rules-complexity - #3768
  • Move formatting rules to @configuration - #3847

Dependency Updates

  • Bump Kotlin to 1.5.21 - #3956
  • Revert "Bump Kotlin to v1.5.20" - #3941
  • Bump Kotlin to v1.5.20 - #3921
  • Kotlin 1.5.10 - #3826
  • Update assertj to v3.20.2 - #3912
  • Update snakeyaml to v1.29 - #3911
  • Bump byte-buddy from 1.11.2 to 1.11.5 - #3886
  • Bump byte-buddy from 1.11.1 to 1.11.2 - #3872
  • Bump byte-buddy from 1.11.0 to 1.11.1 - #3861
  • Update mockk to 1.12.0 - #3937

Housekeeping & Refactorings

  • Increase memory available to gradle integration test daemon - #3938
  • Avoid empty lines when running detekt with type resolution - #3909
  • Fix java.lang.ClassCastException is reading default yaml config - #3920
  • Refactor + rename util function inside MandatoryBracesIfStatement rule - #3908
  • Rename Tests to Spec - #3906
  • verify that no rule is configured with kdoc tags - #3870
  • Setup FOSSA - #3836
  • jvmTarget can't be null - #3818
  • Add test for ruleset provider configuration - #3814
  • Merge JaCoCo coverage reports the "right" way - #3650
  • Update outdated Gradle plugin documentation regarding source files - #3883
  • Make documentation more precise about how rules are enabled - #3889
  • Rename MapGetWithNotNullAsserSpec to follow test convention - #3878
  • Remove custom assertions that check kdoc of rules - #3859
  • Avoid overlapping outputs - #3790
  • Revert "Avoid overlapping outputs" - #3943

See all issues at: 1.18.0

v1.18.0-RC1

08 Jul 09:21
2a9bbd0
Compare
Choose a tag to compare

1.18.0-RC1 - 2021-07-08

Notable Changes

  • This version of Detekt ships with Kotlin 1.5.x, and we're compiling with apiVersion set to 1.4 - #3718 and #3852
  • The minimum version of Gradle to use Detekt Gradle Plugin is now 6.1 - #3830
  • This version of Detekt has been tested against Java 16 - #3698
  • We fixed a long-standing bug related to parallel execution (#3248) - #3799 and #3822
  • We now use multi-line format for list options in the default detekt config file - #3827
  • The rule VarCouldBeVal has been updated and now works only with type resolution to provide more precise findings - #3880
  • We removed all the references to Extensions.getRootArea that is now deprecated from our codebase. This was affecting users with sporadic crashes. - #3848
  • For Android projects using Detekt Gradle plugins, we now add javac intermediates to classpath. This will allow running more precise type resolutions inspections - #3867
  • We continued the work to introduce annotations to declare rules metadata. Specifically the @Autocorrect annotation has been added - #3820

Changelog

  • UndocumentedPublicProperty and UndocumentedPublicFunction should include objects - #3940
  • Fix exclusion pattern for InvalidPackageDeclaration - #3907
  • Allow else when {...} in MandatoryBracesIfStatements rule - #3905
  • Remove unnecessary constant declaration - #3903
  • Check bindingContext only once in MemberNameEqualsClassName - #3899
  • LongMethod: add 'ignoreAnnotated' configuration option - #3892
  • Fix Deprecation rule message - #3885
  • Improve LongParameterList rule by supporting ignoring annotated parameters - #3879
  • OptionalUnit: fix false positive when function initializer is Nothing type - #3876
  • UnnecessaryParentheses: fix false positive for delegated expressions - #3858
  • Fix UnnecessaryLet false positive in inner lambdas - #3841
  • Fix false positive for UnusedPrivateMember - Backtick identifiers - #3828
  • Properly apply test excludes for comments - #3815
  • Fix generation issues around (deprecated) list properties - #3813
  • Update the implementation of ClassOrdering to handle false negatives - #3810
  • [comments] Do not exclude tests globally - #3801
  • UnnecessaryLet: report when implicit parameter isn't used - #3794
  • NoNameShadowing: don't report when implicit 'it' parameter isn't used - #3793
  • Fix ModifierOrder to support value class - #3719
  • Remove inline value class to stay compatible with Kotlin 1.4 API - #3871
  • Use annotations to configure rules in detekt-rules-exceptions - #3798
  • Use @configuration in detekt-rules-style - #3774
  • Use annotations to configure rules in custom-checks - #3773
  • Use @configuration for rules-errorprone - #3772
  • Use annotation to configure rules in rules-empty - #3771
  • Use annotation to configure rules in rules-documentation - #3770
  • Use annotations to configure rules in rules-naming - #3769
  • Use annotations to configure rules in rules-complexity - #3768
  • Move formatting rules to @configuration - #3847

Dependency Updates

  • Revert "Bump Kotlin to v1.5.20" - #3941
  • Bump Kotlin to v1.5.20 - #3921
  • Kotlin 1.5.10 - #3826
  • Update assertj to v3.20.2 - #3912
  • Update snakeyaml to v1.29 - #3911
  • Bump byte-buddy from 1.11.2 to 1.11.5 - #3886
  • Bump byte-buddy from 1.11.1 to 1.11.2 - #3872
  • Bump byte-buddy from 1.11.0 to 1.11.1 - #3861

Housekeeping & Refactorings

  • Increase memory available to gradle integration test daemon - #3938
  • Avoid empty lines when running detekt with type resolution - #3909
  • Fix java.lang.ClassCastException is reading default yaml config - #3920
  • Refactor + rename util function inside MandatoryBracesIfStatement rule - #3908
  • Rename Tests to Spec - #3906
  • verify that no rule is configured with kdoc tags - #3870
  • Setup FOSSA - #3836
  • jvmTarget can't be null - #3818
  • Add test for ruleset provider configuration - #3814
  • Merge JaCoCo coverage reports the "right" way - #3650
  • Update outdated Gradle plugin documentation regarding source files - #3883
  • Make documentation more precise about how rules are enabled - #3889
  • Rename MapGetWithNotNullAsserSpec to follow test convention - #3878
  • Remove custom assertions that check kdoc of rules - #3859

See all issues at: 1.18.0

v1.17.1

21 May 17:19
40c3330
Compare
Choose a tag to compare
  • 2021-05-19
Notable Changes

This is a patch release for Detekt 1.17.0 including fixes that we considered worth a point release.

Specifically, we're reverting a change on our Gradle Plugin. The original change #3655 resulted in several false positives when using rules with Type Resolution on Java/Kotlin mixed codebases.

Moreover we included a couple of false positive fixes for NoNameShadowing and UnnecessaryLet

Changelog
  • Revert "Noisy gradle (#3655)" - #3792
  • NoNameShadowing: don't report when implicit 'it' parameter isn't used - #3793
  • UnnecessaryLet: report when implicit parameter isn't used - #3794

v1.17.0

15 May 09:47
1c1dd07
Compare
Choose a tag to compare
  • 2021-05-15

Notable Changes

  • We're introducing our new Project logo :). See #3726
  • This release allows you to replace your jcenter() dependencies with mavenCentral() given that our dependency on kotlinx.html migrated to Maven Central - See #3455
  • We now introduced the src/test/java and src/test/kotlin by default for the plain detekt Gradle task. If you use that task, you might notice rule reports in your test sourceset. See #3649
  • We now default the baseline file to detekt-baseline.xml so you don't have to specify it manually. You can revert the previous behavior by setting the baseline to null - See #3619 and #3745
  • We enabled the SARIF output format by default - See #3543
  • We're introducing annotations to provide metadata to rules, such as @ActiveByDefault, @Configuration and @RequiresTypeResolution - See #3637 #3592 and #3579

Changelog

  • Fix crash for DontDowncastCollectionTypes on Synthetic types - #3776
  • We don't need to talk about jcenter anymore at our docs - #3755
  • Skip publishing for detekt-cli shadowRuntimeElements variant - #3747
  • Set the org.gradle.dependency.bundling attribute to external - #3738
  • Support triple quoted strings in default value of config delegate - #3733
  • Properly populate versions.properties - #3730
  • We have a logo :) - #3726
  • [UndocumentedPublicProperty] Allow inline comments for properties in primary constructor as documentation - #3722
  • MultilineLambdaItParameter: don't report when lambda has no implicit parameter references - #3696
  • Fix false positives for UnnecessaryFilter - #3695
  • Add support for transformer function in config property delegate - #3676
  • Add support for fallback property - #3675
  • Ignore actual members in UnusedPrivateMember - #3669
  • NamedArguments rule: fix false positive with trailing lambda - #3661
  • Add DeprecatedBlockTag rule - #3660
  • Noisy gradle - #3655
  • Drop support to Gradle 5 - #3647
  • Add MayBeConstant as alias for MayBeConst - #3644
  • [ThrowingExceptionInMain] [ExitOutsideMainfix] fix for KtNamedFunction.isMainFunction() - #3641
  • Fixing IllegalArgumentException in ForbiddenMethodCall rule for Intersection type parameters - #3626
  • Replace getJetTypeFqName with fqNameOrNull extension - #3613
  • New Rule: ObjectLiteralToLambda - #3599
  • [MemberNameEqualsClassName] Support factory exemption for generic classes - #3595
  • Refactor Analyzer so that RuleSetProvider.instance is only called once - #3585
  • SarifOutputReportSpec: Correctly detect Windows root directory on local development machine - #3584
  • Replace @SInCE KDoc tag with @SinceDetekt - #3582
  • Simplify code in RedundantSuspendModifier rule - #3580
  • Revert "Refactor Analyzer so that RuleSetProvider.instance is only called once" - #3578
  • fix error message -> buildUponDefaultConfig instead of buildOnDefaultConfig - #3572
  • UnnecessaryApply: fix false positive when lambda has multiple member references - #3564
  • Switch SARIF report off jackson - #3557
  • Fix rules not appearing in the sarif output - #3556
  • Refactor Analyzer so that RuleSetProvider.instance is only called once - #3555
  • New Rule: DoubleMutabilityForCollection - #3553
  • Adds a ForbiddenSingleExpressionSyntax rule - #3550

Dependency Updates

  • Update to Gradle 7.0.1 - #3760
  • Update Shadow plugin to 7.0.0 - #3759
  • Upgrade to AGP 4.2.0 - #3744
  • JaCoCo 0.8.7 - #3739
  • Upgrade to GitHub-native Dependabot - #3716
  • Upgrade to Gradle 7 - #3689
  • Bump com.gradle.plugin-publish from 0.13.0 to 0.14.0 - #3654
  • Bump kotlin-reflect from 1.4.0 to 1.4.32 - #3627
  • Upgrade to ktlint 0.41.0 - #3624
  • Update to Kotlin 1.4.32 - #3606
  • Bump AGP from 4.1.2 to 4.1.3 - #3589
  • Bump mockk from 1.10.6 to 1.11.0 - #3588

Housekeeping & Refactorings

  • Fix document - #3765
  • Fix kdoc link on blog navigation - #3761
  • Upload any heap dumps produced during CI build - #3758
  • Always run warningsAsErrors on CI - #3754
  • Clean ci - #3753
  • Revert "Set the org.gradle.dependency.bundling attribute to external" - #3750
  • Enable Gradle's type-safe project accessors - #3742
  • Enable Gradle's version catalogs - #3741
  • Ignore gradle plugin in codecov - #3740
  • Update config file due to invalid argument - #3735
  • Skip Multiplatform iOS tests if XCode is not configured - #3734
  • Specify Java language level in module plugin - #3732
  • Don't run unnecesary tasks - #3725
  • Remove --stacktrace now that we have scan - #3724
  • Drop JCenter usage from detekt's own build - #3711
  • Publish build scans for all CI builds - #3710
  • Remove deprecated kotlin-dsl Gradle config option - #3709
  • Update to setup-java@v2 - #3704
  • (Try to) improve CI build reliability - #3703
  • Simplify UpdateVersionInFileTask - #3693
  • Fix compilation issue in :detekt-rules-style:compileTestKotlin - #3691
  • Fix detekt failure in CI - #3674
  • Refactor UnusedPrivateMemberSpec - #3667
  • Warnings as errors - #3646
  • Skip ios tests if no ci - #3635
  • Fix tests - #3634
  • Include detekt-rules on CLI runtime classpath - #3625
  • Improve tests from :detekt-gradle-plugin - #3623
  • Improve generator test coverage - #3622
  • Improve tests - #3618
  • Apply more formatting rules to our code - #3615
  • Add negative test case for requiresTypeResolution - #3614
  • Simplify Gradle config - #3612
  • Decouple Gradle projects - #3611
  • Add --stacktrace to help triage CI flakiness - #3604
  • Fix CI failure for deploy-snapshot - #3598
  • Improve Deprecation and Documentation for allRules - #3596
  • Update files to support main branch in order to remove oppressive language - #3586
  • Format test code for RedundantSuspen...
Read more