Lint changes (#7802)

- Fixes current lint issues
- Changes lint task to lintKotlin on PRs
This commit is contained in:
Andreas 2022-08-18 20:06:32 +02:00 committed by GitHub
parent 1f34f5277c
commit 09abfc7843
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 24 additions and 34 deletions

View file

@ -290,6 +290,10 @@ tasks {
} }
} }
withType<org.jmailen.gradle.kotlinter.tasks.LintTask>().configureEach {
exclude { it.file.path.contains("generated[\\\\/]".toRegex())}
}
// See https://kotlinlang.org/docs/reference/experimental.html#experimental-status-of-experimental-api(-markers) // See https://kotlinlang.org/docs/reference/experimental.html#experimental-status-of-experimental-api(-markers)
withType<KotlinCompile> { withType<KotlinCompile> {
kotlinOptions.freeCompilerArgs += listOf( kotlinOptions.freeCompilerArgs += listOf(
@ -315,7 +319,8 @@ tasks {
} }
preBuild { preBuild {
dependsOn(formatKotlin, copyHebrewStrings, localesConfigTask) val ktlintTask = if (System.getenv("GITHUB_BASE_REF") == null) formatKotlin else lintKotlin
dependsOn(ktlintTask, copyHebrewStrings, localesConfigTask)
} }
} }

View file

@ -103,9 +103,9 @@ object Migrations {
// Reset sorting preference if using removed sort by source // Reset sorting preference if using removed sort by source
val oldSortingMode = prefs.getInt(PreferenceKeys.librarySortingMode, 0) val oldSortingMode = prefs.getInt(PreferenceKeys.librarySortingMode, 0)
if (oldSortingMode == 5 /* SOURCE */) { if (oldSortingMode == 5) { // SOURCE = 5
prefs.edit { prefs.edit {
putInt(PreferenceKeys.librarySortingMode, 0 /* ALPHABETICAL */) putInt(PreferenceKeys.librarySortingMode, 0) // ALPHABETICAL = 0
} }
} }
} }

View file

@ -37,19 +37,7 @@ data class BackupChapter(
} }
} }
val backupChapterMapper = { val backupChapterMapper = { _: Long, _: Long, url: String, name: String, scanlator: String?, read: Boolean, bookmark: Boolean, lastPageRead: Long, chapterNumber: Float, source_order: Long, dateFetch: Long, dateUpload: Long ->
_: Long,
_: Long,
url: String,
name: String,
scanlator: String?,
read: Boolean,
bookmark: Boolean,
lastPageRead: Long,
chapterNumber: Float,
source_order: Long,
dateFetch: Long,
dateUpload: Long, ->
BackupChapter( BackupChapter(
url = url, url = url,
name = name, name = name,

View file

@ -51,19 +51,7 @@ data class BackupTracking(
} }
val backupTrackMapper = { val backupTrackMapper = {
_id: Long, _: Long, _: Long, syncId: Long, mediaId: Long, libraryId: Long?, title: String, lastChapterRead: Double, totalChapters: Long, status: Long, score: Float, remoteUrl: String, startDate: Long, finishDate: Long ->
manga_id: Long,
syncId: Long,
mediaId: Long,
libraryId: Long?,
title: String,
lastChapterRead: Double,
totalChapters: Long,
status: Long,
score: Float,
remoteUrl: String,
startDate: Long,
finishDate: Long, ->
BackupTracking( BackupTracking(
syncId = syncId.toInt(), syncId = syncId.toInt(),
mediaId = mediaId, mediaId = mediaId,

View file

@ -19,11 +19,13 @@ object PreferenceValues {
/* ktlint-disable experimental:enum-entry-name-case */ /* ktlint-disable experimental:enum-entry-name-case */
// Keys are lowercase to match legacy string values // Keys are lowercase to match legacy string values
/* ktlint-disable enum-entry-name-case */
enum class ThemeMode { enum class ThemeMode {
light, light,
dark, dark,
system, system,
} }
/* ktlint-enable enum-entry-name-case */
/* ktlint-enable experimental:enum-entry-name-case */ /* ktlint-enable experimental:enum-entry-name-case */

View file

@ -98,7 +98,9 @@ class LocalSource(
} }
} }
else -> { /* Do nothing */ } else -> {
/* Do nothing */
}
} }
} }

View file

@ -21,12 +21,12 @@ import eu.kanade.tachiyomi.network.PREF_DOH_360
import eu.kanade.tachiyomi.network.PREF_DOH_ADGUARD import eu.kanade.tachiyomi.network.PREF_DOH_ADGUARD
import eu.kanade.tachiyomi.network.PREF_DOH_ALIDNS import eu.kanade.tachiyomi.network.PREF_DOH_ALIDNS
import eu.kanade.tachiyomi.network.PREF_DOH_CLOUDFLARE import eu.kanade.tachiyomi.network.PREF_DOH_CLOUDFLARE
import eu.kanade.tachiyomi.network.PREF_DOH_CONTROLD
import eu.kanade.tachiyomi.network.PREF_DOH_DNSPOD import eu.kanade.tachiyomi.network.PREF_DOH_DNSPOD
import eu.kanade.tachiyomi.network.PREF_DOH_GOOGLE import eu.kanade.tachiyomi.network.PREF_DOH_GOOGLE
import eu.kanade.tachiyomi.network.PREF_DOH_MULLVAD import eu.kanade.tachiyomi.network.PREF_DOH_MULLVAD
import eu.kanade.tachiyomi.network.PREF_DOH_QUAD101 import eu.kanade.tachiyomi.network.PREF_DOH_QUAD101
import eu.kanade.tachiyomi.network.PREF_DOH_QUAD9 import eu.kanade.tachiyomi.network.PREF_DOH_QUAD9
import eu.kanade.tachiyomi.network.PREF_DOH_CONTROLD
import eu.kanade.tachiyomi.ui.base.controller.openInBrowser import eu.kanade.tachiyomi.ui.base.controller.openInBrowser
import eu.kanade.tachiyomi.ui.base.controller.pushController import eu.kanade.tachiyomi.ui.base.controller.pushController
import eu.kanade.tachiyomi.ui.setting.database.ClearDatabaseController import eu.kanade.tachiyomi.ui.setting.database.ClearDatabaseController

View file

@ -82,7 +82,9 @@ object ImageUtil {
Format.Webp -> type.isAnimated && Build.VERSION.SDK_INT >= Build.VERSION_CODES.P Format.Webp -> type.isAnimated && Build.VERSION.SDK_INT >= Build.VERSION_CODES.P
else -> false else -> false
} }
} catch (e: Exception) { /* Do Nothing */ } } catch (e: Exception) {
/* Do Nothing */
}
return false return false
} }

View file

@ -26,8 +26,11 @@ subprojects {
kotlinter { kotlinter {
experimentalRules = true experimentalRules = true
// Doesn't play well with Android Studio
disabledRules = arrayOf("experimental:argument-list-wrapping") disabledRules = arrayOf(
"experimental:argument-list-wrapping", // Doesn't play well with Android Studio
"filename", // Often broken to give a more general name
)
} }
} }