Make ktlint happy

For the record: I strongly find the trailing && and ||
less readable than the leading version.
But if that's what the Kotlin folks want 🤷.
This commit is contained in:
Thore Goebel 2024-04-14 18:19:11 +02:00
parent a7c3ddc1ab
commit 05fefb89ba
2 changed files with 14 additions and 14 deletions

View File

@ -62,22 +62,21 @@ public class Fetching(
/**
* true if the repository can be added (be it as new [Repository] or new mirror).
*/
public val canAdd: Boolean = repo != null
&& fetchResult != null
&& fetchResult !is FetchResult.IsExistingRepository
&& fetchResult !is FetchResult.IsExistingMirror
public val canAdd: Boolean = repo != null &&
fetchResult != null &&
fetchResult !is FetchResult.IsExistingRepository &&
fetchResult !is FetchResult.IsExistingMirror
public val isMirror: Boolean = repo != null
&& fetchResult != null
&& (
fetchResult is FetchResult.IsNewMirror
|| fetchResult is FetchResult.IsExistingMirror
|| fetchResult is FetchResult.IsNewRepoAndNewMirror
public val isMirror: Boolean = repo != null &&
fetchResult != null &&
(fetchResult is FetchResult.IsNewMirror ||
fetchResult is FetchResult.IsExistingMirror ||
fetchResult is FetchResult.IsNewRepoAndNewMirror
)
override fun toString(): String {
return "Fetching(fetchUrl=$fetchUrl, repo=${repo?.address}, apps=${apps.size}, " +
"fetchResult=$fetchResult, done=$done, canAdd=$canAdd)"
"fetchResult=$fetchResult, done=$done, canAdd=$canAdd)"
}
}
@ -244,8 +243,8 @@ internal class RepoAdder(
val existingRepo = repositoryDao.getRepository(cert)
return if (existingRepo == null) {
val isUserMirror = url.trimEnd('/') != repo.address.trimEnd('/')
&& repo.mirrors.find { url.trimEnd('/') == it.url.trimEnd('/') } == null
val isUserMirror = url.trimEnd('/') != repo.address.trimEnd('/') &&
repo.mirrors.find { url.trimEnd('/') == it.url.trimEnd('/') } == null
if (isUserMirror) {
FetchResult.IsNewRepoAndNewMirror
} else {

View File

@ -359,7 +359,8 @@ internal class RepoAdderTest {
every { repoDao.getRepository(any<String>()) } returns existingRepo
val expectedFetchResult =
if (existingRepo.address == url) FetchResult.IsExistingRepository else FetchResult.IsExistingMirror
if (existingRepo.address == url) FetchResult.IsExistingRepository
else FetchResult.IsExistingMirror
expectMinRepoPreview(repoName, expectedFetchResult, canAdd = false) {
repoAdder.fetchRepository(url = downloadUrl, proxy = null)