aboutsummaryrefslogtreecommitdiff
path: root/src/Kotlin/DocumentationBuilder.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/Kotlin/DocumentationBuilder.kt')
-rw-r--r--src/Kotlin/DocumentationBuilder.kt11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/Kotlin/DocumentationBuilder.kt b/src/Kotlin/DocumentationBuilder.kt
index 2c4c5119..83e5898b 100644
--- a/src/Kotlin/DocumentationBuilder.kt
+++ b/src/Kotlin/DocumentationBuilder.kt
@@ -26,6 +26,7 @@ import org.jetbrains.kotlin.types.TypeProjection
import org.jetbrains.kotlin.types.expressions.OperatorConventions
public data class DocumentationOptions(val includeNonPublic: Boolean = false,
+ val reportUndocumented: Boolean = true,
val sourceLinks: List<SourceLinkDefinition>)
private fun isSamePackage(descriptor1: DeclarationDescriptor, descriptor2: DeclarationDescriptor): Boolean {
@@ -46,6 +47,11 @@ class DocumentationBuilder(val session: ResolveSession,
fun parseDocumentation(descriptor: DeclarationDescriptor): Content {
val kdoc = KDocFinder.findKDoc(descriptor)
if (kdoc == null) {
+ if (options.reportUndocumented && !descriptor.isDeprecated() &&
+ descriptor !is ValueParameterDescriptor && descriptor !is TypeParameterDescriptor &&
+ descriptor !is PropertyAccessorDescriptor) {
+ logger.warn("No documentation for ${descriptor.signature()}")
+ }
return Content.Empty
}
var kdocText = kdoc.getContent()
@@ -76,6 +82,10 @@ class DocumentationBuilder(val session: ResolveSession,
return content
}
+ fun DeclarationDescriptor.isDeprecated() = getAnnotations().any {
+ DescriptorUtils.getFqName(it.getType().getConstructor().getDeclarationDescriptor()).asString() == "kotlin.deprecated"
+ }
+
fun DeclarationDescriptor.signature(): String = when(this) {
is ClassDescriptor, is PackageFragmentDescriptor -> DescriptorUtils.getFqName(this).asString()
is PropertyDescriptor -> getContainingDeclaration().signature() + "#" + getName() + receiverSignature()
@@ -122,6 +132,7 @@ class DocumentationBuilder(val session: ResolveSession,
if ("/" in href) {
return ContentExternalLink(href)
}
+ logger.warn("Unresolved link to $href in doc comment of ${descriptor.signature()}")
return ContentExternalLink("#")
}