Address warning diagnostics (#1395)

This addressess various warning diagnostics throughout the codebase.
This commit is contained in:
Daniel Chao
2026-01-07 22:11:24 -08:00
committed by GitHub
parent 474305c7b9
commit 14d58a17b0
63 changed files with 387 additions and 371 deletions
@@ -1,5 +1,5 @@
/*
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,15 +27,7 @@ internal class ClassPageGenerator(
pageScope: ClassScope,
isTestMode: Boolean,
consoleOut: OutputStream,
) :
ModuleOrClassPageGenerator<ClassScope>(
docsiteInfo,
docModule,
clazz,
pageScope,
isTestMode,
consoleOut,
) {
) : ModuleOrClassPageGenerator<ClassScope>(docsiteInfo, clazz, pageScope, isTestMode, consoleOut) {
override val html: HTML.() -> Unit = {
renderHtmlHead()
@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,8 +25,3 @@ internal object HtmlConstants {
/** The `known-usages` element ID. */
const val KNOWN_USAGES: String = "known-usages"
}
internal object CssConstants {
/** The `current-version` CSS class. */
const val CURRENT_VERSION: String = "current-version"
}
@@ -1,5 +1,5 @@
/*
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,7 +21,6 @@ import kotlinx.html.*
internal abstract class MainOrPackagePageGenerator<S>(
docsiteInfo: DocsiteInfo,
pageScope: S,
private val siteScope: SiteScope,
consoleOut: OutputStream,
) : PageGenerator<S>(docsiteInfo, pageScope, consoleOut) where S : PageScope {
protected fun UL.renderModuleOrPackage(
@@ -1,5 +1,5 @@
/*
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,7 +23,7 @@ internal class MainPageGenerator(
private val packagesData: List<PackageData>,
pageScope: SiteScope,
consoleOut: OutputStream,
) : MainOrPackagePageGenerator<SiteScope>(docsiteInfo, pageScope, pageScope, consoleOut) {
) : MainOrPackagePageGenerator<SiteScope>(docsiteInfo, pageScope, consoleOut) {
override val html: HTML.() -> Unit = {
renderHtmlHead()
@@ -1,5 +1,5 @@
/*
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,7 +16,6 @@
package org.pkl.doc
import java.io.OutputStream
import java.io.StringWriter
import kotlinx.html.*
import org.pkl.core.Member
import org.pkl.core.PClass
@@ -24,11 +23,9 @@ import org.pkl.core.PClass.ClassMember
import org.pkl.core.PClass.Method
import org.pkl.core.TypeParameter
import org.pkl.core.TypeParameter.Variance
import org.pkl.core.ValueRenderers
internal abstract class ModuleOrClassPageGenerator<S>(
docsiteInfo: DocsiteInfo,
private val docModule: DocModule,
protected val clazz: PClass,
scope: S,
private val isTestMode: Boolean,
@@ -141,12 +138,6 @@ internal abstract class ModuleOrClassPageGenerator<S>(
}
}
private fun renderExportedValue(value: Any): String {
val writer = StringWriter()
ValueRenderers.pcf(writer, " ", false, false).renderValue(value)
return writer.toString()
}
protected fun HtmlBlockTag.renderMethods() {
if (!clazz.hasListedMethod) return
@@ -1,5 +1,5 @@
/*
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,7 +28,6 @@ internal class ModulePageGenerator(
) :
ModuleOrClassPageGenerator<ModuleScope>(
docsiteInfo,
docModule,
docModule.schema.moduleClass,
pageScope,
isTestMode,
@@ -1,5 +1,5 @@
/*
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,7 +23,7 @@ internal class PackagePageGenerator(
private val docPackage: DocPackage,
pageScope: PackageScope,
consoleOut: OutputStream,
) : MainOrPackagePageGenerator<PackageScope>(docsiteInfo, pageScope, pageScope.parent, consoleOut) {
) : MainOrPackagePageGenerator<PackageScope>(docsiteInfo, pageScope, consoleOut) {
override val html: HTML.() -> Unit = {
renderHtmlHead()
+2 -2
View File
@@ -1,5 +1,5 @@
/*
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -112,7 +112,7 @@ internal val String.uriEncodedComponent
* Follows `encodeURI` from ECMAScript.
*/
internal val String.uriEncoded
get(): String = replace(Regex("([^;/?:@&=+\$,#]+)")) { it.value.uriEncodedComponent }
get(): String = replace(Regex("([^;/?:@&=+$,#]+)")) { it.value.uriEncodedComponent }
fun getModulePath(moduleName: String, packagePrefix: String): String =
moduleName.substring(packagePrefix.length).replace('.', '/')