Skip to content

Commit

Permalink
remove unnecessary FunctionName suppressions, or move to targeted loc…
Browse files Browse the repository at this point in the history
…ation (not file-wide)
  • Loading branch information
aSemy committed Apr 23, 2023
1 parent ca45dbd commit 31fc16a
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 37 deletions.
15 changes: 8 additions & 7 deletions core/src/main/kotlin/configuration.kt
@@ -1,5 +1,3 @@
@file:Suppress("FunctionName")

package org.jetbrains.dokka

import org.jetbrains.dokka.utilities.cast
Expand Down Expand Up @@ -108,11 +106,13 @@ data class GlobalDokkaConfiguration(

fun DokkaConfiguration.apply(globals: GlobalDokkaConfiguration): DokkaConfiguration = this.apply {
sourceSets.forEach {
it.perPackageOptions.cast<MutableList<DokkaConfiguration.PackageOptions>>().addAll(globals.perPackageOptions ?: emptyList())
it.perPackageOptions.cast<MutableList<DokkaConfiguration.PackageOptions>>()
.addAll(globals.perPackageOptions ?: emptyList())
}

sourceSets.forEach {
it.externalDocumentationLinks.cast<MutableSet<DokkaConfiguration.ExternalDocumentationLink>>().addAll(globals.externalDocumentationLinks ?: emptyList())
it.externalDocumentationLinks.cast<MutableSet<DokkaConfiguration.ExternalDocumentationLink>>()
.addAll(globals.externalDocumentationLinks ?: emptyList())
}

sourceSets.forEach {
Expand Down Expand Up @@ -173,6 +173,7 @@ interface DokkaConfiguration : Serializable {
val dependentSourceSets: Set<DokkaSourceSetID>
val samples: Set<File>
val includes: Set<File>

@Deprecated(message = "Use [documentedVisibilities] property for a more flexible control over documented visibilities")
val includeNonPublic: Boolean
val reportUndocumented: Boolean
Expand Down Expand Up @@ -237,6 +238,7 @@ interface DokkaConfiguration : Serializable {

interface PackageOptions : Serializable {
val matchingRegex: String

@Deprecated("Use [documentedVisibilities] property for a more flexible control over documented visibilities")
val includeNonPublic: Boolean
val reportUndocumented: Boolean?
Expand All @@ -253,6 +255,7 @@ interface DokkaConfiguration : Serializable {
}
}

@Suppress("FunctionName")
fun ExternalDocumentationLink(
url: URL? = null,
packageListUrl: URL? = null
Expand All @@ -265,10 +268,8 @@ fun ExternalDocumentationLink(
throw IllegalArgumentException("url or url && packageListUrl must not be null for external documentation link")
}


@Suppress("FunctionName")
fun ExternalDocumentationLink(
url: String, packageListUrl: String? = null
): ExternalDocumentationLinkImpl =
ExternalDocumentationLink(url.let(::URL), packageListUrl?.let(::URL))


1 change: 0 additions & 1 deletion core/src/main/kotlin/defaultExternalLinks.kt
Expand Up @@ -27,4 +27,3 @@ fun ExternalDocumentationLink.Companion.androidX(): ExternalDocumentationLinkImp
url = URL("https://developer.android.com/reference/kotlin/"),
packageListUrl = URL("https://developer.android.com/reference/kotlin/androidx/package-list")
)

@@ -1,5 +1,3 @@
@file:Suppress("FunctionName")

package org.jetbrains.dokka.it.gradle

import org.gradle.testkit.runner.TaskOutcome
Expand Down Expand Up @@ -43,6 +41,7 @@ class ConfigurationTest(override val versions: BuildVersions) : AbstractGradleIn
* and `failOnWarning` are enabled - it should fail
*/
@Test
@Suppress("FunctionName")
fun `should fail with DokkaException and readable message if failOnWarning is triggered`() {
val result = createGradleRunner(
"-info",
Expand All @@ -58,7 +57,7 @@ class ConfigurationTest(override val versions: BuildVersions) : AbstractGradleIn
result.output.contains(
"""
FAILURE: Build failed with an exception\\.
\* What went wrong:
Execution failed for task ':dokkaHtml'\\.
> Failed with warningCount=\d and errorCount=\d
Expand Down
@@ -1,5 +1,3 @@
@file:Suppress("FunctionName")

package org.jetbrains.dokka.analysis

import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
Expand All @@ -9,6 +7,7 @@ import org.jetbrains.dokka.plugability.DokkaContext
import org.jetbrains.dokka.utilities.DokkaLogger
import java.io.Closeable

@Suppress("FunctionName")
fun ProjectKotlinAnalysis(
sourceSets: List<DokkaSourceSet>,
logger: DokkaLogger,
Expand All @@ -30,6 +29,7 @@ fun ProjectKotlinAnalysis(
* Usually the analysis created for samples is short-lived and can be closed right after
* it's been used, there's no need to wait for [projectKotlinAnalysis] to be closed as it must be handled separately.
*/
@Suppress("FunctionName")
fun SamplesKotlinAnalysis(
sourceSets: List<DokkaSourceSet>,
logger: DokkaLogger,
Expand All @@ -46,7 +46,7 @@ fun SamplesKotlinAnalysis(
sourceSet = sourceSet,
analysisConfiguration = analysisConfiguration
)
}
}

return EnvironmentKotlinAnalysis(environments, projectKotlinAnalysis)
}
Expand All @@ -59,13 +59,15 @@ class DokkaAnalysisConfiguration(
val ignoreCommonBuiltIns: Boolean = false
)

@Deprecated(message = "Construct using list of DokkaSourceSets and logger",
@Deprecated(
message = "Construct using list of DokkaSourceSets and logger",
replaceWith = ReplaceWith("KotlinAnalysis(context.configuration.sourceSets, context.logger)")
)
fun KotlinAnalysis(context: DokkaContext): KotlinAnalysis =
ProjectKotlinAnalysis(context.configuration.sourceSets, context.logger)

@Deprecated(message = "It was renamed to `ProjectKotlinAnalysis`",
@Deprecated(
message = "It was renamed to `ProjectKotlinAnalysis`",
replaceWith = ReplaceWith("ProjectKotlinAnalysis(sourceSets, logger, analysisConfiguration)")
)
fun KotlinAnalysis(
Expand All @@ -85,11 +87,13 @@ abstract class KotlinAnalysis(
operator fun get(key: DokkaSourceSet): AnalysisContext {
return get(key.sourceSetID)
}

operator fun get(key: DokkaSourceSetID): AnalysisContext {
return find(key)
?: parent?.get(key)
?: throw IllegalStateException("Missing EnvironmentAndFacade for sourceSet ${key}")
?: throw IllegalStateException("Missing EnvironmentAndFacade for sourceSet $key")
}

protected abstract fun find(sourceSetID: DokkaSourceSetID): AnalysisContext?
}

Expand All @@ -105,5 +109,3 @@ internal open class EnvironmentKotlinAnalysis(
environments.values.forEach(AnalysisContext::close)
}
}


@@ -1,5 +1,3 @@
@file:Suppress("FunctionName")

package org.jetbrains.dokka.base.parsers.moduleAndPackage

import org.jetbrains.dokka.analysis.DokkaResolutionFacade
Expand Down
@@ -1,5 +1,3 @@
@file:Suppress("FunctionName")

package org.jetbrains.dokka.base.parsers.moduleAndPackage

fun parseModuleAndPackageDocumentation(
Expand All @@ -12,4 +10,3 @@ fun parseModuleAndPackageDocumentation(
documentation = context.parse(fragment)
)
}

@@ -1,5 +1,3 @@
@file:Suppress("FunctionName")

package org.jetbrains.dokka.base.transformers.documentables

import org.jetbrains.dokka.DokkaConfiguration
Expand Down
@@ -1,5 +1,3 @@
@file:Suppress("FunctionName")

package org.jetbrains.dokka.gradle

import org.gradle.api.Project
Expand Down
@@ -1,5 +1,3 @@
@file:Suppress("FunctionName")

package org.jetbrains.dokka.gradle

import org.gradle.api.artifacts.Configuration
Expand Down
@@ -1,5 +1,3 @@
@file:Suppress("FunctionName")

package org.jetbrains.dokka.gradle

import org.gradle.api.NamedDomainObjectFactory
Expand All @@ -10,6 +8,7 @@ internal fun DokkaSourceSetID(task: Task, sourceSetName: String): DokkaSourceSet
return DokkaSourceSetID(task.path, sourceSetName)
}

@Suppress("FunctionName")
internal fun Task.DokkaSourceSetIdFactory() = NamedDomainObjectFactory<DokkaSourceSetID> { name ->
DokkaSourceSetID(this@DokkaSourceSetIdFactory, name)
}
@@ -1,10 +1,9 @@
@file:Suppress("TestFunctionName")

package org.jetbrains.dokka.gradle

import org.gradle.api.Project
import org.jetbrains.dokka.DokkaSourceSetID

@Suppress("TestFunctionName")
fun GradleDokkaSourceSetBuilder(name: String, project: Project, sourceSetScopeId: String = "${project.path}:test"):
GradleDokkaSourceSetBuilder {
return GradleDokkaSourceSetBuilder(name, project) { DokkaSourceSetID(sourceSetScopeId, it) }
Expand Down
@@ -1,5 +1,3 @@
@file:Suppress("TestFunctionName")

package org.jetbrains.dokka.gradle

import com.android.build.gradle.internal.api.DefaultAndroidSourceSet
Expand All @@ -13,7 +11,6 @@ import kotlin.test.*

class GradleDokkaSourceSetBuilderTest {


private val project = ProjectBuilder.builder().withName("root").build()

@Test
Expand Down Expand Up @@ -488,5 +485,6 @@ class GradleDokkaSourceSetBuilderTest {
}
}

@Suppress("TestFunctionName")
private fun GradleDokkaSourceSetBuilder(name: String, project: Project) =
GradleDokkaSourceSetBuilder(name, project, project.path)

0 comments on commit 31fc16a

Please sign in to comment.