25 Commits

Author SHA1 Message Date
Marie Katrine Ekeberg
a949686e71 Add new rule CouldBeSequence (#4855)
* Add new rule CouldBeSequence

* Add test case for CouldBeSequence

* Fix inconsistency in compliant example for CoudlBeSequence
2022-06-01 10:59:46 +02:00
Brais Gabín
a2734b18c1 Remove Unnecesary @Nested (#4740) 2022-04-25 23:04:26 +02:00
renovate[bot]
ed8b0890c3 Update org.jetbrains.kotlin to v1.6.20 (#4665)
* Update org.jetbrains.kotlin to v1.6.20

* Replace non-exhaustive when with boolean expression

* Replace deprecated imports

* Use -opt-in instead of deprecated -Xopt-in

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Matthew Haughton <3flex@users.noreply.github.com>
2022-04-07 08:54:51 +10:00
Stieglitz
14c0f11e44 Bump KtLint to 0.44.0 and add UnnecessaryParenthesesBeforeTrailingLamda rule (#4630)
* Bump KtLint to 0.44.0 and add UnnecessaryParenthesesBeforeTrailingLambda rule

* implement new RunAsLateAsPossible and RunOnRootNodeOnly annotations

* use internal ruleShouldOnlyRunOnFileNode method

* revoke line wrap

* fix indentation errors

* deprecate indentSize in ParameterListWrapping.kt

* implement microutilsKotlinLoggingJvm and fake EDITOR_CONFIG_USER_DATA_KEY

* remove duplicate
2022-03-19 12:59:56 +01:00
Matthew Haughton
7126e4ba3e Migrate detekt-rules-performance tests to JUnit (#4569) 2022-02-07 21:49:00 +01:00
severn-everett
27205a13f8 Extend CanBeNonNullable rule to check function params (#4431) 2022-01-12 09:54:37 +00:00
M Schalk
16b8920e60 Formulate rule/performance descriptions consistently (#4411)
reference #4384
2021-12-28 02:14:47 +01:00
M Schalk
4b88d3177b Improve test description in ForEachOnRangeSpec.kt (#4402) 2021-12-27 14:44:58 +11:00
Matthew Haughton
56471bf50a Simplify conditional checks to improve coverage (#4221) 2021-11-01 20:11:19 +11:00
Matthew Haughton
7d46753d24 Fix typos and grammar in rule descriptions (#4219) 2021-10-31 21:58:35 -07:00
Matthew Haughton
897961d6d7 Update Kotlin docs URL (#4217) 2021-10-31 21:56:25 -07:00
Matthew Haughton
3e1d7c350d Drop junit-platform-launcher dependency (#4115)
Modern versions of IntelliJ and Gradle do not require this explicit
dependency to be added to the project.
2021-09-20 11:50:35 +10:00
Matthew Haughton
e0aed91293 Remove detekt-bom module (#4043) 2021-09-11 07:27:16 +10:00
Matthew Haughton
fd0cb9096e Migrate buildSrc to composite build (#4090)
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
2021-09-04 23:09:59 +10:00
Matthew Haughton
dc2f3d801c Enable Gradle's type-safe project accessors (#3742) 2021-05-06 20:59:44 +02:00
marschwar
36edd4c528 Replace @active KDoc tag with @ActiveByDefault annotation (#3592)
* Add @ActiveByDefault annotation

* Add support for @ActiveByDefault annotation

* Use annotation for all activated in v1.2.0

* Use annotation for all activated after v1.2.0

* Use annotation for all activated in v1.0.0

* Update documentation with regard to RuleSetProvider

* Update documentation

* Remove leading 'v' from version in annotation

* Use named parameter 'since' for @ActiveByDefault

* check version matches semantic version pattern.

* Fix typo and correct version format

* Fix merge errors

Co-authored-by: Markus Schwarz <post@markus-schwarz.net>
Co-authored-by: Chao Zhang <zhangchao6865@gmail.com>
2021-03-28 11:21:09 -07:00
Brais Gabín
92b6a01903 Apply more formatting rules to our code (#3615)
* Update formatting configuration

* Apply autocorrect to the project

* Format using ktlint 0.41 --experimental

* Minor manual improvements
2021-03-28 10:00:03 -07:00
marschwar
7c4a690014 Replace @requiresTypeResolution kdoc tag with @RequiresTypeResolution annotation (#3579)
* Change indentation according to ktlint

* Add test case to verify requiresTypeResolution flag

* Add RequiresTypeResolution annotation

* Generate documentation based on RequiresTypeResolution annotation

* Use @RequiresTypeResolution instead of kdoc tag

* Update documentation for @RequiresTypeResolution

* Remove support for @requiresTypeResolution kdoc tag

* Add @RequiresTypeResolution to public api

* Move extension functions to separate files

* Remove @RequiresOptIn from public api

* Update annotation comment

Co-authored-by: Markus Schwarz <post@markus-schwarz.net>
2021-03-26 22:33:53 -07:00
Brais Gabín
945f075af1 Simplify our buildSrc (#3322)
* Move cli gradle configuration to its build.gradle.kts

* Create plugin module so we can add it to each module
2021-01-05 00:06:10 +01:00
M Schalk
2a2d756b53 Remove unnecessary .trimIndent() - housekeeping (#3307)
This statement only added noise to the test specification.
2020-12-19 23:51:58 +01:00
M Schalk
8925065569 Remove Suppress annotation from ArrayPrimitive (#3209)
* Remove Suppress annotation from ArrayPrimitive

* Use more descriptive method structure
2020-11-09 17:24:11 +01:00
Artur Bosch
d0734523bb Do not report vararg arguments which are just passed to a vararg parameter (#3157)
* Do not report vararg parameters which are passed as vararg arguments as they do not create an array copy as of Kotlin 1.1  - Closes #3145

* State that spread operator may lead to a performance penalty not that it must

* Do not report vararg pass through arguments for non type resolution case - Closes #3145

* Exclude guard clauses for ReturnCount
2020-10-20 12:35:15 +02:00
Matthew Haughton
be9bc2469b New rule: ClassOrdering (#3088)
* Add ClassOrdering rule
* Enable ClassOrdering rule in detekt
2020-09-20 11:37:40 +10:00
Toshiaki Kameyama
e036abeb83 ArrayPrimitive rule: report variable/receiver types and factory methods (#3009)
* ArrayPrimitive rule: report variable/receiver types and factory methods

* Use compileAndLintWithContext

* Add @requiresTypeResolution to KDoc

* Report emptyArray<Primitive>()

* Also report Boolean

* Fix typo

* Execute generateDocumentation

* Revert `@active since v1.2.0`
2020-08-25 17:36:33 +02:00
Artur Bosch
b6e88a95a1 Split rules module into a module per rule set (#2865)
* Split rules module into a module per rule set

This significantly improves build and test times.

* Directly instantiate a kotlin scripting engine
2020-07-13 19:26:57 +02:00