This PR contains the following updates:
| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| io.gitlab.arturbosch.detekt (source) | 1.21.0
-> 1.22.0
| | | | |
| io.gitlab.arturbosch.detekt:detekt-formatting (source) | 1.21.0
-> 1.22.0
| | | | |
β Dependency Lookup Warnings β
Warnings were logged while processing this repo. Please check the Dependency Dashboard for more information.
Release Notes
detekt/detekt
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
- #β5333
MultilineRawStringIndentation
- #β5058
TrimMultilineRawString
- #β5051
UnnecessaryNotNullCheck
- #β5218
UnnecessaryPartOfBinaryExpression
- #β5203
UseSumOfInsteadOfFlatMapSize
- #β5405
FunctionReturnTypeSpacing
from KtLint - #β5256
FunctionSignature
from KtLint - #β5256
FunctionStartOfBodySpacing
from KtLint - #β5256
NullableTypeSpacing
from KtLint - #β5256
ParameterListSpacing
from KtLint - #β5256
SpacingBetweenFunctionNameAndOpeningParenthesis
from KtLint - #β5256
TrailingCommaOnCallSite
from KtLint - #β5312
TrailingCommaOnDeclarationSite
from KtLint - #β5312
TypeParameterListSpacing
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 new ViolatesTypeResolutionRequirements
- #β5129 #β5182
- We added a new ruleset called
detekt-rules-libraries
containing rules mostly useful for Library Authors - We moved the following rules inside ForbiddenPublicDataClass
, 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
- We will now skip rules annotated with
@RequiresTypeResolution
when without Type Resolution - #β5176
- We will warn users if they run rules requiring Type Resolution when Type Resolution is disabled, so they're not silently skipped - #β5226
- Improvement for Config Management
- We added exhaustiveness check during config validation. You can enable it
checkExhaustiveness: true
in your config file. This is disabled by default. - #β5089
- We added support for generating custom configuration for rule authors - #β5080
- 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 (and failFast
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 - #β5175
WildcardImport
is now running also on tests by default - #β5121
ForbiddenImport
allows now to specify a reason for every forbidden import - #β4909
IgnoredReturnValue
: option restrictToAnnotatedMethods
is now deprecated in favor of restrictToConfig
- #β4922
- This version of Detekt is built with Gradle
v7.5.1
, AGP 7.3.1
, Kotlin 1.7.21
and KtLint 0.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 - #β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 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 compileConfiguration - #β5152
- 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
if contextBinding
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
- Use Gradle's configuration cache by default - #β5095
- Detect undocumented protected classes, properties, and functions - #β5083
- ReturnCount.excludedFunctions should be a List<String> - #β5081
- Make ForbiddenMethodCall to support property getters/setters and method references - #β5078
- Refactor Gradle tasks to use Gradle's managed properties - #β4966
- Add option to add a reason to
ForbiddenMethodCall
- #β4910
- UnnecessaryParentheses: add options to allow in ambiguous cases - #β4881
Dependency Updates
- Update dependency com.android.tools.build:gradle to v7.3.1 - #β5411
- Update plugin com.gradle.enterprise to v3.11.2 - #β5406
- Update dependency org.jetbrains.dokka to v1.7.20 - #β5401
- Update dependency org.yaml:snakeyaml to v1.33 - #β5354
- Update dependency org.spekframework.spek2:spek-dsl-jvm to v2.0.19 - #β5237
- Update dependency com.android.tools.build:gradle to v7.2.2 - #β5178
- Update org.jetbrains.kotlinx - #β5072
- Update dependency org.jetbrains.dokka to v1.7.10 - #β5070
- Bump ktlint to version 0.46.1 - #β5044
- AssertJ 3.23.1 - #β4265
Housekeeping & Refactorings
- Document and test edge cases for ForbiddenMethodCall function signatures - #β5495
- Fix invalid syntaxes in test code - #β5446
- Improve raw strings format - #β5244
- Enable trim multiline raw string - #β5243
- Remove old configurations - #β5198
- Improve tests in UnnecessaryParenthesesSpec - #β5197
- Remove multi rule FileParsingRule - #β5193
- Remove unused dry run properties from baseline/config tasks - #β5158
- remove SimpleGlob in favor of String.simplePatternToRegex() - #β5144
- Remove unused property - #β5135
- Assert end source locations - #β5116
- Forbid usage of DiagnosticUtils.getLineAndColumnInPsiFile - #β5109
- Configure 'ForbiddenImport' to use value and reason - #β5105
- Enable Kotlin's new approach to incremental compilation - #β5092
- Fix current indentation - #β5059
See all issues at: 1.22.0
Configuration
π
Schedule: Branch creation - "before 5am on monday" (UTC), Automerge - At any time (no schedule defined).
π¦ Automerge: Disabled by config. Please merge this manually once you are satisfied.
β» Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
π Ignore: Close this PR and you won't be reminded about these updates again.
- [ ] If you want to rebase/retry this PR, check this box
This PR has been generated by Mend Renovate. View repository job log here.