Releases: detekt/detekt
v1.22.0
We're extremely excited to announce the next upcoming stable release of Detekt: 1.22.0 🚀
This release is coming with 16 new rules, 2 new rulesets and several new functionalities & APIs.
We've also introduced the Detekt Marketplace, a place for users to share their 3rd party rules and extensions.
We want to take the opportunity to thank our Sponsors and 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're introducing the Detekt Marketplace, a place where you can add your own 3rd party extension such as rule, plugins, custom reporter, etc. - #5191
- Our website is now versioned. You can find the changes for each version using the dropdown menu on the top bar. Documentation for the upcoming version (next) can be found here.
- We added 16 new Rules to Detekt
AlsoCouldBeApply
- #5333MultilineRawStringIndentation
- #5058TrimMultilineRawString
- #5051UnnecessaryNotNullCheck
- #5218UnnecessaryPartOfBinaryExpression
- #5203UseSumOfInsteadOfFlatMapSize
- #5405FunctionReturnTypeSpacing
from KtLint - #5256FunctionSignature
from KtLint - #5256FunctionStartOfBodySpacing
from KtLint - #5256NullableTypeSpacing
from KtLint - #5256ParameterListSpacing
from KtLint - #5256SpacingBetweenFunctionNameAndOpeningParenthesis
from KtLint - #5256TrailingCommaOnCallSite
from KtLint - #5312TrailingCommaOnDeclarationSite
from KtLint - #5312TypeParameterListSpacing
from KtLint - #5256
- We added a new ruleset called
detekt-rules-ruleauthors
containing rules for Rule Authors to enforce best practices on Detekt rules such as the newViolatesTypeResolutionRequirements
- #5129 #5182 - We added a new ruleset called
detekt-rules-libraries
containing rules mostly useful for Library Authors - We moved the following rules insideForbiddenPublicDataClass
,LibraryCodeMustSpecifyReturnType
,LibraryEntitiesShouldNotBePublic
this new ruleset - See Migration below on how to migrate #5360 - We added support for JVM toolchain. This means that Detekt will now respect the JDK toolchain you specify on your Gradle configuration. You will also be able to specify a custom JDK home with the
--jdk-home
CLI parameter - #5269 - Improvement for Type Resolution
- Improvement for Config Management
- Deprecations & Removals
- We deprecated the MultiRule class as it was overly complicated. The suggested approach is to just provide separated rules. - #5161
- The
--fail-fast
CLI flag (andfailFast
Gradle property) has been removed. It was deprecated since 1.16.x - #5290 - We deprecated the following rules
DuplicateCaseInWhenExpression
,MissingWhenCase
,RedundantElseInWhen
as the Kotlin Compiler is already reporting errors for those scenarios - #5309 - We removed the
--print-ast
CLI flag as PsiViewer provides the same features - #5418
- Notable changes to existing rules
ArrayPrimitive
is now working only with Type Resolution - #5175WildcardImport
is now running also on tests by default - #5121ForbiddenImport
allows now to specify a reason for every forbidden import - #4909IgnoredReturnValue
: optionrestrictToAnnotatedMethods
is now deprecated in favor ofrestrictToConfig
- #4922
- This version of Detekt is built with Gradle
v7.5.1
, AGP7.3.1
, Kotlin1.7.21
and KtLint0.47.1
(see #5363 #5189 #5411 #5312 #5519) - The minimum supported Gradle version is now
v6.7.1
- #4964
Migration
We deprecated a number of rules in this release.
You should update your config file as follows:
potential-bugs:
active: true
...
- DuplicateCaseInWhenExpression:
- active: true
...
- MissingWhenCase:
- active: true
- allowElseExpression: true
...
- RedundantElseInWhen:
- active: true
style:
active: true
...
- ForbiddenPublicDataClass:
- active: true
- excludes: ['**']
- ignorePackages:
- - '*.internal'
- - '*.internal.*'
...
- LibraryCodeMustSpecifyReturnType:
- active: true
- excludes: ['**']
...
- LibraryEntitiesShouldNotBePublic:
- active: true
- excludes: ['**']
If you wish to use the libraries
ruleset we introduced you should add the following to your config file:
+ libraries:
+ active: true
+ ForbiddenPublicDataClass:
+ active: false
+ LibraryEntitiesShouldNotBePublic:
+ active: false
+ LibraryCodeMustSpecifyReturnType:
+ active: true
and add the following to you build.gradle
file:
detektPlugins("io.gitlab.arturbosch.detekt:detekt-rules-libraries:$version")
If you're using our KtLint wrapper (i.e. detekt-formatting
) you should also update your config file as follows:
formatting:
active: true
...
- TrailingComma:
- active: false
- autoCorrect: true
- allowTrailingComma: false
- allowTrailingCommaOnCallSite: false
...
+ TrailingCommaOnCallSite:
+ active: false
+ autoCorrect: true
+ useTrailingCommaOnCallSite: false
+ TrailingCommaOnDeclarationSite:
+ active: false
+ autoCorrect: true
+ useTrailingCommaOnDeclarationSite: false
Changelog
- ReturnCount: correctly count assignment expressions with elvis return as guard clauses - #5539
- UnnecessaryPartOfBinaryExpression: fix false positive with pair creation - #5516
- False positive at
UnnecessaryPartOfBinaryExpression
- #5514 - Update documentation for TrailingComma rules - #5513
TrimMultilineRawString
false-positive on annotation parameters - #5476- Detekt 1.22.0-RC1 -> 1.22.0-RC2 breaks UnreachableCode - #5435
- Detekt 1.22.0-RC1 -> 1.22.0-RC2 breaks ignoreAnnotated - #5427
- Fix issues introduced by #5152 - #5508
- MultilineLambdaItParameter: fix false positive for one-line statements with a lambda argument - #5505
- UseArrayLiteralsInAnnotations: fix false negative with primitive array factory calls - #5482
- TrimMultilineRawString: fix false positive when it's expected as constant - #5480
- Fix false negative
SafeCast
with no braces - #5479 - Update gradle/wrapper-validation-action digest to 55e685c - #5472
- Grant permission for type resolution Gradle job - #5470
- Fix ObjectPropertyNaming Rule false positive - #5466
- Fix LambdaParameterNaming rule false positive - #5465
- Fix ReturnCount false positive when excludeReturnFromLambda is enabled - [...
v1.22.0-RC3
1.22.0-RC3 - 2022-11-06
Notable Changes
- We're introducing the Detekt Marketplace, a place where you can add your own 3rd party extension such as rule, plugins, custom reporter, etc. - #5191
- Our website is now versioned. You can find the changes for each version using the dropdown menu on the top bar. Documentation for the upcoming version (next) can be found here.
- We added 16 new Rules to Detekt
AlsoCouldBeApply
- #5333MultilineRawStringIndentation
- #5058TrimMultilineRawString
- #5051UnnecessaryNotNullCheck
- #5218UnnecessaryPartOfBinaryExpression
- #5203UseSumOfInsteadOfFlatMapSize
- #5405FunctionReturnTypeSpacing
from KtLint - #5256FunctionSignature
from KtLint - #5256FunctionStartOfBodySpacing
from KtLint - #5256NullableTypeSpacing
from KtLint - #5256ParameterListSpacing
from KtLint - #5256SpacingBetweenFunctionNameAndOpeningParenthesis
from KtLint - #5256TrailingCommaOnCallSite
from KtLint - #5312TrailingCommaOnDeclarationSite
from KtLint - #5312TypeParameterListSpacing
from KtLint - #5256
- We added a new ruleset called
detekt-rules-ruleauthors
containing rules for Rule Authors to enforce best practices on Detekt rules such as the newViolatesTypeResolutionRequirements
- #5129 #5182 - We added a new ruleset called
detekt-rules-libraries
containing rules mostly useful for Library Authors - We moved the following rules insideForbiddenPublicDataClass
,LibraryCodeMustSpecifyReturnType
,LibraryEntitiesShouldNotBePublic
this new ruleset - See Migration below on how to migrate #5360 - We added support for JVM toolchain. This means that Detekt will now respect the JDK toolchain you specify on your Gradle configuration. You will also be able to specify a custom JDK home with the
--jdk-home
CLI parameter - #5269 - Improvement for Type Resolution
- Improvement for Config Management
- Deprecations & Removals
- We deprecated the MultiRule class as it was overly complicated. The suggested approach is to just provide separated rules. - #5161
- The
--fail-fast
CLI flag (andfailFast
Gradle property) has been removed. It was deprecated since 1.16.x - #5290 - We deprecated the following rules
DuplicateCaseInWhenExpression
,MissingWhenCase
,RedundantElseInWhen
as the Kotlin Compiler is already reporting errors for those scenarios - #5309 - We removed the
--print-ast
CLI flag as PsiViewer provides the same features - #5418
- Notable changes to existing rules
ArrayPrimitive
is now working only with Type Resolution - #5175WildcardImport
is now running also on tests by default - #5121ForbiddenImport
allows now to specify a reason for every forbidden import - #4909IgnoredReturnValue
: optionrestrictToAnnotatedMethods
is now deprecated in favor ofrestrictToConfig
- #4922
- This version of Detekt is built with Gradle
v7.5.1
, AGP7.3.1
, Kotlin1.7.20
and KtLint0.47.1
(see #5363 #5189 #5411 #5312 - The minimum supported Gradle version is now
v6.7.1
- #4964
Migration
We deprecated a number of rules in this release.
You should update your config file as follows:
potential-bugs:
active: true
...
- DuplicateCaseInWhenExpression:
- active: true
...
- MissingWhenCase:
- active: true
- allowElseExpression: true
...
- RedundantElseInWhen:
- active: true
style:
active: true
...
- ForbiddenPublicDataClass:
- active: true
- excludes: ['**']
- ignorePackages:
- - '*.internal'
- - '*.internal.*'
...
- LibraryCodeMustSpecifyReturnType:
- active: true
- excludes: ['**']
...
- LibraryEntitiesShouldNotBePublic:
- active: true
- excludes: ['**']
If you wish to use the libraries
ruleset we introduced you should add the following to your config file:
+ libraries:
+ active: true
+ ForbiddenPublicDataClass:
+ active: false
+ LibraryEntitiesShouldNotBePublic:
+ active: false
+ LibraryCodeMustSpecifyReturnType:
+ active: true
and add the following to you build.gradle
file:
detektPlugins("io.gitlab.arturbosch.detekt:detekt-rules-authors:$version")
If you're using our KtLint wrapper (i.e. detekt-formatting
) you should also update your config file as follows:
formatting:
active: true
...
- TrailingComma:
- active: false
- autoCorrect: true
- allowTrailingComma: false
- allowTrailingCommaOnCallSite: false
...
+ TrailingCommaOnCallSite:
+ active: false
+ autoCorrect: true
+ useTrailingCommaOnCallSite: false
+ TrailingCommaOnDeclarationSite:
+ active: false
+ autoCorrect: true
+ useTrailingCommaOnDeclarationSite: false
Changelog
- Fix issues introduced by #5152 - #5508
- MultilineLambdaItParameter: fix false positive for one-line statements with a lambda argument - #5505
- UseArrayLiteralsInAnnotations: fix false negative with primitive array factory calls - #5482
- TrimMultilineRawString: fix false positive when it's expected as constant - #5480
- Fix false negative
SafeCast
with no braces - #5479 - Update gradle/wrapper-validation-action digest to 55e685c - #5472
- Grant permission for type resolution Gradle job - #5470
- Fix ObjectPropertyNaming Rule false positive - #5466
- Fix LambdaParameterNaming rule false positive - #5465
- Fix ReturnCount false positive when excludeReturnFromLambda is enabled - #5459
- CognitiveComplexity: count else/else-if as one complexity - #5458
- Fix false positive MultilineRawStringIndentation with tab indentation - #5453
- Don't show the number of issues generating the BindingContext - #5449
- Make detekt less noisy - #5448
- New ruleauthors rule for Entity.from(x.nameIdentifier ?: x) -> Entity.atName(x) - #5444
- Separating ComplexMethod rule into CyclomaticComplexMethod and CognitiveComplexMethod - #5442
- Improve error reporting for CascadingCallWrapping - #5439
- TrimMultilineRawString: fix false positive with not a raw string - #5438
- BooleanPropertyNaming highlight only the name of the variable - #5431
- Deprecate
TrailingComma
as it's now split in two rules - #5423 - Remove unused constant - #5421
- Report if/else as issue location instead of block - #5407
- Remove some unnecessary suppressions - #5400
- Check FormattingRule is auto-correctable by information provided by ktlint - #5398
- Fix false negative MultilineLambdaI...
v1.22.0-RC2
Note: This Github Release was accidentally deleted as part of the RC3 release process. We've manually re-created it
1.22.0-RC2 - 2022-10-16
Notable Changes
- We're introducing the Detekt Marketplace, a place where you can add your own 3rd party extension such as rule, plugins, custom reporter, etc. - #5191
- Our website is now versioned. You can find the changes for each version using the dropdown menu on the top bar. Documentation for the upcoming version (next) can be found here.
- We added 16 new Rules to Detekt
AlsoCouldBeApply
- #5333MultilineRawStringIndentation
- #5058TrimMultilineRawString
- #5051UnnecessaryNotNullCheck
- #5218UnnecessaryPartOfBinaryExpression
- #5203UseSumOfInsteadOfFlatMapSize
- #5405FunctionReturnTypeSpacing
from KtLint - #5256FunctionSignature
from KtLint - #5256FunctionStartOfBodySpacing
from KtLint - #5256NullableTypeSpacing
from KtLint - #5256ParameterListSpacing
from KtLint - #5256SpacingBetweenFunctionNameAndOpeningParenthesis
from KtLint - #5256TrailingCommaOnCallSite
from KtLint - #5312TrailingCommaOnDeclarationSite
from KtLint - #5312TypeParameterListSpacing
from KtLint - #5256
- We added a new ruleset called
detekt-rules-ruleauthors
containing rules for Rule Authors to enforce best practices on Detekt rules such as the newViolatesTypeResolutionRequirements
- #5129 #5182 - We added a new ruleset called
detekt-rules-libraries
containing rules mostly useful for Library Authors - We moved the following rules insideForbiddenPublicDataClass
,LibraryCodeMustSpecifyReturnType
,LibraryEntitiesShouldNotBePublic
this new ruleset - See Migration below on how to migrate #5360 - We added support for JVM toolchain. This means that Detekt will now respect the JDK toolchain you specify on your Gradle configuration. You will also be able to specify a custom JDK home with the
--jdk-home
CLI parameter - #5269 - Improvement for Type Resolution
- Improvement for Config Management
- Deprecations & Removals
- We deprecated the MultiRule class as it was overly complicated. The suggested approach is to just provide separated rules. - #5161
- The
--fail-fast
CLI flag (andfailFast
Gradle property) has been removed. It was deprecated since 1.16.x - #5290 - We deprecated the following rules
DuplicateCaseInWhenExpression
,MissingWhenCase
,RedundantElseInWhen
as the Kotlin Compiler is already reporting errors for those scenarios - #5309
- Notable changes to existing rules
ArrayPrimitive
is now working only with Type Resolution - #5175WildcardImport
is now running also on tests by default - #5121ForbiddenImport
allows now to specify a reason for every forbidden import - #4909IgnoredReturnValue
: optionrestrictToAnnotatedMethods
is now deprecated in favor ofrestrictToConfig
- #4922
- This version of Detekt is built with Gradle
v7.5.1
, AGP7.3.1
, Kotlin1.7.20
and KtLint0.47.1
(see #5363 #5189 #5411 #5312 - The minimum supported Gradle version is now
v6.7.1
- #4964
Migration
We deprecated a number of rules in this release.
You should update your config file as follows:
potential-bugs:
active: true
...
- DuplicateCaseInWhenExpression:
- active: true
...
- MissingWhenCase:
- active: true
- allowElseExpression: true
...
- RedundantElseInWhen:
- active: true
style:
active: true
...
- ForbiddenPublicDataClass:
- active: true
- excludes: ['**']
- ignorePackages:
- - '*.internal'
- - '*.internal.*'
...
- LibraryCodeMustSpecifyReturnType:
- active: true
- excludes: ['**']
...
- LibraryEntitiesShouldNotBePublic:
- active: true
- excludes: ['**']
If you wish to use the libraries
ruleset we introduced you should add the following to your config file:
+ libraries:
+ active: true
+ ForbiddenPublicDataClass:
+ active: false
+ LibraryEntitiesShouldNotBePublic:
+ active: false
+ LibraryCodeMustSpecifyReturnType:
+ active: true
and add the following to you build.gradle
file:
detektPlugins("io.gitlab.arturbosch.detekt:detekt-rules-authors:$version")
If you're using our KtLint wrapper (i.e. detekt-formatting
) you should also update your config file as follows:
formatting:
active: true
...
- TrailingComma:
- active: false
- autoCorrect: true
- allowTrailingComma: false
- allowTrailingCommaOnCallSite: false
...
+ TrailingCommaOnCallSite:
+ active: false
+ autoCorrect: true
+ useTrailingCommaOnCallSite: false
+ TrailingCommaOnDeclarationSite:
+ active: false
+ autoCorrect: true
+ useTrailingCommaOnDeclarationSite: false
Changelog
- Remove unused constant - #5421
- Report if/else as issue location instead of block - #5407
- Remove some unnecessary suppressions - #5400
- Check FormattingRule is auto-correctable by information provided by ktlint - #5398
- Fix false negative MultilineLambdaItParameter on complex multiline single statement - #5397
- ObjectPropertyNaming: fix false positive with top level properties - #5390
- Remove usage of MPP targets function for JVM-only projects - #5383
- UnnecessaryNotNullCheck: fix false negative with smart casted arguments - #5380
- Add missing overlapping info & fix rules URLs - #5378
- AlsoCouldBeApply: fix false positive when all statements are not
it
-started expressions - #5376 - UnusedPrivateMember: fix false negative with named arguments - #5374
- Change requires type resolution rule warning to debug level to not spam the user console - #5353
- Report UseDataClass findings on class name - #5352
- Report LabeledExpression as the label instead of the whole expression - #5351
- Report CastToNullableType at the cast operator instead of the whole expression - #5350
- Convert previously known string property to list based on default value - #5347
- CastToNullableType: highlights too much - #5346
- UseDataClass flags the whole class body, not just the name - #5338
- CanBeNonNullable: explain why the rule does what it does. - #5332
- Differentiate between correctable and non-correctable KtLint rules - #5324
- ReturnCount 1.22.0 crashes on valid 1.21.0 config property excludedFunctions when using --all-rules cli flag - #5323
- LabeledExpression to highlight only label - #5316
- Use the correct source directory set on JVM - #5163
- Get Android variant compile classpath from compileConfigu...
v1.22.0-RC1
1.22.0-RC1 - 2022-09-19
Notable Changes
- Our website is now versioned. You can find the changes for each version using the dropdown menu on the top bar. Documentation for the upcoming version (next) can be found here.
- We added 10 new Rules to Detekt
MultilineRawStringIndentation
- #5058TrimMultilineRawString
- #5051UnnecessaryPartOfBinaryExpression
- #5203FunctionReturnTypeSpacing
from KtLint - #5256FunctionSignature
from KtLint - #5256FunctionStartOfBodySpacing
from KtLint - #5256NullableTypeSpacing
from KtLint - #5256ParameterListSpacing
from KtLint - #5256SpacingBetweenFunctionNameAndOpeningParenthesis
from KtLint - #5256TypeParameterListSpacing
from KtLint - #5256
- We added a new ruleset called
detekt-rules-ruleauthors
containing rules for Rule Authors to enforce best practices on Detetk rules - #5129 - We added support for JVM toolchain. This means that Detekt will now respect the JDK toolchain you specify on your Gradle configuration. You will also be able to specify a custom JDK home with the
--jdk-home
CLI parameter - #5269 - Improvement for Type Resolution
- Improvement for Config Management
- Deprecations & Removals
- Notable changes to existing rules
- This version of Detekt is built with Gradle
v7.5.1
, AGP7.3.0
and Kotlin1.7.10
(see #4821 #5189 #5306) - The minimum supported Gradle version is now
v6.7.1
- #4964
Changelog
- Use list config for
FunctionOnlyReturningConstant>excludedFunctions
- #5120 - MaxLineLength: raw typo and test cleanup - #5315
- EndOfSentenceFormat: fix HTML tag heuristic - #5313
- Fix EndOfSentenceFormat highlight - #5311
- Introduce configFile property on DetektGenerateTask - #5308
- Improve debug suggestion message - #5300
- Fat-Jar version of detekt-generator module - #5297
- Toolchains docs - #5293
- Adopt new AGP dsl - #5288
- NonBooleanPropertyPrefixedWithIs: Allow boolean functions - #5285
- Provide the current classpath inside
KotlinEnvironmentResolver
- #5275 - Fix false-positive on
NestedScopeFunctions
- #5274 - Use convention method to set task property defaults - #5272
- Update docusaurus monorepo to v2.1.0 - #5270
- detektVersionReplace.js plugin is not replacing all [detekt_version] tags on website - #5266
- Update ktlint rule doc links - #5258
- Remove redundant rule config for rules enabled by default - #5257
- UnusedPrivateMember: fix false positive with backtick parameters - #5252
- Improve MultilineRawStringIndentation - #5245
- UnnecessaryLet: fix false positive with with invoke operator calls - #5240
- Introduce baseline tooling api - #5239
- Allow secondary constructors to reference CoroutineDispatchers - #5227
- Update
UnnecessaryAbstractClass
issue description to be less verbose - #5224 - Update plugin com.gradle.common-custom-user-data-gradle-plugin to v1.8.0 - #5223
- Pin dependencies - #5222
- Remove rule from NamingRules multi rule - #5212
- Run all rules from EmptyBlocks multi rule individually - #5208
- Run all rules from KDocStyle multi rule individually - #5207
- Docs: GitHub - Add link to configure Sarif severity alert level - #5206
- Fix errors with
detektGenerateConfig
- #5199 - Forbid constructors with
ForbiddenMethodCall
- #5195 - Update github/codeql-action digest to 2ca79b6 - #5177
- Allow to ignore overloaded methods for the complex interface rule (#5165) - #5173
- Add excludesRawStrings in MaxLineLength - #5171
- Enable Predictive Test Selection for local builds - #5170
- Update dependency org.kohsuke:github-api to v1.307 - #5168
- Update dependency com.github.ajalt:clikt to v2.8.0 - #5167
- Update docusaurus monorepo to v2.0.1 - #5166
- Run build-logic Kotlin compilation out of process on CI - #5162
- Add information about exhaustiveness check to documentation - #5160
- Use getter when determining whether custom config path is set in DetektGenerateConfigTask - #5157
- Limit Kotlin version warning suppression scope in build - #5156
- Re-enable warnings as errors for detekt-gradle-plugin - #5155
- Bundle slf4j-nop in detekt-formatting JAR - #5153
- Fix false negative for UseRequire when thrown in conditional block - #5147
- Allow parentheses for unclear precedence with range operator - #5143
- Mark apiDump task as incompatible with configuration cache - #5134
- Improve binding context management - #5130
RedundantExplicitType
add annotation@RequiresTypeResolution
- #5128- Disable
ExitOutsideMain
ifcontextBinding
is empty - #5127 - Use list config for
DataClassContainsFunctions>conversionFunctionPrefix
- #5119 - Support proper globbing in
ReturnCount
- #5118 - Improve finding message of ExplicitItLambdaParameter - #5117
- Update JamesIves/github-pages-deploy-action digest to 13046b6 - #5110
- UnusedUnaryOperator: fix false positive with var assignment and if expression - #5106
- Tag publishPlugins task as incompatible with configuration cache - #5101
- Make verifyGeneratorOutput task configuration cache compatible - #5100
- Remove obsolete FeatureInAlphaState opt in - #5099
- Remove explicit RequiresOptIn compiler flag - [#5098](https://github.com/detekt/detekt/...
v1.21.0
We're delighted to announce the next upcoming stable release of Detekt: 1.21.0
🎉
This release is coming with 6 new rules, new API and functionalities and several stability improvements.
We want to thank you very much our Sponsors for the support in those last months. The work behind Detekt is all happening on a voluntary basis, and we're more than grateful for all the support we get from the Open Source Ecosystem.
We're also excited to announce that we're now having an Open Source Gradle Enterprise instance. When building the Detekt projects, you'll benefit from the Gradle Remote Cache that this instance is providing!
Finally, 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 enabled ~30 new rules by default which we believe are now stable enough. - #4875
- We added 7 new Rules to Detekt
- We added support for Markdown reports - #4858
- We now allow users and rule authors to specify a reason for every value in the config file - #4611 - Please note that this feature requires a rule to be extended to support it. If you're a rule author you can start using it right away in your rule. We're looking into using this feature in some first party rule starting from Detekt
1.22.0
. - We now report as warnings the Strings in the config file that can be converted to be an array - #4793
- We added a dependency on ConTester to help us verify concurrency scenarios for Detekt - #4672
- For contributors: we restructured our build setup to be use Gradle composite build - #4751
Migration
We fixed a bug related to function with KDocs and how their location in the source code was calculated (see #4961 and #4887).
Because of this, some users might have to recreate their baseline as the location of such functions are not matched anymore against the baseline. You can do so by deleting your old baseline and invoking the detektBaseline
task (or the corresponding task, based on your configuration).
Changelog
- ReturnCount: Make configuration parameter more explicit - #5062
- Remove redundant null check - #5061
- Drop redundant Gradle workaround - #5057
- Update ktlint links from website to readme - #5056
- Improve extensions.doc format with admonitions - #5055
- Update docusaurus monorepo to v2.0.0-beta.22 - #5050
- Enable strict Kotlin DSL precompiled script plugins accessors generation - #5048
- MaxChainedCallsOnSameLine: don't count package references as chained calls - #5036
- Xml Report Merger now merges duplicate smells across input report files - #5033
- Add ending line and column to Location.kt - #5032
- Fix type resolution link in Contributing.md - #5027
- #5014 Fix MaxChainedCallsOnSameLine false positives - #5020
- Add endColumn/endLine to SARIF region - #5011
- Removed UnnecessaryAbstractClass if it inherits from a abstract class - #5009
- Only recommend using index accessors for Java classes that are known collections - #4994
- UnusedImports: fix false positive for unresolved imports - #4882
- Fix Signatures.kt:buildFunctionSignature - #4961
- Loading a specific resource from a module must use class from module - #5008
- Update github/codeql-action digest to 3f62b75 - #5007
- Show finding at declaration name instead of the whole declaration - #5003
- NamedArguments: don't count trailing lambda argument - #5002
- Address TextLocation for Wrapping - #4998
- Support markdown report in Gradle plugin - #4995
- Fix false-negative for CanBeNonNullable - #4993
- Give a better error message for --jvm-target - #4978
- Fix rule code samples to be valid Kotlin code - #4969
- Use plain ASCII output in standard reports - #4968
- UnnecessaryApply: fix false negative for assignment - #4948
- Support disabling config validation via tooling spec - #4937
- UnusedPrivateMember: highlight declaration name - #4928
- Provide a priority field for DetektProvider - #4923
- CastToNullableType: allow casting null keyword - #4907
- Update plugin com.gradle.common-custom-user-data-gradle-plugin to v1.7.2 - #4897
- Set strict dependency on tested Kotlin compiler version - #4822
- Simplify regular expressions - #4893
- Remove redundant character escape in RegExp - #4892
- Reformat Markdown files to comply with the spec - #4891
- UnnecessaryInnerClass: fix false negative with
this
references - #4884 - UselessCallOnNotNull: fix false positive for unresolved types - #4880
- Update MagicNumber rule to exclude .kts files - #4877
- CanBeNonNullable: fix false positives for parameterized types - #4870
- UnnecessaryInnerClass: fix false positives labeled expression to outer class - #4865
- UnnecessaryInnerClass: add test for safe qualified expressions - #4864
- Fix a confusing Regex in the Compose webpage - #4852
- Fix edit URLs for the website - #4850
- detektGenerateConfig adds the configuration of plugins - #4844
- Update dependency prism-react-renderer to v1.3.3 - #4833
- Search in all versions.properties, not just the first one #4830 - #4831
- Improve exception message - #4823
- Fix ValShouldBeVar false positive inside unknown type - #4820
- Add a recent conference talk link - #4819
- False positive for unused imports #4815 - #4818
- Revert "Display dynamic --jvm-target values when using --help flag (#4694)" - #4816
- UnnecessaryAbstractClass: report only the class name - #4808
- Fix wrong replacement suggestion for UnnecessaryFilter - #4807
- UseOrEmpty: fix false positive for indexing operator calls with type parameters - #4804
- ExplicitCollectionElementAccessMethod: fix false positive for get operators with type parameters - #4803
- Add tests for #4786 - #4801
- Add documentation link for rules in html report - #4799
- Improve rule documentaion and smell message of NamedArguments - #4796
- Improve issue description and smell message of DestructuringDeclarationWithTooManyEntries - [#4795](http...
v1.21.0-RC2
1.21.0-RC2 - 2022-06-29
Notable Changes
- We enabled ~30 new rules by default which we believe are now stable enough. - #4875
- We added 6 new Rules to Detekt
- We added support for Markdown reports - #4858
- We now allow users and rule authors to specify a reason for every value in the config file - #4611
- We now report as warnings the in the config file that can be converted to be an array - #4793
- We added a dependency on ConTester to help us verify concurrency scenarios for Detekt - #4672
- For contributors: we restructured our build setup to be use Gradle composite build - #4751
Changelog
- Fix Signatures.kt:buildFunctionSignature - #4961
- Loading a specific resource from a module must use class from module - #5008
- Update github/codeql-action digest to 3f62b75 - #5007
- Show finding at declaration name instead of the whole declaration - #5003
- NamedArguments: don't count trailing lambda argument - #5002
- Address TextLocation for Wrapping - #4998
- Support markdown report in Gradle plugin - #4995
- Fix false-negative for CanBeNonNullable - #4993
- Give a better error message for --jvm-target - #4978
- Fix rule code samples to be valid Kotlin code - #4969
- Use plain ASCII output in standard reports - #4968
- UnnecessaryApply: fix false negative for assignment - #4948
- Support disabling config validation via tooling spec - #4937
- UnusedPrivateMember: highlight declaration name - #4928
- Provide a priority field for DetektProvider - #4923
- CastToNullableType: allow casting null keyword - #4907
- Update plugin com.gradle.common-custom-user-data-gradle-plugin to v1.7.2 - #4897
- Set strict dependency on tested Kotlin compiler version - #4822
- Simplify regular expressions - #4893
- Remove redundant character escape in RegExp - #4892
- Reformat Markdown files to comply with the spec - #4891
- UnnecessaryInnerClass: fix false negative with
this
references - #4884 - UselessCallOnNotNull: fix false positive for unresolved types - #4880
- Update MagicNumber rule to exclude .kts files - #4877
- CanBeNonNullable: fix false positives for parameterized types - #4870
- UnnecessaryInnerClass: fix false positives labeled expression to outer class - #4865
- UnnecessaryInnerClass: add test for safe qualified expressions - #4864
- Fix a confusing Regex in the Compose webpage - #4852
- Fix edit URLs for the website - #4850
- detektGenerateConfig adds the configuration of plugins - #4844
- Update dependency prism-react-renderer to v1.3.3 - #4833
- Search in all versions.properties, not just the first one #4830 - #4831
- Improve exception message - #4823
- Fix ValShouldBeVar false positive inside unknown type - #4820
- Add a recent conference talk link - #4819
- False positive for unused imports #4815 - #4818
- Revert "Display dynamic --jvm-target values when using --help flag (#4694)" - #4816
- UnnecessaryAbstractClass: report only the class name - #4808
- Fix wrong replacement suggestion for UnnecessaryFilter - #4807
- UseOrEmpty: fix false positive for indexing operator calls with type parameters - #4804
- ExplicitCollectionElementAccessMethod: fix false positive for get operators with type parameters - #4803
- Add tests for #4786 - #4801
- Add documentation link for rules in html report - #4799
- Improve rule documentaion and smell message of NamedArguments - #4796
- Improve issue description and smell message of DestructuringDeclarationWithTooManyEntries - #4795
- NestedScopeFunctions - Add rule for nested scope functions - #4788
- Partially drop redundant usage of "dry run" in Gradle plugin tests - #4776
- Allow additionalJavaSourceRootPaths to be defined on @KotlinCoreEnvironmentTest - #4771
- Report KDoc comments that refer to non-public properties of a class - #4768
- Self-inspect the detekt-gradle-plugin - #4765
- Pass args to DetektInvoker as List<String> - #4762
- Cleanup Gradle Plugin Publications - #4752
- Break a dependency between
detekt-gradle-plugin
anddetekt-utils
- #4748 - Remove suspend lambda rule with CoroutineScope receiver due to not de… - #4747
VarCouldBeVal
: Add configuration flagignoreLateinitVar
- #4745- UnnecessaryInnerClass: fix false positive with references to function type variables - #4738
- Fix false positive on VarCouldBeVal in generic classes - #4733
- OutdatedDocumentation: fix false positive with no primary constructor - #4728
- Android Gradle: add javac intermediates to classpath - #4723
- OptionalWhenBraces: fix false negative when the single statement has comments inside - #4722
- Document pre-commit hook for staged files - #4711
- Enable rules by default for
1.21
- #4643
Dependency Updates
- Update dependency org.jetbrains.kotlinx:kotlinx-coroutines-core to v1.6.3 - #4976
- Update dependency org.jetbrains.dokka to v1.7.0 - #4974
- Update plugin binaryCompatibilityValidator to v0.10.1 - #4954
- Update dependency org.jetbrains.kotlinx:kotlinx-coroutines-core to v1.6.2 - #4868
- Update dependency com.android.tools.build:gradle to v7.2.1 - #4861
- Update plugin binaryCompatibilityValidator to v0.10.0 - #4837
- Update dependency io.mockk:mockk to v1.12.4 - #4829
- Update dependency com.android.tools.build:gradle to v7.2.0 - #4824
- Add dependency-analysis plugin and implement some recommendations - #4798
- Add dependency on slf4j-nop to silence warning - #4775
- Update plugin dokka to v1.6.21 - #4770
- Update org.jetbrains.kotlin to v1.6.21 - #4737
- Update dependency com.github.breadmoirai:github-release to v2.3.7 - #4734
- Update plugin binaryCompatibilityValidator to v0.9.0 - #4729
Housekeeping & Refactorings
- Measure flakyness on...
v1.21.0-RC1
v1.21.0-RC1 - 2022-06-02
Notable Changes
- We enabled ~30 new rules by default which we believe are now stable enough. - #4875
- We added 3 new Rules to Detekt
- We now allow users and rule authors to specify a reason for every value in the config file - #4611
- We now report as warnings the in the config file that should converted to be an array - #4793
- We added a dependency on ConTester to help us verify concurrency scenarios for Detekt - #4672
- For contributors: we restructured our build setup to be use Gradle composite build - #4751
Changelog
- Simplify regular expressions - #4893
- Remove redundant character escape in RegExp - #4892
- Reformat Markdown files to comply with the spec - #4891
- UnnecessaryInnerClass: fix false negative with
this
references - #4884 - UselessCallOnNotNull: fix false positive for unresolved types - #4880
- Update MagicNumber rule to exclude .kts files - #4877
- CanBeNonNullable: fix false positives for parameterized types - #4870
- UnnecessaryInnerClass: fix false positives labeled expression to outer class - #4865
- UnnecessaryInnerClass: add test for safe qualified expressions - #4864
- Fix a confusing Regex in the Compose webpage - #4852
- Fix edit URLs for the website - #4850
- detektGenerateConfig adds the configuration of plugins - #4844
- Update dependency prism-react-renderer to v1.3.3 - #4833
- Search in all versions.properties, not just the first one #4830 - #4831
- Improve exception message - #4823
- Fix ValShouldBeVar false positive inside unknown type - #4820
- Add a recent conference talk link - #4819
- False positive for unused imports #4815 - #4818
- Revert "Display dynamic --jvm-target values when using --help flag (#4694)" - #4816
- UnnecessaryAbstractClass: report only the class name - #4808
- Fix wrong replacement suggestion for UnnecessaryFilter - #4807
- UseOrEmpty: fix false positive for indexing operator calls with type parameters - #4804
- ExplicitCollectionElementAccessMethod: fix false positive for get operators with type parameters - #4803
- Add tests for #4786 - #4801
- Add documentation link for rules in html report - #4799
- Improve rule documentaion and smell message of NamedArguments - #4796
- Improve issue description and smell message of DestructuringDeclarationWithTooManyEntries - #4795
- NestedScopeFunctions - Add rule for nested scope functions - #4788
- Partially drop redundant usage of "dry run" in Gradle plugin tests - #4776
- Allow additionalJavaSourceRootPaths to be defined on @KotlinCoreEnvironmentTest - #4771
- Report KDoc comments that refer to non-public properties of a class - #4768
- Self-inspect the detekt-gradle-plugin - #4765
- Pass args to DetektInvoker as List<String> - #4762
- Cleanup Gradle Plugin Publications - #4752
- Break a dependency between
detekt-gradle-plugin
anddetekt-utils
- #4748 - Remove suspend lambda rule with CoroutineScope receiver due to not de… - #4747
VarCouldBeVal
: Add configuration flagignoreLateinitVar
- #4745- UnnecessaryInnerClass: fix false positive with references to function type variables - #4738
- Fix false positive on VarCouldBeVal in generic classes - #4733
- OutdatedDocumentation: fix false positive with no primary constructor - #4728
- Android Gradle: add javac intermediates to classpath - #4723
- OptionalWhenBraces: fix false negative when the single statement has comments inside - #4722
- Document pre-commit hook for staged files - #4711
- Enable rules by default for
1.21
- #4643
Dependency Updates
- Update dependency org.jetbrains.kotlinx:kotlinx-coroutines-core to v1.6.2 - #4868
- Update dependency com.android.tools.build:gradle to v7.2.1 - #4861
- Update plugin binaryCompatibilityValidator to v0.10.0 - #4837
- Update dependency io.mockk:mockk to v1.12.4 - #4829
- Update dependency com.android.tools.build:gradle to v7.2.0 - #4824
- Add dependency-analysis plugin and implement some recommendations - #4798
- Add dependency on slf4j-nop to silence warning - #4775
- Update plugin dokka to v1.6.21 - #4770
- Update org.jetbrains.kotlin to v1.6.21 - #4737
- Update dependency com.github.breadmoirai:github-release to v2.3.7 - #4734
- Update plugin binaryCompatibilityValidator to v0.9.0 - #4729
Housekeeping & Refactorings
- Declare nested test classes as non-static - #4894
- Remove deprecated usages in gradle-plugin test - #4889
- Remove reference to contributor list - #4871
- Add missing image - #4834
- Upgrade to GE enterprise 3.10 - #4802
- Fix broken snapshot publishing - #4783
- Remove pending Gradle version milestones from comments - #4777
- Add more tests for Annotation Suppressor - #4774
- fix: add test case that fails if environment is not properly set up - #4769
- Disable UnusedImports for the Detekt project - #4741
- Remove Unnecesary @nested - #4740
- Update the argsfile to unblock
runWithArgsFile
failing locally - #4718
See all issues at: 1.21.0
v1.20.0
We're extremely excited to share with you all the next upcoming stable release of Detekt: 1.20.0
🎉
This release is coming with 16 new rules, new API and functionalities and several stability improvements.
First, much thanks to our sponsors ❤️ as we were able to buy a domain and move our website to https://detekt.dev/.
As for the feature shipped, we work a lot on the Reporting side: we added a new type of reporting, improved the styling of the existing one and
generally reduced the unnecessary warnings of run with type resolution.
For rules like ForbiddenMethod
where you can configure a signature of a method you want to use in your rule, we added a new syntax
that allows to reference generic methods & extension functions.
We update a lot of the libraries we depend on bringing Detekt up to the ecosystem: KtLint 0.45.2, Kotlin 1.6.20 and Gradle 7.4.2 to name a few.
Finally, we also migrated all of our tests from Spek to JUnit. This was a huge effort that will hopefully make easier for contributors
to be involved with Detekt.
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
- With this Detekt versions, rule authors can define the default configuration for their custom rules. This default configuration will be merged together with the user configuration and can be overridden by the user if they wish. More on this here #4315. The
formatting
ruleset provided by Detekt is updated to use this new mechanism - #4352 - We've added 16 new rules:
- UnnecessaryInnerClass - #4394
- CanBeNonNullableProperty - #4379
- NullCheckOnMutableProperty - #4353
- SuspendFunWithCoroutineScopeReceiver - #4616
- ElseCaseInsteadOfExhaustiveWhen - #4632
- TrailingComma - From KtLint - #4227
- UnnecessaryParenthesesBeforeTrailingLambda - From KtLint - #4630
- BlockCommentInitialStarAlignment - From KtLint - #4645
- CommentWrapping - From KtLint - #4645
- DiscouragedCommentLocation - From KtLint - #4645
- FunKeywordSpacing - From KtLint - #4645
- FunctionTypeReferenceSpacing - From KtLint - #4645
- KdocWrapping - From KtLint - #4645
- ModifierListSpacing - From KtLint - #4645
- TypeArgumentListSpacing - From KtLint - #4645
- Wrapping - From KtLint - #4645
- We've made several improvements to the console reporting:
- The HTML report has now a better CSS styling - #4447
- The default reporting format is now
LiteFindingsReport
(which is more compact reporting and similar to other tools in the ecosystem. You can see an example here) - #4449. - We've added issue details to findings on
FindingsReport
andFileBasedFindingsReporter
- #4464 - We suppressed several warnings reported when running with type resolution - #4423
- We fixed a regression introduced in
1.19.0
for users usingignoreAnnotated
running without type resolution - #4570 - For rules like
ForbiddenMethod
where you can specify a method name in the config file, now we added support for: - We've fixed a security vulnerability related to XML parsing - #4499
- We've changed the behavior of the baseline task. Now the baseline is always update, even if you fixed all the issues in your codebase - #4445
- We now enable the naming ruleset by default also on tests. Previously they were excluded - #4438
- This version of Detekt is built with Gradle
v7.4.2
, AGP7.1.3
and Kotlin1.6.20
(see #4530 #4573 #4133 #4277 #4665) - This version of Detekt is wrapping KtLint version
0.45.2
(see #4227 #4630 #4645 #4690) - For contributors: we migrated all our tests from Spek to JUnit due to better support and tooling #4670.
Changelog
- Display dynamic --jvm-target values when using --help flag - #4694
- CanBeNonNullable shouldn't consider abstract properties - #4686
- NonBooleanPropertyPrefixedWithIs: Allow boolean function reference - #4684
- [VarCouldBeVal] fix overrides false positives - #4664
- Add ignoreOverridden support for BooleanPropertyNaming rule - #4654
- Fix regression generating configuration - #4646
- Fix concurrency issue when creating PomModel (#4609) - #4631
- UnnecessaryAbstractClass: fix false positive when the abstract class has properties in the primary constructor - #4628
- Properly set toolVersion on DetektExtension - #4623
- NamedArguments: Ignore when argument values are the same as the parameter name - #4613
- Parallel invocation of AnalysisFacade fails spuriously in 1.20.0-RC1 - #4609
- NoSuchElementException after updating to 1.20.0-RC1 - #4604
- Better error classification in Gradle Enterprise. - #4586
- Fix for missing /kotlin folder when running on Android projects - #4554
- Deprecate continuationIndentSize from the Indentation rule - #4551
- Fix performance issue for regexp in Reporting.kt - #4550
- Revert "trim values when parsing the baseline (#4335)" - #4548
- Fix AutoCorrection crashing with Missing extension point - #4545
- Make DoubleMutabilityForCollection configurable and set a DoubleMutability alias - #4541
- Fix
AnnotationExcluder
- #4518 - Fix false positive of UnnecessaryInnerClass - #4509
- [MaxLineLength] Fix signature in for blank characters in the Baseline - #4504
- Fix overridden function reporting for CanBeNonNullable rule - #4497
- Set the name of functions and paramenters between ` to improve the readability - #4488
- update InvalidPackageDeclaration to report if rootPackage is not present - #4484
- [VarCouldBeVal] Override vars will not be flagged if bindingContext is not set - #4477
- Document the overlapping rules from
formatting
- #4473 - Match functions signatures with lambdas on it - #4458
- Add option for OutdatedDocumentation to allow param in constructor pr… - #4453
- Ignore private operators when we don't have ContextBingding in UnusedPrivateMember - #4441
- Add documentation for
Suppressor
s - #4440 - [FunctionNaming] Don't allow the usage of ` in function names - #4439
- Add list of functions to skip in IgnoredReturnValue rule - #4434
- Extend CanBeNonNullable rule to check function params - #4431
- Extend VarCouldBeVal to include analysis of file- and class-level properties - [#4424](https://gith...
v1.20.0-RC2
v1.20.0-RC2 - 2022-03-31
Notable Changes
- Thanks to our sponsors ❤️, we were able to buy a domain and move our website to https://detekt.dev/.
- With this Detekt versions, rule authors can define the default configuration for their custom rules. This default configuration will be merged together with the user configuration and can be overridden by the user if they wish. More on this here #4315. The
formatting
ruleset provided by Detekt is updated to use this new mechanism - #4352 - We've added 16 new rules:
- UnnecessaryInnerClass - #4394
- CanBeNonNullableProperty - #4379
- NullCheckOnMutableProperty - #4353
- SuspendFunWithCoroutineScopeReceiver - #4616
- ElseCaseInsteadOfExhaustiveWhen - #4632
- TrailingComma - From KtLint - #4227
- UnnecessaryParenthesesBeforeTrailingLambda - From KtLint - #4630
- BlockCommentInitialStarAlignment - From KtLint - #4645
- CommentWrapping - From KtLint - #4645
- DiscouragedCommentLocation - From KtLint - #4645
- FunKeywordSpacing - From KtLint - #4645
- FunctionTypeReferenceSpacing - From KtLint - #4645
- KdocWrapping - From KtLint - #4645
- ModifierListSpacing - From KtLint - #4645
- TypeArgumentListSpacing - From KtLint - #4645
- Wrapping - From KtLint - #4645
- We've made several improvements to the console reporting:
- The HTML report has now a better CSS styling - #4447
- The default reporting format is now
LiteFindingsReport
(which is more compact reporting and similar to other tools in the ecosystem. You can see an example here) - #4449. - We've added issue details to findings on
FindingsReport
andFileBasedFindingsReporter
- #4464 - We suppressed several warnings reported when running with type resolution - #4423
- We fixed a regression introduced in
1.19.0
for users usingignoreAnnotated
running without type resolution - #4570 - For rules like
ForbiddenMethod
where you can specify a method name in the config file, now we added support for: - We've fixed a security vulnerability related to XML parsing - #4499
- We've changed the behavior of the baseline task. Now the baseline is always update, even if you fixed all the issues in your codebase - #4445
- We now enable the naming ruleset by default also on tests. Previously they were excluded - #4438
- This version of Detekt is built with Gradle
v7.4.1
, AGP7.1.1
and Kotlin1.6.10
(see #4530 #4573 #4133 #4277) - This version of Detekt is wrapping KtLint version
0.45.1
(see #4227 - #4630 - #4645) - For contributors: we migrated most of our tests from Spek to JUnit due to better support and tooling.
Changelog
- Add ignoreOverridden support for BooleanPropertyNaming rule - #4654
- Fix regression generating configuration - #4646
- Fix concurrency issue when creating PomModel (#4609) - #4631
- UnnecessaryAbstractClass: fix false positive when the abstract class has properties in the primary constructor - #4628
- Properly set toolVersion on DetektExtension - #4623
- NamedArguments: Ignore when argument values are the same as the parameter name - #4613
- Parallel invocation of AnalysisFacade fails spuriously in 1.20.0-RC1 - #4609
- NoSuchElementException after updating to 1.20.0-RC1 - #4604
- Better error classification in Gradle Enterprise. - #4586
- Fix for missing /kotlin folder when running on Android projects - #4554
- Deprecate continuationIndentSize from the Indentation rule - #4551
- Fix performance issue for regexp in Reporting.kt - #4550
- Revert "trim values when parsing the baseline (#4335)" - #4548
- Fix AutoCorrection crashing with Missing extension point - #4545
- Make DoubleMutabilityForCollection configurable and set a DoubleMutability alias - #4541
- Fix
AnnotationExcluder
- #4518 - Fix false positive of UnnecessaryInnerClass - #4509
- [MaxLineLength] Fix signature in for blank characters in the Baseline - #4504
- Fix overridden function reporting for CanBeNonNullable rule - #4497
- Set the name of functions and paramenters between ` to improve the readability - #4488
- update InvalidPackageDeclaration to report if rootPackage is not present - #4484
- [VarCouldBeVal] Override vars will not be flagged if bindingContext is not set - #4477
- Document the overlapping rules from
formatting
- #4473 - Match functions signatures with lambdas on it - #4458
- Add option for OutdatedDocumentation to allow param in constructor pr… - #4453
- Ignore private operators when we don't have ContextBingding in UnusedPrivateMember - #4441
- Add documentation for
Suppressor
s - #4440 - [FunctionNaming] Don't allow the usage of ` in function names - #4439
- Add list of functions to skip in IgnoredReturnValue rule - #4434
- Extend CanBeNonNullable rule to check function params - #4431
- Extend VarCouldBeVal to include analysis of file- and class-level properties - #4424
- Formulate rule/sample-extensions descriptions consistently - #4412
- Fix false-positive on ExplicitCollectionElementAccessMethod - #4400
- Fixes false negatives in
UnnecessaryAbstractClass
- #4399 - Add first draft of a rule description style guide - #4386
- Forbid usage of java.lang.ClassLoader.getResourceAsStream - #4381
- Update Sponsor button to Detekt's one - #4378
- [OptionalUnit] Allow a function to declare a Unit return type when it uses a generic function initializer - #4371
- Completely-empty abstract classes will now be flagged by UnnecessaryAbstractClass - #4370
- Fix false positive in RethrowCaughtException for try with more than one catch (#4367) - #4369
- Testing and rule improvement for EmptyElseBlock - #4349
- UnusedPrivateMember should not report external classes/interfaces - #4347
- [UseDataClass] Do not report on
inner
classes - #4344 - Support jvmTarget 17 - #4287
- UnderscoresInNumericLiterals: Allow numbers with non standard groupings - #4280
- Introduce DefaultValue type - #3928
Dependency Updates
- Update dependency gradle to v7.4.1 - #4622
- Update dependency com.android.tools...
v1.20.0-RC1
v1.20.0-RC1 - 2022-02-26
Notable Changes
- Thanks to our sponsors ❤️, we were able to buy a domain and move our website to https://detekt.dev/.
- With this Detekt versions, rule authors can define the default configuration for their custom rules. This default configuration will be merged together with the user configuration and can be overridden by the user if they wish. More on this here #4315. The
formatting
ruleset provided by Detekt is updated to use this new mechanism - #4352 - We've added 4 new rules:
- We've made several improvements to the console reporting:
- The HTML report has now a better CSS styling - #4447
- The default reporting format is now
LiteFindingsReport
(which is more compact reporting and similar to other tools in the ecosystem. You can see an example here) - #4449. - We've added issue details to findings on
FindingsReport
andFileBasedFindingsReporter
- #4464 - We suppressed several warnings reported when running with type resolution - #4423
- We fixed a regression introduced in
1.19.0
for users usingignoreAnnotated
running without type resolution - #4570 - We've fixed a security vulnerability related to XML parsing - #4499
- We've changed the behavior of the baseline task. Now the baseline is always update, even if you fixed all the issues in your codebase - #4445
- We now enable the naming ruleset by default also on tests. Previously they were excluded - #4438
- This version of Detekt is built with Gradle
v7.4
, AGP7.1.1
and Kotlin1.6.10
(see #4530 #4573 #4133 #4277) - This version of Detekt is wrapping KtLint version
0.43.2
(see #4227) - For contributors: we migrated most of our tests from Spek to JUnit due to better support and tooling.
Changelog
- Better error classification in Gradle Enterprise. - #4586
- Fix for missing /kotlin folder when running on Android projects - #4554
- Deprecate continuationIndentSize from the Indentation rule - #4551
- Fix performance issue for regexp in Reporting.kt - #4550
- Revert "trim values when parsing the baseline (#4335)" - #4548
- Fix AutoCorrection crashing with Missing extension point - #4545
- Make DoubleMutabilityForCollection configurable and set a DoubleMutability alias - #4541
- Fix
AnnotationExcluder
- #4518 - Fix false positive of UnnecessaryInnerClass - #4509
- [MaxLineLength] Fix signature in for blank characters in the Baseline - #4504
- Fix overridden function reporting for CanBeNonNullable rule - #4497
- Set the name of functions and paramenters between ` to improve the readability - #4488
- update InvalidPackageDeclaration to report if rootPackage is not present - #4484
- [VarCouldBeVal] Override vars will not be flagged if bindingContext is not set - #4477
- Document the overlapping rules from
formatting
- #4473 - Match functions signatures with lambdas on it - #4458
- Add option for OutdatedDocumentation to allow param in constructor pr… - #4453
- Ignore private operators when we don't have ContextBingding in UnusedPrivateMember - #4441
- Add documentation for
Suppressor
s - #4440 - [FunctionNaming] Don't allow the usage of ` in function names - #4439
- Add list of functions to skip in IgnoredReturnValue rule - #4434
- Extend CanBeNonNullable rule to check function params - #4431
- Extend VarCouldBeVal to include analysis of file- and class-level properties - #4424
- Formulate rule/sample-extensions descriptions consistently - #4412
- Fix false-positive on ExplicitCollectionElementAccessMethod - #4400
- Fixes false negatives in
UnnecessaryAbstractClass
- #4399 - Add first draft of a rule description style guide - #4386
- Forbid usage of java.lang.ClassLoader.getResourceAsStream - #4381
- Update Sponsor button to Detekt's one - #4378
- [OptionalUnit] Allow a function to declare a Unit return type when it uses a generic function initializer - #4371
- Completely-empty abstract classes will now be flagged by UnnecessaryAbstractClass - #4370
- Fix false positive in RethrowCaughtException for try with more than one catch (#4367) - #4369
- Testing and rule improvement for EmptyElseBlock - #4349
- UnusedPrivateMember should not report external classes/interfaces - #4347
- [UseDataClass] Do not report on
inner
classes - #4344 - Support jvmTarget 17 - #4287
- UnderscoresInNumericLiterals: Allow numbers with non standard groupings - #4280
- Introduce DefaultValue type - #3928
Dependency Updates
- Update dependency com.android.tools.build:gradle to v7.1.2 - #4594
- Update dependency com.android.tools.build:gradle to v7.1.1 - #4561
- Update plugin pluginPublishing to v0.20.0 - #4502
- Update JamesIves/github-pages-deploy-action action to v4.2.1 - #4475
- Update JamesIves/github-pages-deploy-action action to v4.1.9 - #4455
- Update plugin gradleVersions to v0.41.0 - #4454
- Revert "Update plugin pluginPublishing to v0.19.0 (#4429)" - #4452
- Update plugin pluginPublishing to v0.19.0 - #4429
- Update dependency io.mockk:mockk to v1.12.2 - #4427
- Shadow 7.1.2 - #4422
- Update plugin dokka to v1.6.10 - autoclosed - #4407
- Update dependency org.jetbrains.dokka:jekyll-plugin to v1.6.10 - #4406
- Update dependency org.jetbrains.kotlinx:kotlinx-coroutines-core to v1.6.0 - #4393
- Update dependency gradle to v7.3.3 - #4392
- Update dependency org.yaml:snakeyaml to v1.30 - #4375
- Update dependency gradle to v7.3.2 - #4374
- Update plugin shadow to v7.1.1 - #4373
- Update dependency gradle to v7.3.1 - #4350
- Update plugin dokka to v1.6.0 - #4328
Housekeeping & Refactorings
- Housekeep Gradle scripts - #4589
- Refactor config printer to improve testability - #4580
- avoid usage of java stream for parameterized tests - #4579
- split rule documentation printer to improve testability - #4578
- Make VERSION_CATALOGS stable - #4577
- Enable Gradle's configuration cache by default - #4576
- Migrate detekt-rules-performance tests to JUnit - [#4569](https://github.com/...