diff options
author | ingo <ingo.kegel@ej-technologies.com> | 2016-01-05 23:44:52 +0100 |
---|---|---|
committer | ingo <ingo.kegel@ej-technologies.com> | 2016-01-06 00:12:58 +0100 |
commit | 97b5672ae2ef645c53e9c783dc494860a1eed800 (patch) | |
tree | dc1fdb116fcca724789bbab92b6be445ebf6ceb8 /core/src | |
parent | 556c71529248153014f9adc0865b1632a8c0436c (diff) | |
download | dokka-97b5672ae2ef645c53e9c783dc494860a1eed800.tar.gz dokka-97b5672ae2ef645c53e9c783dc494860a1eed800.tar.bz2 dokka-97b5672ae2ef645c53e9c783dc494860a1eed800.zip |
Annotating functions or classes `@Suppress("NOT_DOCUMENTED")` will suppress warnings about missing documentation
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/main/kotlin/Kotlin/DescriptorDocumentationParser.kt | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/core/src/main/kotlin/Kotlin/DescriptorDocumentationParser.kt b/core/src/main/kotlin/Kotlin/DescriptorDocumentationParser.kt index b7705ec9..8a15e9bf 100644 --- a/core/src/main/kotlin/Kotlin/DescriptorDocumentationParser.kt +++ b/core/src/main/kotlin/Kotlin/DescriptorDocumentationParser.kt @@ -19,6 +19,8 @@ import org.jetbrains.kotlin.psi.KtBlockExpression import org.jetbrains.kotlin.psi.KtDeclarationWithBody import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils import org.jetbrains.kotlin.resolve.DescriptorUtils +import org.jetbrains.kotlin.resolve.annotations.argumentValue +import org.jetbrains.kotlin.resolve.constants.StringValue import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter import org.jetbrains.kotlin.resolve.scopes.ResolutionScope import org.jetbrains.kotlin.resolve.scopes.getDescriptorsFiltered @@ -43,7 +45,7 @@ class DescriptorDocumentationParser if (kdoc == null) { if (options.reportUndocumented && !descriptor.isDeprecated() && descriptor !is ValueParameterDescriptor && descriptor !is TypeParameterDescriptor && - descriptor !is PropertyAccessorDescriptor) { + descriptor !is PropertyAccessorDescriptor && !descriptor.isSuppressWarning()) { logger.warn("No documentation for ${descriptor.signatureWithSourceLocation()}") } return Content.Empty to { node -> } @@ -75,6 +77,14 @@ class DescriptorDocumentationParser return content to { node -> } } + private fun DeclarationDescriptor.isSuppressWarning() : Boolean { + val suppressAnnotation = annotations.findAnnotation(FqName(Suppress::class.qualifiedName!!)) + return if (suppressAnnotation != null) { + @Suppress("UNCHECKED_CAST") + (suppressAnnotation.argumentValue("names") as List<StringValue>).any { it.value == "NOT_DOCUMENTED" } + } else containingDeclaration?.isSuppressWarning() ?: false + } + /** * Special case for generating stdlib documentation (the Any class to which the override chain will resolve * is not the same one as the Any class included in the source scope). |