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.
* Add ElseCaseInEnumOrSealedWhen rule
* Adapt to new rule by replacing else cases
* Change rule name, support booleans, improve docs
* Change variable name of boolean condition
* Rename rule to ElseCaseInsteadOfExhaustiveWhen
* Improve rule descriptions
* Suppress rule for outdated documentation method
* Not report sealed class subjects that have an expect modifier
* Fix sample code syntax and not compile mulitplatform code
* Simplify AnnotationExcluderSpec
* Improve tests
* Improve tests
* Fix FullQualifiedNameGuesser
* Allow List<Regex> inside AnnotationExcluder to give more options to the callers
* Test with and without type-solving
* Make AnnotationExcluder use the BindingContext when available
* AnnotationSuppressor works with Full Qualified names without type solving
* Address PR comments
* Update detekt-psi-utils/src/test/kotlin/io/github/detekt/psi/internal/FullQualifiedNameGuesserSpec.kt
Co-authored-by: M Schalk <30376729+schalkms@users.noreply.github.com>
* Support star imports
* Improve readability
Co-authored-by: M Schalk <30376729+schalkms@users.noreply.github.com>
* Migrate tests in detekt-rules-errorprone to junit
* change names of classes and function that may be a problem on windows
* WIP: remove test class that is causing issues
* re-add IgnoredReturnValueSpec.kt
* Fix merge
Co-authored-by: Markus Schwarz <post@markus-schwarz.net>
* Implement FullQualifiedNameGuesser
* Remove bad test
* Refactor tests
* Fix AnnotationExcluder
* More exhaustive list of default import classes
* Handle PR comments
* Created rule for when a null-check is performed on a mutable property
* Fixed Detekt issue
* Added tests to improve code coverage
* Fixed Detekt issues
* Rule will now only fire when the candidate variable is actually referenced within the if-expression block; Moved all relevant inspection code to within a private class to ensure resource cleanup after visiting a Kotlin file
* Consolidated null-checking on candidateFqName
* More consolidation within visitIfExpression; Fixed Detekt issue in NullCheckOnMutablePropertySpec
* Switch to interface type specification in declaration of candidateProperties
* Added checks for multi-clause if-expressions
* Fixed Detekt issue
* Added check for val properties that have getters that return potentially-nullable values
* Address Detekt issue
* Fix failures in test compilation
* Simplified check on getter - will now only report if a val property possesses a getter
* Addressing PR comments
* Fixed typo
* Add missing tests
* Add AnnotationSuppressor
* Use ignoreAnnotated instead of the custom ones from our rules
* Rename LongParameter.ignoreAnnotated to not clash with the general suppression
This will help reduce build times when changes are made to the precompiled
script plugins used in the build. This is because a change in buildSrc
causes the whole project to become out-of-date [0]. Using an included build
instead works around this problem.
[0] https://docs.gradle.org/7.2/userguide/organizing_gradle_projects.html#sec:build_sources
* move ConfigProperty to public api
* add config to api
* use config property in example rule
* remove ThresholdRule from extension guide
* mark LazyRegex as deprecated
* suppress deprecation warning
Co-authored-by: Markus Schwarz <post@markus-schwarz.net>