refactor: Assorted code inspection cleanups (#985)

Code inspection found some mechanical code cleanups.
This commit is contained in:
Nik Clayton 2024-10-07 12:38:35 +02:00 committed by GitHub
parent ea635d654e
commit 668c073822
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 10 additions and 13 deletions

View File

@ -58,9 +58,7 @@ data class TabViewData(
other as TabViewData other as TabViewData
if (timeline != other.timeline) return false return timeline == other.timeline
return true
} }
override fun hashCode() = timeline.hashCode() override fun hashCode() = timeline.hashCode()

View File

@ -122,10 +122,10 @@ abstract class SFragment<T : IStatusViewData> : Fragment(), StatusActionListener
viewLifecycleOwner.repeatOnLifecycle(Lifecycle.State.STARTED) { viewLifecycleOwner.repeatOnLifecycle(Lifecycle.State.STARTED) {
serverRepository.flow.collect { result -> serverRepository.flow.collect { result ->
result.onSuccess { result.onSuccess {
serverCanTranslate = it?.can( serverCanTranslate = it.can(
operation = ORG_JOINMASTODON_STATUSES_TRANSLATE, operation = ORG_JOINMASTODON_STATUSES_TRANSLATE,
constraint = ">=1.0".toConstraint(), constraint = ">=1.0".toConstraint(),
) ?: false )
} }
result.onFailure { result.onFailure {
val msg = getString( val msg = getString(

View File

@ -163,7 +163,7 @@ class StatusDisplayOptionsRepository @Inject constructor(
result.onSuccess { server -> result.onSuccess { server ->
_flow.update { _flow.update {
it.copy( it.copy(
canTranslate = server?.can(ORG_JOINMASTODON_STATUSES_TRANSLATE, ">=1.0".toConstraint()) ?: false, canTranslate = server.can(ORG_JOINMASTODON_STATUSES_TRANSLATE, ">=1.0".toConstraint()),
) )
} }
} }

View File

@ -52,7 +52,7 @@ data class ContentFilter(
val filterAction: FilterAction, val filterAction: FilterAction,
val keywords: List<FilterKeyword> = emptyList(), val keywords: List<FilterKeyword> = emptyList(),
) : Parcelable { ) : Parcelable {
companion object {} companion object
} }
/** A filter choice, either content filter or account filter. */ /** A filter choice, either content filter or account filter. */

View File

@ -35,7 +35,6 @@ import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputFiles import org.gradle.api.tasks.InputFiles
import org.gradle.api.tasks.OutputDirectory import org.gradle.api.tasks.OutputDirectory
import org.gradle.api.tasks.TaskAction import org.gradle.api.tasks.TaskAction
import org.gradle.configurationcache.extensions.capitalized
import org.intellij.markdown.flavours.gfm.GFMFlavourDescriptor import org.intellij.markdown.flavours.gfm.GFMFlavourDescriptor
import org.intellij.markdown.html.HtmlGenerator import org.intellij.markdown.html.HtmlGenerator
import org.intellij.markdown.parser.MarkdownParser import org.intellij.markdown.parser.MarkdownParser
@ -136,7 +135,7 @@ class Markdown2ResourcePlugin : Plugin<Project> {
appExtension.libraryVariants.all { variant -> appExtension.libraryVariants.all { variant ->
val outputDir = val outputDir =
target.layout.buildDirectory.dir("generated/source/${variant.name}") target.layout.buildDirectory.dir("generated/source/${variant.name}")
val taskName = "markdown2resource${variant.name.capitalized()}" val taskName = "markdown2resource${variant.name.toString().replaceFirstChar { if (it.isLowerCase()) it.titlecase() else it.toString() }}"
extension.packageName.convention(variant.mergeResourcesProvider.get().namespace) extension.packageName.convention(variant.mergeResourcesProvider.get().namespace)

View File

@ -15,7 +15,7 @@
* see <http://www.gnu.org/licenses>. * see <http://www.gnu.org/licenses>.
*/ */
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
plugins { plugins {
alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.jvm)
@ -25,9 +25,9 @@ subprojects {
apply(plugin = "kotlin") apply(plugin = "kotlin")
apply(plugin = "application") apply(plugin = "application")
tasks.withType<KotlinCompile>().configureEach { tasks.named<KotlinCompilationTask<*>>("compileKotlin").configure {
kotlinOptions { compilerOptions {
freeCompilerArgs = freeCompilerArgs + "-opt-in=kotlin.RequiresOptIn" freeCompilerArgs.add("-opt-in=kotlin.RequiresOptIn")
} }
} }