diff options
author | Marcin Aman <marcin.aman@gmail.com> | 2021-03-01 13:50:17 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-01 13:50:17 +0100 |
commit | 7cf644f064868934fe8dcb46ab150f25fab8e8c8 (patch) | |
tree | 30d97e4cdaa6017401e7780bd86471f93d6f4d08 /plugins/base/src/main/kotlin/transformers/documentables | |
parent | ab853a866c40771e84a3235f40575efe04c435c5 (diff) | |
download | dokka-7cf644f064868934fe8dcb46ab150f25fab8e8c8.tar.gz dokka-7cf644f064868934fe8dcb46ab150f25fab8e8c8.tar.bz2 dokka-7cf644f064868934fe8dcb46ab150f25fab8e8c8.zip |
Add ability to suppress obvious functions like equals, toString... (#1758)
* Add ability to suppress obvious functions like equals, toString...
* Add ability to suppress obvious functions like equals, toString...
Diffstat (limited to 'plugins/base/src/main/kotlin/transformers/documentables')
-rw-r--r-- | plugins/base/src/main/kotlin/transformers/documentables/ObviousFunctionsDocumentableFilterTransformer.kt | 11 | ||||
-rw-r--r-- | plugins/base/src/main/kotlin/transformers/documentables/SuppressTagDocumentableFilter.kt | 2 | ||||
-rw-r--r-- | plugins/base/src/main/kotlin/transformers/documentables/SuppressedByConditionDocumentableFilterTransformer.kt (renamed from plugins/base/src/main/kotlin/transformers/documentables/SuppressedByTagDocumentableFilterTransformer.kt) | 2 |
3 files changed, 13 insertions, 2 deletions
diff --git a/plugins/base/src/main/kotlin/transformers/documentables/ObviousFunctionsDocumentableFilterTransformer.kt b/plugins/base/src/main/kotlin/transformers/documentables/ObviousFunctionsDocumentableFilterTransformer.kt new file mode 100644 index 00000000..57d7268e --- /dev/null +++ b/plugins/base/src/main/kotlin/transformers/documentables/ObviousFunctionsDocumentableFilterTransformer.kt @@ -0,0 +1,11 @@ +package org.jetbrains.dokka.base.transformers.documentables + +import org.jetbrains.dokka.model.DFunction +import org.jetbrains.dokka.model.Documentable +import org.jetbrains.dokka.model.ObviousMember +import org.jetbrains.dokka.plugability.DokkaContext + +class ObviousFunctionsDocumentableFilterTransformer(context: DokkaContext) : SuppressedByConditionDocumentableFilterTransformer(context) { + override fun shouldBeSuppressed(d: Documentable): Boolean = + context.configuration.suppressObviousFunctions && d is DFunction && d.extra[ObviousMember] != null +}
\ No newline at end of file diff --git a/plugins/base/src/main/kotlin/transformers/documentables/SuppressTagDocumentableFilter.kt b/plugins/base/src/main/kotlin/transformers/documentables/SuppressTagDocumentableFilter.kt index 7efb23ab..a297908d 100644 --- a/plugins/base/src/main/kotlin/transformers/documentables/SuppressTagDocumentableFilter.kt +++ b/plugins/base/src/main/kotlin/transformers/documentables/SuppressTagDocumentableFilter.kt @@ -6,7 +6,7 @@ import org.jetbrains.dokka.plugability.DokkaContext import org.jetbrains.dokka.model.doc.Suppress class SuppressTagDocumentableFilter(val dokkaContext: DokkaContext) : - SuppressedByTagDocumentableFilterTransformer(dokkaContext) { + SuppressedByConditionDocumentableFilterTransformer(dokkaContext) { override fun shouldBeSuppressed(d: Documentable): Boolean = d.documentation.any { (_, docs) -> docs.dfs { it is Suppress } != null } }
\ No newline at end of file diff --git a/plugins/base/src/main/kotlin/transformers/documentables/SuppressedByTagDocumentableFilterTransformer.kt b/plugins/base/src/main/kotlin/transformers/documentables/SuppressedByConditionDocumentableFilterTransformer.kt index f40abe70..b0bdd4b7 100644 --- a/plugins/base/src/main/kotlin/transformers/documentables/SuppressedByTagDocumentableFilterTransformer.kt +++ b/plugins/base/src/main/kotlin/transformers/documentables/SuppressedByConditionDocumentableFilterTransformer.kt @@ -4,7 +4,7 @@ import org.jetbrains.dokka.model.* import org.jetbrains.dokka.plugability.DokkaContext import org.jetbrains.dokka.transformers.documentation.PreMergeDocumentableTransformer -abstract class SuppressedByTagDocumentableFilterTransformer(val context: DokkaContext) : PreMergeDocumentableTransformer { +abstract class SuppressedByConditionDocumentableFilterTransformer(val context: DokkaContext) : PreMergeDocumentableTransformer { override fun invoke(modules: List<DModule>): List<DModule> = modules.map { module -> val (documentable, wasChanged) = processModule(module) |