Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import org.jetbrains.kotlin.psi.KtSimpleNameExpression
* - `bytes.toString(Charsets.UTF_8)` → `bytes.decodeToString()`
* - `content.toByteArray(Charsets.UTF_8)` → `content.encodeToByteArray()`
*
* The rule fires on any `Charsets` name reference. JVM-only source sets (`jvmMain`, `jvmTest`,
* `androidMain`, `androidUnitTest`) are excluded via `detekt.yml` — they are valid hosts for
* The rule fires on any `Charsets` name reference. JVM-only source sets (`jvmCommonMain`, `jvmMain`,
* `jvmTest`, `androidMain`, `androidUnitTest`) are excluded via `detekt.yml` — they are valid hosts for
* JVM-specific APIs.
*
* **Why types can't close this gap**: `Charsets` is a JVM stdlib class; there is no
Expand Down
1 change: 1 addition & 0 deletions kmp/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ detekt_test(
"//kmp/src/commonMain/kotlin:detekt_srcs",
"//kmp/src/commonMain/kotlin/dev/stapler/stelekit/stats:detekt_srcs",
"//kmp/src/iosMain/kotlin:detekt_srcs",
"//kmp/src/jvmCommonMain/kotlin:detekt_srcs",
"//kmp/src/jvmMain/kotlin:detekt_srcs",
],
baseline = "config/detekt/baseline.xml",
Expand Down
1 change: 1 addition & 0 deletions kmp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -1280,6 +1280,7 @@ detekt {
// Analyse all KMP source sets; generated SQLDelight code is excluded via config
source.setFrom(
"src/commonMain/kotlin",
"src/jvmCommonMain/kotlin",
"src/jvmMain/kotlin",
"src/androidMain/kotlin",
"src/iosMain/kotlin",
Expand Down
2 changes: 1 addition & 1 deletion kmp/config/detekt/detekt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ stelekit:
excludes: ['**/TypedLazyItems.kt', '**/*Test.kt', '**/test/**', '**/*Spec.kt']
JvmOnlyApiInCommonMain:
active: true
excludes: ['**/jvmMain/**', '**/jvmTest/**', '**/androidMain/**', '**/androidUnitTest/**',
excludes: ['**/jvmCommonMain/**', '**/jvmMain/**', '**/jvmTest/**', '**/androidMain/**', '**/androidUnitTest/**',
'**/iosMain/**', '**/buildSrc/**']
IndexWithoutAnalyze:
active: true
Expand Down
6 changes: 6 additions & 0 deletions kmp/src/jvmCommonMain/kotlin/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,9 @@ exports_files(
glob(["**/*.kt"]),
visibility = ["//kmp:__subpackages__"],
)

filegroup(
name = "detekt_srcs",
srcs = glob(["**/*.kt"], allow_empty = False),
visibility = ["//kmp:__pkg__"],
)
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ package dev.stapler.stelekit.db.libsql
* - JVM desktop: extracted from classpath resource `native/<os-arch>/libstelekit_libsql.{so,dylib,dll}`
* - Android: loaded via [System.loadLibrary] from the APK's `jniLibs/<abi>/` directory
*/
@Suppress("TooManyFunctions") // one external fun per native entry point
object LibsqlJni {

const val SQLITE_BUSY_SNAPSHOT = 517
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ private fun loadGitAttributes(repo: Repository, gitRelativePath: String): GitAtt
val file = if (dir.isEmpty()) File(workTree, ".gitattributes") else File(File(workTree, dir), ".gitattributes")
runCatching { if (file.isFile) GitAttributes.parse(file.readText(), dir) else null }.getOrNull()
}
@Suppress("SpreadOperator") // combine() takes vararg; the list is one entry per directory level
return GitAttributes.combine(*parsed.toTypedArray())
}

Expand Down Expand Up @@ -108,7 +109,8 @@ private fun readConflictStages(
}
// A file conflicting for a non-content reason (binary, rename/rename, add/add without a
// common base) won't carry all three stages — nothing for a text merge to work with.
if (local == null || remote == null || (base == null && !allowMissingBase)) return null
if (local == null || remote == null) return null
if (base == null && !allowMissingBase) return null

fun blobText(entry: DirCacheEntry): String? =
runCatching { repo.open(entry.objectId).bytes.toString(Charsets.UTF_8) }.getOrNull()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class LfsBatchClient(
}.fold({ return it.left() }, { it })
val parsed = try {
json.decodeFromString<BatchResponse>(response)
} catch (e: Exception) {
} catch (e: IllegalArgumentException) { // includes SerializationException
return DomainError.GitError.FetchFailed("Git LFS returned an unreadable response").left()
}
parsed.objects.forEach { byOid[it.oid] = it }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package dev.stapler.stelekit.performance

import arrow.core.Either
import arrow.core.left
import arrow.core.right
import dev.stapler.stelekit.error.DomainError

import dev.stapler.stelekit.model.Page
Expand All @@ -16,6 +14,7 @@ import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.CancellationException
import kotlinx.datetime.LocalDate

@Suppress("TooManyFunctions") // one delegate per PageRepository method
class InstrumentedPageRepository(
private val delegate: PageRepository,
private val tracer: Tracer
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package dev.stapler.stelekit.performance

import arrow.core.Either
import arrow.core.left
import arrow.core.right
import dev.stapler.stelekit.error.DomainError

import dev.stapler.stelekit.model.Block
Expand All @@ -13,7 +11,6 @@ import dev.stapler.stelekit.repository.DirectRepositoryWrite
import dev.stapler.stelekit.repository.SearchRepository
import dev.stapler.stelekit.repository.SearchRequest
import dev.stapler.stelekit.repository.SearchResult
import io.opentelemetry.api.trace.StatusCode
import io.opentelemetry.api.trace.Tracer
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package dev.stapler.stelekit.performance

import arrow.core.Either
import arrow.core.left
import arrow.core.right
import dev.stapler.stelekit.error.DomainError

import dev.stapler.stelekit.db.DatabaseWriteActor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import java.util.concurrent.ConcurrentHashMap
/**
* Base class for JVM file system implementations.
*/
@Suppress("TooManyFunctions") // the shared half of the FileSystem interface
abstract class JvmFileSystemBase {
private val logger = Logger("FileSystem")
companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

package dev.stapler.stelekit.platform.download

import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.ensureActive
import java.io.File
import java.io.IOException
Expand Down Expand Up @@ -68,8 +67,6 @@ object ResumableDownload {
}
}
if (total > 0 && part.length() != total) throw IOException("Truncated download: ${part.length()} of $total bytes")
} catch (e: CancellationException) {
throw e
} finally {
connection.disconnect()
}
Expand Down
Loading