aboutsummaryrefslogtreecommitdiff
path: root/plugins/base
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/base')
-rw-r--r--plugins/base/src/main/kotlin/transformers/documentables/DeprecatedDocumentableFilterTransformer.kt2
-rw-r--r--plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt2
-rw-r--r--plugins/base/src/main/kotlin/transformers/documentables/ReportUndocumentedTransformer.kt4
-rw-r--r--plugins/base/src/test/kotlin/filter/DeprecationFilterTest.kt6
-rw-r--r--plugins/base/src/test/kotlin/transformers/ReportUndocumentedTransformerTest.kt14
-rw-r--r--plugins/base/src/test/kotlin/transformers/SuppressedDocumentableFilterTransformerTest.kt16
6 files changed, 23 insertions, 21 deletions
diff --git a/plugins/base/src/main/kotlin/transformers/documentables/DeprecatedDocumentableFilterTransformer.kt b/plugins/base/src/main/kotlin/transformers/documentables/DeprecatedDocumentableFilterTransformer.kt
index 80696cbf..0f7795e6 100644
--- a/plugins/base/src/main/kotlin/transformers/documentables/DeprecatedDocumentableFilterTransformer.kt
+++ b/plugins/base/src/main/kotlin/transformers/documentables/DeprecatedDocumentableFilterTransformer.kt
@@ -24,7 +24,7 @@ class DeprecatedDocumentableFilterTransformer(val context: DokkaContext) : PreMe
fun <T> T.isAllowedInPackage(): Boolean where T : WithExtraProperties<T>, T : Documentable {
val packageName = this.dri.packageName
val condition = packageName != null && packageOptions.firstOrNull {
- packageName.startsWith(it.prefix)
+ Regex(it.matchingRegex).matches(packageName)
}?.skipDeprecated
?: globalOptions.skipDeprecated
diff --git a/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt b/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt
index 57faeefb..1bc7a533 100644
--- a/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt
+++ b/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt
@@ -23,7 +23,7 @@ class DocumentableVisibilityFilterTransformer(val context: DokkaContext) : PreMe
is JavaVisibility.Default,
is KotlinVisibility.Public -> true
else -> packageName != null
- && packageOptions.firstOrNull { packageName.startsWith(it.prefix) }?.includeNonPublic
+ && packageOptions.firstOrNull { Regex(it.matchingRegex).matches(packageName) }?.includeNonPublic
?: globalOptions.includeNonPublic
}
diff --git a/plugins/base/src/main/kotlin/transformers/documentables/ReportUndocumentedTransformer.kt b/plugins/base/src/main/kotlin/transformers/documentables/ReportUndocumentedTransformer.kt
index 2608d9ba..a8fabc95 100644
--- a/plugins/base/src/main/kotlin/transformers/documentables/ReportUndocumentedTransformer.kt
+++ b/plugins/base/src/main/kotlin/transformers/documentables/ReportUndocumentedTransformer.kt
@@ -158,7 +158,7 @@ internal class ReportUndocumentedTransformer : DocumentableTransformer {
): DokkaConfiguration.PackageOptions? {
val packageName = documentable.dri.packageName ?: return null
return dokkaSourceSet.perPackageOptions
- .filter { packageOptions -> packageName.startsWith(packageOptions.prefix) }
- .maxBy { packageOptions -> packageOptions.prefix.length }
+ .filter { packageOptions -> Regex(packageOptions.matchingRegex).matches(packageName) }
+ .maxBy { packageOptions -> packageOptions.matchingRegex.length }
}
}
diff --git a/plugins/base/src/test/kotlin/filter/DeprecationFilterTest.kt b/plugins/base/src/test/kotlin/filter/DeprecationFilterTest.kt
index c8b9f2d4..b90b02af 100644
--- a/plugins/base/src/test/kotlin/filter/DeprecationFilterTest.kt
+++ b/plugins/base/src/test/kotlin/filter/DeprecationFilterTest.kt
@@ -104,11 +104,13 @@ class DeprecationFilterTest : AbstractCoreTest() {
sourceRoots = listOf("src/main/kotlin/basic/Test.kt")
skipDeprecated = false
perPackageOptions = mutableListOf(
- PackageOptionsImpl("example",
+ PackageOptionsImpl(
+ "example.*",
true,
false,
true,
- false)
+ false
+ )
)
}
}
diff --git a/plugins/base/src/test/kotlin/transformers/ReportUndocumentedTransformerTest.kt b/plugins/base/src/test/kotlin/transformers/ReportUndocumentedTransformerTest.kt
index 265baa42..a87a8e7f 100644
--- a/plugins/base/src/test/kotlin/transformers/ReportUndocumentedTransformerTest.kt
+++ b/plugins/base/src/test/kotlin/transformers/ReportUndocumentedTransformerTest.kt
@@ -380,7 +380,7 @@ class ReportUndocumentedTransformerTest : AbstractCoreTest() {
sourceSets {
sourceSet {
perPackageOptions += packageOptions(
- prefix = "sample",
+ matchingRegex = "sample.*",
reportUndocumented = true,
)
reportUndocumented = false
@@ -410,11 +410,11 @@ class ReportUndocumentedTransformerTest : AbstractCoreTest() {
sourceSets {
sourceSet {
perPackageOptions += packageOptions(
- prefix = "sample",
+ matchingRegex = "sample.*",
reportUndocumented = false,
)
perPackageOptions += packageOptions(
- prefix = "sample.enabled",
+ matchingRegex = "sample.enabled.*",
reportUndocumented = true,
)
reportUndocumented = false
@@ -448,11 +448,11 @@ class ReportUndocumentedTransformerTest : AbstractCoreTest() {
sourceSets {
sourceSet {
perPackageOptions += packageOptions(
- prefix = "sample",
+ matchingRegex = "sample.*",
reportUndocumented = true,
)
perPackageOptions += packageOptions(
- prefix = "sample.disabled",
+ matchingRegex = "sample.disabled.*",
reportUndocumented = false,
)
reportUndocumented = true
@@ -904,13 +904,13 @@ class ReportUndocumentedTransformerTest : AbstractCoreTest() {
}
private fun packageOptions(
- prefix: String,
+ matchingRegex: String,
reportUndocumented: Boolean?,
includeNonPublic: Boolean = true,
skipDeprecated: Boolean = false,
suppress: Boolean = false
) = PackageOptionsImpl(
- prefix = prefix,
+ matchingRegex = matchingRegex,
reportUndocumented = reportUndocumented,
includeNonPublic = includeNonPublic,
skipDeprecated = skipDeprecated,
diff --git a/plugins/base/src/test/kotlin/transformers/SuppressedDocumentableFilterTransformerTest.kt b/plugins/base/src/test/kotlin/transformers/SuppressedDocumentableFilterTransformerTest.kt
index 93b36d2e..a4ce9230 100644
--- a/plugins/base/src/test/kotlin/transformers/SuppressedDocumentableFilterTransformerTest.kt
+++ b/plugins/base/src/test/kotlin/transformers/SuppressedDocumentableFilterTransformerTest.kt
@@ -16,8 +16,8 @@ class SuppressedDocumentableFilterTransformerTest : AbstractCoreTest() {
sourceSet {
sourceRoots = listOf("src")
perPackageOptions = listOf(
- packageOptions(prefix = "suppressed", suppress = true),
- packageOptions(prefix = "default", suppress = false)
+ packageOptions(matchingRegex = "suppressed.*", suppress = true),
+ packageOptions(matchingRegex = "default.*", suppress = false)
)
}
}
@@ -57,11 +57,11 @@ class SuppressedDocumentableFilterTransformerTest : AbstractCoreTest() {
sourceSet {
sourceRoots = listOf("src")
perPackageOptions = listOf(
- packageOptions(prefix = "parent.some", suppress = false),
- packageOptions(prefix = "parent.some.suppressed", suppress = true),
+ packageOptions(matchingRegex = "parent.some.*", suppress = false),
+ packageOptions(matchingRegex = "parent.some.suppressed.*", suppress = true),
- packageOptions(prefix = "parent.other", suppress = true),
- packageOptions(prefix = "parent.other.default", suppress = false)
+ packageOptions(matchingRegex = "parent.other.*", suppress = true),
+ packageOptions(matchingRegex = "parent.other.default.*", suppress = false)
)
}
}
@@ -175,10 +175,10 @@ class SuppressedDocumentableFilterTransformerTest : AbstractCoreTest() {
}
private fun packageOptions(
- prefix: String,
+ matchingRegex: String,
suppress: Boolean
) = PackageOptionsImpl(
- prefix = prefix,
+ matchingRegex = matchingRegex,
suppress = suppress,
includeNonPublic = true,
reportUndocumented = false,