Skip to content

Commit

Permalink
Update dependency com.pinterest.ktlint:ktlint-cli to v1.3.1 (#286)
Browse files Browse the repository at this point in the history
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Siarhei Luskanau <siarhei-luskanau@users.noreply.github.com>
  • Loading branch information
renovate[bot] and siarhei-luskanau authored Aug 16, 2024
1 parent ebca150 commit 4d9a7e2
Show file tree
Hide file tree
Showing 11 changed files with 69 additions and 86 deletions.
10 changes: 7 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ allprojects {
}
}

apply(plugin = rootProject.libs.plugins.spotless.get().pluginId)
apply(
plugin =
rootProject.libs.plugins.spotless
.get()
.pluginId,
)
configure<SpotlessExtension> {
kotlin {
target("**/*.kt")
Expand All @@ -59,8 +64,7 @@ allprojects {
listOf(
libs.ktlintComposeRules.get().toString(),
),
)
.editorConfigOverride(
).editorConfigOverride(
mapOf(
// Disabled because paging-* filenames should be identical to that of AndroidX Paging.
"ktlint_standard_filename" to "disabled",
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ ktor-client-darwin = { module = "io.ktor:ktor-client-darwin", version.ref = "kto
ktor-client-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktor" }
ktor-serialization-kotlinx-json = { module = "io.ktor:ktor-serialization-kotlinx-json", version.ref = "ktor" }
# Specify the full coordinate for Renovate to track even though we only use the version.
ktlint = "com.pinterest.ktlint:ktlint-cli:1.2.1"
ktlint = "com.pinterest.ktlint:ktlint-cli:1.3.1"
ktlintComposeRules = "io.nlopez.compose.rules:ktlint:0.4.10"

[plugins]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,10 @@ fun createCombinedLoadStates(
append: LoadState,
source: LoadStates,
mediator: LoadStates? = null,
): CombinedLoadStates {
return CombinedLoadStates(
refresh,
prepend,
append,
source,
mediator,
)
}
): CombinedLoadStates = CombinedLoadStates(
refresh,
prepend,
append,
source,
mediator,
)
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,8 @@ fun LoadStates.copy(
refresh: LoadState = this.refresh,
prepend: LoadState = this.prepend,
append: LoadState = this.append,
): LoadStates {
return LoadStates(
refresh,
prepend,
append,
)
}
): LoadStates = LoadStates(
refresh,
prepend,
append,
)
26 changes: 11 additions & 15 deletions paging-common/src/commonMain/kotlin/app/cash/paging/Pager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,19 @@ fun <Key : Any, Value : Any> createPager(
initialKey: Key? = null,
remoteMediator: RemoteMediator<Key, Value>?,
pagingSourceFactory: () -> PagingSource<Key, Value>,
): Pager<Key, Value> {
return Pager(
config,
initialKey,
remoteMediator,
pagingSourceFactory,
)
}
): Pager<Key, Value> = Pager(
config,
initialKey,
remoteMediator,
pagingSourceFactory,
)

fun <Key : Any, Value : Any> createPager(
config: PagingConfig,
initialKey: Key? = null,
pagingSourceFactory: () -> PagingSource<Key, Value>,
): Pager<Key, Value> {
return Pager(
config,
initialKey,
pagingSourceFactory,
)
}
): Pager<Key, Value> = Pager(
config,
initialKey,
pagingSourceFactory,
)
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,14 @@ fun createPagingConfig(
initialLoadSize: Int = pageSize * 3,
maxSize: Int = MAX_SIZE_UNBOUNDED,
jumpThreshold: Int = COUNT_UNDEFINED,
): PagingConfig {
return PagingConfig(
pageSize,
prefetchDistance,
enablePlaceholders,
initialLoadSize,
maxSize,
jumpThreshold,
)
}
): PagingConfig = PagingConfig(
pageSize,
prefetchDistance,
enablePlaceholders,
initialLoadSize,
maxSize,
jumpThreshold,
)

@Suppress("MinMaxConstant")
const val MAX_SIZE_UNBOUNDED: Int = Int.MAX_VALUE
36 changes: 15 additions & 21 deletions paging-common/src/commonMain/kotlin/app/cash/paging/PagingSource.kt
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@ expect class PagingSourceLoadResultError<Key : Any, Value : Any>(

fun <Key : Any, Value : Any> PagingSourceLoadResultError<Key, Value>.copy(
throwable: Throwable = this.throwable,
): PagingSourceLoadResultError<Key, Value> {
return PagingSourceLoadResultError(throwable)
}
): PagingSourceLoadResultError<Key, Value> = PagingSourceLoadResultError(throwable)

expect class PagingSourceLoadResultInvalid<Key : Any, Value : Any>()

Expand Down Expand Up @@ -128,30 +126,26 @@ fun <Key : Any, Value : Any> createPagingSourceLoadResultPage(
nextKey: Key?,
itemsBefore: Int = COUNT_UNDEFINED,
itemsAfter: Int = COUNT_UNDEFINED,
): PagingSourceLoadResultPage<Key, Value> {
return PagingSourceLoadResultPage(
data,
prevKey,
nextKey,
itemsBefore,
itemsAfter,
)
}
): PagingSourceLoadResultPage<Key, Value> = PagingSourceLoadResultPage(
data,
prevKey,
nextKey,
itemsBefore,
itemsAfter,
)

fun <Key : Any, Value : Any> PagingSourceLoadResultPage<Key, Value>.copy(
data: List<Value> = this.data,
prevKey: Key? = this.prevKey,
nextKey: Key? = this.nextKey,
itemsBefore: Int = this.itemsBefore,
itemsAfter: Int = this.itemsAfter,
): PagingSourceLoadResultPage<Key, Value> {
return PagingSourceLoadResultPage(
data,
prevKey,
nextKey,
itemsBefore,
itemsAfter,
)
}
): PagingSourceLoadResultPage<Key, Value> = PagingSourceLoadResultPage(
data,
prevKey,
nextKey,
itemsBefore,
itemsAfter,
)

const val COUNT_UNDEFINED: Int = Int.MIN_VALUE
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,9 @@ class PagingCollectionViewController<T : Any> {
private var collectionView: UICollectionView? = null

private val diffCallback = object : DiffUtil.ItemCallback<T>() {
override fun areItemsTheSame(oldItem: T, newItem: T): Boolean {
return oldItem == newItem
}
override fun areItemsTheSame(oldItem: T, newItem: T): Boolean = oldItem == newItem

override fun areContentsTheSame(oldItem: T, newItem: T): Boolean {
return oldItem == newItem
}
override fun areContentsTheSame(oldItem: T, newItem: T): Boolean = oldItem == newItem
}

private val differ = AsyncPagingDataDiffer(
Expand Down
5 changes: 4 additions & 1 deletion samples/repo-search/android-composeui/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ android {
}

composeOptions {
kotlinCompilerExtensionVersion = libs.androidx.compose.compiler.get().version
kotlinCompilerExtensionVersion =
libs.androidx.compose.compiler
.get()
.version
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,14 @@ class RepoSearchPresenter {
}
}

fun produceViewModels(events: Flow<Event>): Flow<ViewModel> {
return events.map { event ->
when (event) {
is Event.SearchTerm -> {
latestSearchTerm = event.searchTerm
if (event.searchTerm.isEmpty()) {
ViewModel.Empty
} else {
ViewModel.SearchResults(latestSearchTerm, pager.flow)
}
fun produceViewModels(events: Flow<Event>): Flow<ViewModel> = events.map { event ->
when (event) {
is Event.SearchTerm -> {
latestSearchTerm = event.searchTerm
if (event.searchTerm.isEmpty()) {
ViewModel.Empty
} else {
ViewModel.SearchResults(latestSearchTerm, pager.flow)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ import kotlinx.coroutines.flow.MutableSharedFlow
fun exposedTypes(
pagingCollectionViewController: PagingCollectionViewController<*>,
mutableSharedFlow: MutableSharedFlow<*>,
) {
throw AssertionError()
}
): Unit = throw AssertionError()

@Suppress("unused") // Used to export types to Objective-C / Swift.
fun <T> mutableSharedFlow(extraBufferCapacity: Int) = MutableSharedFlow<T>(extraBufferCapacity = extraBufferCapacity)

0 comments on commit 4d9a7e2

Please sign in to comment.