Add a new rule MaxChainedCallsOnSameLine to limit the number of chained calls on placed on a single line. This works well alongside CascadingCallWrapping in #4979 to make long call chains more readable by wrapping them on new lines.
Fix a missed case of UnnecessaryApply where the apply contains a single field assignment but the result of the apply{} is unused. This pattern is actually used in 2/3 of the <noncompliant> examples and while it occurred in tests for false positives, no test actually checked that warnings were generated in the simple case.
* Report null-check returning 'Unit'
The rule will report code smell when null-check expression returns 'Unit'
* Not report guard statement with side effect ahead
Add a new rule CascadingCallWrapping which requires that if a chained call is placed on a newline then all subsequent calls must be as well, improving readability of long chains.
* Move integrations down
* Remove old integration
* Move more integrations down
* More improvements
* Improve the detekt features
* Update link
* Improve website/docs/intro.mdx
* Add links to kotlin homepage
* Update README.md
Co-authored-by: schalkms <30376729+schalkms@users.noreply.github.com>
* Add complexity reports back
Co-authored-by: schalkms <30376729+schalkms@users.noreply.github.com>
* Refactor `JvmSpec` to avoid using test resources
* Build a utility to copy resource files into temporary files
* Fix deprecation warning on jacocoMergedReport
* Add back `jvm` test fixtures
* Enabled Remote Build cache
* Change androidSdkInstalled to a boolean flag
* Use consistent warningsAsErrors
* Enable local build cache
* Fix MaxLineLength violation
* Update build-logic/src/main/kotlin/module.gradle.kts
Co-authored-by: Brais Gabín <braisgabin@gmail.com>
* Add a separate job to enable `warningsAsErrors`
Co-authored-by: Nicola Corti <corti.nico@gmail.com>
Co-authored-by: Brais Gabín <braisgabin@gmail.com>
Fix a false positive for CastToNullableType for casting a literal `null` to a nullable type. This can be necessary when providing null as a function argument where the incoming type is parameterized. In this case using e.g. `null as? String` is less meaningful and generates a compiler warning that the cast cannot succeed.
This rule is based on discussion #4890.
Checks for suppression of one or more rules that have been decided to
never be suppressed within a code base. For example, if we've set
MaximumLineLength to a value, every file must be compliant, and if there
is a special case where compliance is discouraged, we can simply exclude
this file within YML configuration.
This rule cannot prevent itself from being suppressed, but should serve
to discourage the over use of `@Suppress` annotations.