Compare commits

...

3 Commits

Author SHA1 Message Date
AntsyLich
ac41bffdc9 Generate locales_config.xml in build dir 2024-08-19 16:52:23 +06:00
AntsyLich
777ae2461e Remove detekt (#1130)
Annoying. More annoying in this project.
2024-08-19 12:51:37 +06:00
renovate[bot]
b2f1719c50 fix(deps): update dependency org.conscrypt:conscrypt-android to v2.5.3 (#1135)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-08-19 10:59:11 +06:00
32 changed files with 20 additions and 1448 deletions

View File

@@ -38,7 +38,7 @@ jobs:
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
- name: Build app and run unit tests
run: ./gradlew detekt assembleStandardRelease testReleaseUnitTest testStandardReleaseUnitTest
run: ./gradlew assembleStandardRelease testReleaseUnitTest testStandardReleaseUnitTest
- name: Upload APK
uses: actions/upload-artifact@v4

View File

@@ -36,7 +36,7 @@ jobs:
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
- name: Build app and run unit tests
run: ./gradlew detekt assembleStandardRelease testReleaseUnitTest testStandardReleaseUnitTest
run: ./gradlew assembleStandardRelease testReleaseUnitTest testStandardReleaseUnitTest
- name: Upload APK
uses: actions/upload-artifact@v4

View File

@@ -24,10 +24,6 @@ Before you start, please note that the ability to use following technologies is
- [Android Studio](https://developer.android.com/studio)
- Emulator or phone with developer options enabled to test changes.
## Linting
Run the `detekt` gradle task. If the build fails, a report of issues can be found in `app/build/reports/detekt/`. The report is availble in several formats and details each issue that needs attention.
## Getting help
- Join [the Discord server](https://discord.gg/mihon) for online help and to ask questions while developing.

View File

@@ -28,7 +28,6 @@ import soup.compose.material.motion.animation.rememberSlideDistance
/**
* For invoking back press to the parent activity
*/
@SuppressLint("ComposeCompositionLocalUsage")
val LocalBackPress: ProvidableCompositionLocal<(() -> Unit)?> = staticCompositionLocalOf { null }
interface Tab : cafe.adriel.voyager.navigator.tab.Tab {

View File

@@ -153,7 +153,6 @@ class App : Application(), DefaultLifecycleObserver, SingletonImageLoader.Factor
)
}
@Suppress("MagicNumber")
override fun newImageLoader(context: Context): ImageLoader {
return ImageLoader.Builder(this).apply {
val callFactoryLazy = lazy { Injekt.get<NetworkHelper>().client }

View File

@@ -3,7 +3,6 @@ package eu.kanade.tachiyomi.data.backup.models
import kotlinx.serialization.Serializable
import kotlinx.serialization.protobuf.ProtoNumber
@Suppress("MagicNumber")
@Serializable
data class Backup(
@ProtoNumber(1) val backupManga: List<BackupManga>,

View File

@@ -4,7 +4,6 @@ import kotlinx.serialization.Serializable
import kotlinx.serialization.protobuf.ProtoNumber
import tachiyomi.domain.chapter.model.Chapter
@Suppress("MagicNumber")
@Serializable
data class BackupChapter(
// in 1.x some of these values have different names

View File

@@ -4,7 +4,6 @@ import kotlinx.serialization.Serializable
import kotlinx.serialization.protobuf.ProtoNumber
import mihon.domain.extensionrepo.model.ExtensionRepo
@Suppress("MagicNumber")
@Serializable
class BackupExtensionRepos(
@ProtoNumber(1) var baseUrl: String,

View File

@@ -5,10 +5,7 @@ import kotlinx.serialization.Serializable
import kotlinx.serialization.protobuf.ProtoNumber
import tachiyomi.domain.manga.model.Manga
@Suppress(
"DEPRECATION",
"MagicNumber",
)
@Suppress("DEPRECATION")
@Serializable
data class BackupManga(
// in 1.x some of these values have different names

View File

@@ -45,7 +45,6 @@ import java.io.IOException
* Available request parameter:
* - [USE_CUSTOM_COVER_KEY]: Use custom cover if set by user, default is true
*/
@Suppress("LongParameterList")
class MangaCoverFetcher(
private val url: String?,
private val isLibraryManga: Boolean,

View File

@@ -223,7 +223,6 @@ internal object ExtensionLoader {
* @param context The application context.
* @param extensionInfo The extension to load.
*/
@Suppress("LongMethod", "CyclomaticComplexMethod", "ReturnCount")
private suspend fun loadExtension(context: Context, extensionInfo: ExtensionInfo): LoadResult {
val pkgManager = context.packageManager
val pkgInfo = extensionInfo.packageInfo

View File

@@ -174,7 +174,6 @@ class LibraryScreenModel(
/**
* Applies library filters to the given map of manga.
*/
@Suppress("LongMethod", "CyclomaticComplexMethod")
private suspend fun LibraryMap.applyFilters(
trackMap: Map<Long, List<Track>>,
trackingFiler: Map<Long, TriState>,
@@ -256,7 +255,6 @@ class LibraryScreenModel(
/**
* Applies library sorting to the given map of manga.
*/
@Suppress("LongMethod", "CyclomaticComplexMethod")
private fun LibraryMap.applySort(
// Map<MangaId, List<Track>>
trackMap: Map<Long, List<Track>>,

View File

@@ -12,7 +12,6 @@ class MigrationJobFactory(
private val scope: CoroutineScope
) {
@SuppressWarnings("MaxLineLength")
fun create(migrations: List<Migration>): Deferred<Boolean> = with(scope) {
return migrations.sortedBy { it.version }
.fold(CompletableDeferred(true)) { acc: Deferred<Boolean>, migration: Migration ->

View File

@@ -6,7 +6,6 @@ dependencies {
implementation(androidx.gradle)
implementation(kotlinx.gradle)
implementation(kotlinx.compose.compiler.gradle)
implementation(libs.detekt.gradlePlugin)
implementation(gradleApi())
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))

View File

@@ -3,7 +3,6 @@ import mihon.buildlogic.configureAndroid
import mihon.buildlogic.configureTest
plugins {
id("mihon.code.detekt")
id("com.android.application")
kotlin("android")
}

View File

@@ -2,7 +2,6 @@ import mihon.buildlogic.configureAndroid
import mihon.buildlogic.configureTest
plugins {
id("mihon.code.detekt")
id("com.android.test")
kotlin("android")
}

View File

@@ -1,47 +0,0 @@
import io.gitlab.arturbosch.detekt.Detekt
import io.gitlab.arturbosch.detekt.DetektCreateBaselineTask
import org.gradle.accessors.dm.LibrariesForLibs
plugins {
id("io.gitlab.arturbosch.detekt")
}
val libs = the<LibrariesForLibs>()
dependencies {
detektPlugins(libs.detekt.rules.formatting)
detektPlugins(libs.detekt.rules.compose)
}
private val configFile = files("$rootDir/config/detekt/detekt.yml")
private val baselineFile = file("$rootDir/config/detekt/baseline.xml")
private val kotlinFiles = "**/*.kt"
private val resourceFiles = "**/resources/**"
private val buildFiles = "**/build/**"
private val generatedFiles = "**/generated/**"
private val scriptsFiles = "**/*.kts"
detekt {
buildUponDefaultConfig = true
parallel = true
autoCorrect = false
ignoreFailures = false
config.setFrom(configFile)
baseline = file(baselineFile)
}
tasks.withType<Detekt>().configureEach {
include(kotlinFiles)
exclude(resourceFiles, buildFiles, generatedFiles, scriptsFiles)
reports {
html.required.set(true)
xml.required.set(false)
txt.required.set(false)
}
}
tasks.withType<Detekt>().configureEach {
jvmTarget = JavaVersion.VERSION_17.toString()
}
tasks.withType<DetektCreateBaselineTask>().configureEach {
jvmTarget = JavaVersion.VERSION_17.toString()
}

View File

@@ -1,7 +1,6 @@
import mihon.buildlogic.configureCompose
plugins {
id("mihon.code.detekt")
id("com.android.library")
}

View File

@@ -2,7 +2,6 @@ import mihon.buildlogic.configureAndroid
import mihon.buildlogic.configureTest
plugins {
id("mihon.code.detekt")
id("com.android.library")
}

View File

@@ -15,6 +15,7 @@ import org.gradle.kotlin.dsl.the
import org.gradle.kotlin.dsl.withType
import org.jetbrains.kotlin.compose.compiler.gradle.ComposeCompilerGradlePluginExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.io.File
val Project.androidx get() = the<LibrariesForAndroidx>()
val Project.compose get() = the<LibrariesForCompose>()
@@ -106,3 +107,5 @@ internal fun Project.configureTest() {
}
}
}
val Project.generatedBuildDir: File get() = project.layout.buildDirectory.asFile.get().resolve("generated/mihon")

View File

@@ -3,10 +3,11 @@ package mihon.buildlogic.tasks
import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.api.tasks.TaskProvider
import java.io.File
private val emptyResourcesElement = "<resources>\\s*</resources>|<resources/>".toRegex()
private val emptyResourcesElement = "<resources>\\s*</resources>|<resources\\s*/>".toRegex()
fun Project.getLocalesConfigTask(): TaskProvider<Task> {
fun Project.getLocalesConfigTask(outputResourceDir: File): TaskProvider<Task> {
return tasks.register("generateLocalesConfig") {
val locales = fileTree("$projectDir/src/commonMain/moko-resources/")
.matching { include("**/strings.xml") }
@@ -16,7 +17,6 @@ fun Project.getLocalesConfigTask(): TaskProvider<Task> {
.replace("base", "en")
.replace("-r", "-")
.replace("+", "-")
.takeIf(String::isNotBlank) ?: "en"
}
.sorted()
.joinToString("\n") { "| <locale android:name=\"$it\"/>" }
@@ -28,10 +28,9 @@ fun Project.getLocalesConfigTask(): TaskProvider<Task> {
|</locale-config>
""".trimMargin()
file("$projectDir/src/androidMain/res/xml/locales_config.xml").apply {
outputResourceDir.resolve("xml/locales_config.xml").apply {
parentFile.mkdirs()
writeText(content)
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,24 +0,0 @@
naming:
FunctionNaming:
functionPattern: '[a-z][a-zA-Z0-9]*'
ignoreAnnotated: [ 'Composable' ]
TopLevelPropertyNaming:
constantPattern: '[A-Z][A-Za-z0-9]*'
complexity:
LongMethod:
ignoreAnnotated: [ 'Composable' ]
LongParameterList:
ignoreDefaultParameters: true
ignoreAnnotated: [ 'Composable' ]
style:
MagicNumber:
ignorePropertyDeclaration: true
ignoreCompanionObjectPropertyDeclaration: true
ReturnCount:
excludeGuardClauses: true
SerialVersionUIDInSerializableClass:
active: false
UnusedPrivateMember:
ignoreAnnotated: [ 'Preview' ]

View File

@@ -127,7 +127,6 @@ class ChapterRepositoryImpl(
}
}
@Suppress("LongParameterList")
private fun mapChapter(
id: Long,
mangaId: Long,

View File

@@ -5,7 +5,6 @@ import tachiyomi.domain.library.model.LibraryManga
import tachiyomi.domain.manga.model.Manga
object MangaMapper {
@Suppress("LongParameterList")
fun mapManga(
id: Long,
source: Long,
@@ -58,7 +57,6 @@ object MangaMapper {
version = version,
)
@Suppress("LongParameterList")
fun mapLibraryManga(
id: Long,
source: Long,

View File

@@ -67,7 +67,6 @@ class MangaRepositoryImpl(
}
}
@Suppress("MagicNumber")
override suspend fun getUpcomingManga(statuses: Set<Long>): Flow<List<Manga>> {
val epochMillis = LocalDate.now().atStartOfDay(ZoneId.systemDefault()).toEpochSecond() * 1000
return handler.subscribeToList {

View File

@@ -48,7 +48,6 @@ class CreateExtensionRepo(
*
* @param repo Extension Repo holder for passing to DB/Error Dialog
*/
@Suppress("ReturnCount")
private suspend fun handleInsertionError(repo: ExtensionRepo): Result {
val repoExists = repository.getRepo(repo.baseUrl)
if (repoExists != null) {

View File

@@ -17,7 +17,6 @@ class ExtensionRepoService(
) {
val client = networkHelper.client
@Suppress("TooGenericExceptionCaught")
suspend fun fetchRepoDetails(
repo: String,
): ExtensionRepo? {

View File

@@ -8,8 +8,6 @@ shizuku_version = "12.2.0"
sqldelight = "2.0.2"
sqlite = "2.4.0"
voyager = "1.0.0"
detekt = "1.23.6"
detektCompose = "0.3.12"
[libraries]
desugar = "com.android.tools:desugar_jdk_libs:2.0.4"
@@ -24,7 +22,7 @@ okhttp-brotli = { module = "com.squareup.okhttp3:okhttp-brotli", version.ref = "
okhttp-dnsoverhttps = { module = "com.squareup.okhttp3:okhttp-dnsoverhttps", version.ref = "okhttp_version" }
okio = "com.squareup.okio:okio:3.9.0"
conscrypt-android = "org.conscrypt:conscrypt-android:2.5.2"
conscrypt-android = "org.conscrypt:conscrypt-android:2.5.3"
quickjs-android = "app.cash.quickjs:quickjs-android:0.9.2"
@@ -98,10 +96,6 @@ voyager-screenmodel = { module = "cafe.adriel.voyager:voyager-screenmodel", vers
voyager-tab-navigator = { module = "cafe.adriel.voyager:voyager-tab-navigator", version.ref = "voyager" }
voyager-transitions = { module = "cafe.adriel.voyager:voyager-transitions", version.ref = "voyager" }
detekt-gradlePlugin = { module = "io.gitlab.arturbosch.detekt:detekt-gradle-plugin", version.ref = "detekt" }
detekt-rules-formatting = { module = "io.gitlab.arturbosch.detekt:detekt-formatting", version.ref = "detekt" }
detekt-rules-compose = { module = "io.nlopez.compose.rules:detekt", version.ref = "detektCompose" }
[bundles]
okhttp = ["okhttp-core", "okhttp-logging", "okhttp-brotli", "okhttp-dnsoverhttps"]
js-engine = ["quickjs-android"]

2
i18n/.gitignore vendored
View File

@@ -1,2 +0,0 @@
# Generated
locales_config.xml

View File

@@ -1,3 +1,4 @@
import mihon.buildlogic.generatedBuildDir
import mihon.buildlogic.tasks.getLocalesConfigTask
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
@@ -21,13 +22,17 @@ kotlin {
}
}
val generatedAndroidResourceDir = generatedBuildDir.resolve("android/res")
android {
namespace = "tachiyomi.i18n"
sourceSets {
named("main") {
res.srcDir("src/commonMain/resources")
}
val main by getting
main.res.srcDirs(
"src/commonMain/resources",
generatedAndroidResourceDir,
)
}
lint {
@@ -40,7 +45,7 @@ multiplatformResources {
}
tasks {
val localesConfigTask = project.getLocalesConfigTask()
val localesConfigTask = project.getLocalesConfigTask(generatedAndroidResourceDir)
preBuild {
dependsOn(localesConfigTask)
}

View File

@@ -152,7 +152,6 @@ fun Scaffold(
* @param bottomBar the content to place at the bottom of the [Scaffold], on top of the
* [content], typically a [NavigationBar].
*/
@Suppress("CyclomaticComplexMethod")
@OptIn(ExperimentalMaterial3Api::class)
@Composable
private fun ScaffoldLayout(