mirror of
https://github.com/jlengrand/detekt.git
synced 2026-03-10 08:11:23 +00:00
Update Kotlin docs URL (#4217)
This commit is contained in:
@@ -35,7 +35,7 @@ import org.jetbrains.kotlin.psi.KtWhenExpression
|
||||
* - __Operators__ `&&`, `||`, `?:`
|
||||
* - __Exceptions__ - `catch`, `use`
|
||||
* - __Scope Functions__ - `let`, `run`, `with`, `apply`, and `also` ->
|
||||
* [Reference](https://kotlinlang.org/docs/reference/scope-functions.html)
|
||||
* [Reference](https://kotlinlang.org/docs/scope-functions.html)
|
||||
*/
|
||||
@ActiveByDefault(since = "1.0.0")
|
||||
class ComplexMethod(config: Config = Config.empty) : Rule(config) {
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.jetbrains.kotlin.types.typeUtil.supertypes
|
||||
* returns a `Flow`, should not have any side effects. Only once collection begins against the
|
||||
* returned `Flow`, should work actually be done.
|
||||
*
|
||||
* See https://kotlinlang.org/docs/reference/coroutines/flow.html#flows-are-cold
|
||||
* See https://kotlinlang.org/docs/flow.html#flows-are-cold
|
||||
*
|
||||
* <noncompliant>
|
||||
* suspend fun observeSignals(): Flow<Unit> {
|
||||
|
||||
@@ -19,8 +19,8 @@ import org.jetbrains.kotlin.types.typeUtil.supertypes
|
||||
* mutable information about a specific exception or error. Hence, global singleton `Throwables`
|
||||
* should be avoided.
|
||||
*
|
||||
* See https://kotlinlang.org/docs/reference/object-declarations.html#object-declarations
|
||||
* See https://kotlinlang.org/docs/reference/object-declarations.html#companion-objects
|
||||
* See https://kotlinlang.org/docs/object-declarations.html#object-declarations-overview
|
||||
* See https://kotlinlang.org/docs/object-declarations.html#companion-objects
|
||||
*
|
||||
* <noncompliant>
|
||||
* object InvalidCredentialsException : Throwable()
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.jetbrains.kotlin.psi.psiUtil.isPrivate
|
||||
* The name of the file should describe what the code in the file does.
|
||||
* Therefore, you should avoid using meaningless words such as "Util" in file names." - Official Kotlin Style Guide
|
||||
*
|
||||
* More information at: http://kotlinlang.org/docs/reference/coding-conventions.html
|
||||
* More information at: https://kotlinlang.org/docs/coding-conventions.html
|
||||
*
|
||||
* <noncompliant>
|
||||
*
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameOrNull
|
||||
* Using Array<Primitive> leads to implicit boxing and performance hit. Prefer using Kotlin specialized Array
|
||||
* Instances.
|
||||
*
|
||||
* As stated in the Kotlin [documentation](https://kotlinlang.org/docs/reference/basic-types.html#arrays) Kotlin has
|
||||
* As stated in the Kotlin [documentation](https://kotlinlang.org/docs/basic-types.html#arrays) Kotlin has
|
||||
* specialized arrays to represent primitive types without boxing overhead, such as `IntArray`, `ByteArray` and so on.
|
||||
*
|
||||
* <noncompliant>
|
||||
|
||||
@@ -17,7 +17,7 @@ import org.jetbrains.kotlin.psi.KtSecondaryConstructor
|
||||
|
||||
/**
|
||||
* This rule ensures class contents are ordered as follows as recommended by the Kotlin
|
||||
* [Coding Conventions](https://kotlinlang.org/docs/reference/coding-conventions.html#class-layout):
|
||||
* [Coding Conventions](https://kotlinlang.org/docs/coding-conventions.html#class-layout):
|
||||
* - Property declarations and initializer blocks
|
||||
* - Secondary constructors
|
||||
* - Method declarations
|
||||
|
||||
@@ -19,7 +19,7 @@ import org.jetbrains.kotlin.resolve.checkers.ExplicitApiDeclarationChecker
|
||||
* Functions/properties exposed as public APIs of a library should have an explicit return type.
|
||||
* Inferred return type can easily be changed by mistake which may lead to breaking changes.
|
||||
*
|
||||
* See also: [Kotlin 1.4 Explicit API](https://kotlinlang.org/docs/reference/whatsnew14.html#explicit-api-mode-for-library-authors)
|
||||
* See also: [Kotlin 1.4 Explicit API](https://kotlinlang.org/docs/whatsnew14.html#explicit-api-mode-for-library-authors)
|
||||
*
|
||||
* <noncompliant>
|
||||
* // code from a library
|
||||
|
||||
@@ -41,7 +41,7 @@ import org.jetbrains.kotlin.psi.psiUtil.allChildren
|
||||
|
||||
/**
|
||||
* This rule reports cases in the code where modifiers are not in the correct order. The default modifier order is
|
||||
* taken from: http://kotlinlang.org/docs/reference/coding-conventions.html#modifiers
|
||||
* taken from: https://kotlinlang.org/docs/coding-conventions.html#modifiers-order
|
||||
*
|
||||
* <noncompliant>
|
||||
* lateinit internal val str: String
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.jetbrains.kotlin.psi.psiUtil.isPrivate
|
||||
* This rule checks for redundant visibility modifiers.
|
||||
|
||||
* One exemption is the
|
||||
* [explicit API mode](https://kotlinlang.org/docs/reference/whatsnew14.html#explicit-api-mode-for-library-authors)
|
||||
* [explicit API mode](https://kotlinlang.org/docs/whatsnew14.html#explicit-api-mode-for-library-authors)
|
||||
* In this mode, the visibility modifier should be defined explicitly even if it is public.
|
||||
* Hence, the rule ignores the visibility modifiers in explicit API mode.
|
||||
*
|
||||
@@ -66,7 +66,7 @@ class RedundantVisibilityModifierRule(config: Config = Config.empty) : Rule(conf
|
||||
* Explicit API mode was added in Kotlin 1.4
|
||||
* It prevents libraries' authors from making APIs public unintentionally.
|
||||
* In this mode, the visibility modifier should be defined explicitly even if it is public.
|
||||
* See: https://kotlinlang.org/docs/reference/whatsnew14.html#explicit-api-mode-for-library-authors
|
||||
* See: https://kotlinlang.org/docs/whatsnew14.html#explicit-api-mode-for-library-authors
|
||||
*/
|
||||
private fun isExplicitApiModeActive(): Boolean {
|
||||
val resources = compilerResources ?: return false
|
||||
|
||||
@@ -16,7 +16,7 @@ import org.jetbrains.kotlin.psi.KtProperty
|
||||
/**
|
||||
* This rule inspects the use of the Annotation use-site Target. In case that the use-site Target is not needed it can
|
||||
* be removed. For more information check the kotlin documentation:
|
||||
* https://kotlinlang.org/docs/reference/annotations.html#annotation-use-site-targets
|
||||
* https://kotlinlang.org/docs/annotations.html#annotation-use-site-targets
|
||||
*
|
||||
* <noncompliant>
|
||||
* @@property:Inject private val foo: String = "bar" // violation: unnecessary @property:
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.jetbrains.kotlin.types.KotlinType
|
||||
* Classes that simply hold data should be refactored into a `data class`. Data classes are specialized to hold data
|
||||
* and generate `hashCode`, `equals` and `toString` implementations as well.
|
||||
*
|
||||
* Read more about `data class`: https://kotlinlang.org/docs/reference/data-classes.html
|
||||
* Read more about `data class`: https://kotlinlang.org/docs/data-classes.html
|
||||
*
|
||||
* <noncompliant>
|
||||
* class DataClassCandidate(val i: Int) {
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.jetbrains.kotlin.psi.KtWhenExpression
|
||||
/**
|
||||
* Binary expressions are better expressed using an `if` expression than a `when` expression.
|
||||
*
|
||||
* See https://kotlinlang.org/docs/reference/coding-conventions.html#if-versus-when
|
||||
* See https://kotlinlang.org/docs/coding-conventions.html#if-versus-when
|
||||
*
|
||||
* <noncompliant>
|
||||
* when (x) {
|
||||
|
||||
Reference in New Issue
Block a user