Metadata

ID: kotlin-code-style/double-colon-spacing

Language: Kotlin

Severity: Notice

Category: Code Style

Description

In callable references, there should be no spaces separating the class, instance, method, or property from the double colons (::).

An expression like List::filter is correct, while List :: filter is not.

Non-Compliant Code Examples

val clz1 = Foo ::class
val clz2 = Foo:: class
val clz3 = Foo :: class

val filter1 = List ::filter
val filter2 = List:: filter
val filter3 = List :: filter

val constr = :: Regex

Compliant Code Examples

val filter = List::filter
val clz = Foo::class
val constr = ::Regex
https://static.datadoghq.com/static/images/logos/github_avatar.svg https://static.datadoghq.com/static/images/logos/vscode_avatar.svg jetbrains

Seamless integrations. Try Datadog Code Security

PREVIEWING: guillaume.barrier/ERRORT-5095-general-doc-update