* migrate tests in detekt-metrics to junit
* fix compiler warning about possible problems on windows
Co-authored-by: Markus Schwarz <post@markus-schwarz.net>
* Include custom get/set operators to ExplicitCollectionElementAccessMethod rule
This actually simplifies code, since any get/set operator can be treated the same; no need to look up type names. `Map.put()` is a type-specific edge case, which can be replaced by `set`, and thus indexed access, when the return value is not needed.
Right now, no check is done whether the return value is use. For both `set` and `put` no code smell should be reported if this is the case.
* Fix#4122: false positive ExplicitCollectionElementAccessMethod for used return values
* Fix new issues raised due to more exhaustive ExplicitElementAccessMethod
Also fixed other tests that were failing on build server.
* Additional edge case tests for ExplicitCollectionElementAccessMethod
This also includes an early out in case types can't be resolved, rather than iterating over supertypes.
* ExplicitCollectionElementAccessMethod rule requires types resolution
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
* Enable UnnecessaryLet rule for detekt code base
* baseline parser does not work with new lines
* replace let with private extension function to improve readability
Co-authored-by: Markus Schwarz <post@markus-schwarz.net>
* enable those rules from the style rule set that have not violation or obvious fixes
* Enable UseIfEmptyOrIfBlank
Co-authored-by: Markus Schwarz <post@markus-schwarz.net>
* Rename Tests to Spec
* Rename DetektMultiplatformSpecTest to Spec
* Use Spek memoization when declaring non trivial types
* Use Spek memoization when declaring non trivial types
* Apply correct code formatting
* Apply correct indentation
* Update Byte Buddy
This transitive dependency of mockk is updated to a version that supports
Java 16
* Skip Android tests on JDK 16+
Required until a compatible version of Android Gradle Plugin is released.
* Build & test on Java 16
* Update Kotlin to 1.5
* Add workaround for Kotlin 1.5 memory leak in Gradle
* API changes
* Don't treat warnings as errors on the detekt-gradle-plugin module
* Update Kotlin to 1.4.20
* Update assertj to 3.18.1
* Fix type V but V!! expected compilation errors with 1.4.20
* Remove workaround for old dokka plugin
* Update to Kotlin 1.4.21
* Use jdk8 compatible mockk version
* Update mock to version 1.10.4
* Specify source and target 1.8 java version for KotlinCompile tasks
* Remove shadowJarExecutable as it does not work with newest Kotlin compiler (1.4.20+)
* Simplify copying jars for CI by reusing copy task
* Update cli guide to always use the zip distribution
* fixup! Simplify copying jars for CI by reusing copy task
Co-authored-by: M Schalk <30376729+schalkms@users.noreply.github.com>
* Report redundant internal modifier on declarations in private or local objects and classes
* Enable RedundantVisibilityModifierRule for detekt self-scans
* Use simpler test example
Co-authored-by: Nicola Corti <corti.nico@gmail.com>
Co-authored-by: Nicola Corti <corti.nico@gmail.com>
* Fix unsafe call issues or use cleaner preconditions
* Run detekt with type resolution analysis on CI
* Update detekt-test/src/main/kotlin/io/gitlab/arturbosch/detekt/test/FindingsAssertions.kt
* Run detekt with type resolution analysis on CI
* Let detekt run only in separate CI job
* Revert change to open; instead suppress issue
* Use max 4 workers, test discovery slows down parallel workers
* Use a spek snapshot to improve test discovery time
* Introduce an api test fixture for modules needing just an analysis result
* Use api test fixture in html module
* Use api test fixtures in report-xml module
* Use api test fixtures in metrics module
* Use api test fixtures in core module
* Use single-threaded classpath scanning
* Do not create a kotlin environment upfront
* Move mockk usage to execution phase
* Move KtCompiler creation to execution phase
* Move setup code to execution phase in api module
* Move setup code to execution phase in core module
* Move setup code to execution phase in rules-empty module
* Introduce binding context aware members for FileProcessListener
* Use FileProcessListener with binding context everywhere
* Move deprecation on function level
* Move xml report to own module
* Extract common complexity report logic to metrics module
This allows to share complexity report logic between the console report and a report-html module.
* Move whichXXX functions from DebugUtils to api module for now
More modules use the detekt version at runtime
and it is nice to have it in plugins as the IntelliJ or Sonar plugin. We should later move this helpers to the tooling-api.
* Extract html report to own module
* Merge all service files when packaging cli fatJar
* Write the detekt version to all jar manifest files
This allows to retrieve the detekt version from any jar at runtime.
* Extract txt report to own module
* Extract KtCompiler to detekt-parser preparing a minimal test utils module
* Fix potential memory leak in tests not closing settings
* Move parsing and generic test utils to own module
* Do not depend on test module for metrics, gradle plugin and generator modules
* Exclude test-utils from coverage report as we do with test module
* Explicitly depend on core-module in tests
* Create new metrics module
* Move lines of code an cyclomatic complexity to metrics module
* Implement cognitive complexity part 1
* Implement cognitive complexity part 2
* Implement cognitive complexity part 3
* Implement cognitive complexity part 4
* Remove trimming to make use of language in string functionality of IDEA