From 5afe512c669e68aea3712ac37b67d005657cf60a Mon Sep 17 00:00:00 2001 From: Marcin Aman Date: Tue, 6 Apr 2021 18:06:42 +0200 Subject: Suppress inherited members (#1814) --- plugins/base/src/main/kotlin/DokkaBase.kt | 11 +++++++---- .../InheritedEntriesDocumentableFilterTransformer.kt | 13 +++++++++++++ 2 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 plugins/base/src/main/kotlin/transformers/documentables/InheritedEntriesDocumentableFilterTransformer.kt (limited to 'plugins/base/src/main/kotlin') diff --git a/plugins/base/src/main/kotlin/DokkaBase.kt b/plugins/base/src/main/kotlin/DokkaBase.kt index d84207a5..0a18c3b1 100644 --- a/plugins/base/src/main/kotlin/DokkaBase.kt +++ b/plugins/base/src/main/kotlin/DokkaBase.kt @@ -82,6 +82,10 @@ class DokkaBase : DokkaPlugin() { preMergeDocumentableTransformer providing ::ObviousFunctionsDocumentableFilterTransformer } + val inheritedEntriesVisbilityFilter by extending { + preMergeDocumentableTransformer providing ::InheritedEntriesDocumentableFilterTransformer + } + val emptyPackagesFilter by extending { preMergeDocumentableTransformer providing ::EmptyPackagesFilterTransformer order { after( @@ -89,7 +93,8 @@ class DokkaBase : DokkaPlugin() { suppressedDocumentableFilter, documentableVisibilityFilter, suppressedBySuppressTagDocumentableFilter, - obviousFunctionsVisbilityFilter + obviousFunctionsVisbilityFilter, + inheritedEntriesVisbilityFilter, ) } } @@ -120,7 +125,6 @@ class DokkaBase : DokkaPlugin() { CoreExtensions.documentableTransformer with InheritorsExtractorTransformer() } - val undocumentedCodeReporter by extending { CoreExtensions.documentableTransformer with ReportUndocumentedTransformer() } @@ -163,7 +167,6 @@ class DokkaBase : DokkaPlugin() { CoreExtensions.renderer providing ::HtmlRenderer } - val defaultKotlinAnalysis by extending { kotlinAnalysis providing { ctx -> KotlinAnalysis(ctx.configuration.sourceSets, ctx.logger) } } @@ -246,4 +249,4 @@ class DokkaBase : DokkaPlugin() { val baseSearchbarDataInstaller by extending { htmlPreprocessors providing ::SearchbarDataInstaller order { after(sourceLinksTransformer) } } -} \ No newline at end of file +} diff --git a/plugins/base/src/main/kotlin/transformers/documentables/InheritedEntriesDocumentableFilterTransformer.kt b/plugins/base/src/main/kotlin/transformers/documentables/InheritedEntriesDocumentableFilterTransformer.kt new file mode 100644 index 00000000..a1b5052d --- /dev/null +++ b/plugins/base/src/main/kotlin/transformers/documentables/InheritedEntriesDocumentableFilterTransformer.kt @@ -0,0 +1,13 @@ +package org.jetbrains.dokka.base.transformers.documentables + +import org.jetbrains.dokka.model.* +import org.jetbrains.dokka.model.properties.WithExtraProperties +import org.jetbrains.dokka.plugability.DokkaContext + +class InheritedEntriesDocumentableFilterTransformer(context: DokkaContext) : + SuppressedByConditionDocumentableFilterTransformer(context) { + override fun shouldBeSuppressed(d: Documentable): Boolean = + context.configuration.suppressInheritedMembers && (d as? WithExtraProperties)?.extra?.get( + InheritedMember + )?.inheritedFrom?.any { entry -> entry.value != null } ?: false +} \ No newline at end of file -- cgit