This product is not supported for your selected Datadog site. ().
Metadata
ID:kotlin-code-style/no-single-line-block-comment
Language: Kotlin
Severity: Notice
Category: Code Style
Description
This rule flags single-line block comments (/* ... */) that could be more appropriately replaced by end-of-line (EOL) comments (// ...). A violation occurs when a block comment starts and ends on the same line and is followed only by whitespace until the end of the line. While syntactically valid, using /* ... */ for such cases can be less clear, potentially misleading developers into thinking it’s part of a larger multi-line comment block.
How to remediate
To fix this, replace the single-line block comment with an end-of-line comment. For example, change /* Some comment */ to // Some comment. This improves code readability and aligns with common Kotlin style guidelines where // is used for concise, single-line explanations and /* */ is reserved for multi-line documentation or temporarily disabling code blocks.
Non-Compliant Code Examples
/* Some comment */valfoo="foo"/* Some comment */
Compliant Code Examples
/*
* Some comment
*/valfoo="foo"// Some comment
valfoo={/* no-op */}/** Documentation */valfoo="foo"
Seamless integrations. Try Datadog Code Security
Datadog Code Security
Try this rule and analyze your code with Datadog Code Security
How to use this rule
1
2
rulesets:- kotlin-code-style # Rules to enforce Kotlin code style.
Create a static-analysis.datadog.yml with the content above at the root of your repository
Use our free IDE Plugins or add Code Security scans to your CI pipelines