Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump ktlint to 0.48.2 #6665

Merged
merged 4 commits into from Feb 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .editorconfig
Expand Up @@ -8,6 +8,8 @@ insert_final_newline = true

[*.{kt,kts}]
ij_kotlin_imports_layout = *,^*
ij_kotlin_allow_trailing_comma = true
ij_kotlin_allow_trailing_comma_on_call_site = true

[*.{yml,yaml,json,toml}]
indent_size = 2
1 change: 1 addition & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -15,5 +15,5 @@ data class DiscoveredServerSettings(
val port: Int,
val security: ConnectionSecurity,
val authType: AuthType?,
val username: String?
val username: String?,
)
Expand Up @@ -15,7 +15,7 @@ import timber.log.Timber

class ProvidersXmlDiscovery(
private val xmlProvider: ProvidersXmlProvider,
private val oAuthConfigurationProvider: OAuthConfigurationProvider
private val oAuthConfigurationProvider: OAuthConfigurationProvider,
) : ConnectionSettingsDiscovery {

override fun discover(email: String): DiscoveryResults? {
Expand Down Expand Up @@ -151,6 +151,6 @@ class ProvidersXmlDiscovery(
val incomingUriTemplate: String,
val incomingUsernameTemplate: String,
val outgoingUriTemplate: String,
val outgoingUsernameTemplate: String
val outgoingUsernameTemplate: String,
)
}
Expand Up @@ -36,7 +36,7 @@ class ProvidersXmlDiscoveryTest : RobolectricTest() {
@Test
fun discover_withUnknownDomain_shouldReturnNull() {
val connectionSettings = providersXmlDiscovery.discover(
"user@not.present.in.providers.xml.example"
"user@not.present.in.providers.xml.example",
)

assertThat(connectionSettings).isNull()
Expand All @@ -48,14 +48,14 @@ class ProvidersXmlDiscoveryTest : RobolectricTest() {
scopes = listOf("irrelevant"),
authorizationEndpoint = "irrelevant",
tokenEndpoint = "irrelevant",
redirectUri = "irrelevant"
redirectUri = "irrelevant",
)

return OAuthConfigurationProvider(
configurations = mapOf(
listOf("imap.gmail.com", "smtp.gmail.com") to googleConfig
listOf("imap.gmail.com", "smtp.gmail.com") to googleConfig,
),
googleConfiguration = googleConfig
googleConfiguration = googleConfig,
)
}
}
Expand Up @@ -12,7 +12,7 @@ class MiniDnsSrvResolver : SrvResolver {
val result = ResolverApi.INSTANCE.resolveSrv(
DnsLabel.from(type.label),
SrvProto.tcp.dnsLabel,
DnsName.from(domain)
DnsName.from(domain),
)

val security = if (type.assumeTls) SSL_TLS_REQUIRED else STARTTLS_REQUIRED
Expand All @@ -22,7 +22,7 @@ class MiniDnsSrvResolver : SrvResolver {
host = it.target.toString(),
port = it.port,
priority = it.priority,
security = security
security = security,
)
}
}
Expand Down
Expand Up @@ -8,7 +8,7 @@ import com.fsck.k9.mail.AuthType
import com.fsck.k9.mail.ConnectionSecurity

class SrvServiceDiscovery(
private val srvResolver: MiniDnsSrvResolver
private val srvResolver: MiniDnsSrvResolver,
) : ConnectionSettingsDiscovery {

override fun discover(email: String): DiscoveryResults? {
Expand Down Expand Up @@ -36,21 +36,21 @@ fun newServerSettings(service: MailService, email: String): DiscoveredServerSett
service.port,
service.security,
AuthType.PLAIN,
email
email,
)
}

enum class SrvType(val label: String, val protocol: String, val assumeTls: Boolean) {
SUBMISSIONS("_submissions", "smtp", true),
SUBMISSION("_submission", "smtp", false),
IMAPS("_imaps", "imap", true),
IMAP("_imap", "imap", false)
IMAP("_imap", "imap", false),
}

data class MailService(
val srvType: SrvType,
val host: String,
val port: Int,
val priority: Int,
val security: ConnectionSecurity
val security: ConnectionSecurity,
)
Expand Up @@ -24,8 +24,8 @@ class SrvServiceDiscoveryTest {
val srvResolver = newMockSrvResolver(
imapServices = listOf(newMailService(port = 143, srvType = SrvType.IMAP)),
imapsServices = listOf(
newMailService(port = 993, srvType = SrvType.IMAPS, security = ConnectionSecurity.SSL_TLS_REQUIRED)
)
newMailService(port = 993, srvType = SrvType.IMAPS, security = ConnectionSecurity.SSL_TLS_REQUIRED),
),
)

val srvServiceDiscovery = SrvServiceDiscovery(srvResolver)
Expand All @@ -42,14 +42,14 @@ class SrvServiceDiscoveryTest {
newMailService(
port = 25,
srvType = SrvType.SUBMISSION,
security = ConnectionSecurity.STARTTLS_REQUIRED
security = ConnectionSecurity.STARTTLS_REQUIRED,
),
newMailService(
port = 465,
srvType = SrvType.SUBMISSIONS,
security = ConnectionSecurity.SSL_TLS_REQUIRED
)
)
security = ConnectionSecurity.SSL_TLS_REQUIRED,
),
),
)

val srvServiceDiscovery = SrvServiceDiscovery(srvResolver)
Expand All @@ -68,64 +68,64 @@ class SrvServiceDiscoveryTest {
port = 25,
srvType = SrvType.SUBMISSION,
security = ConnectionSecurity.STARTTLS_REQUIRED,
priority = 0
priority = 0,
),
newMailService(
host = "smtp2.example.com",
port = 25,
srvType = SrvType.SUBMISSION,
security = ConnectionSecurity.STARTTLS_REQUIRED,
priority = 1
)
priority = 1,
),
),
submissionsServices = listOf(
newMailService(
host = "smtp3.example.com",
port = 465,
srvType = SrvType.SUBMISSIONS,
security = ConnectionSecurity.SSL_TLS_REQUIRED,
priority = 0
priority = 0,
),
newMailService(
host = "smtp4.example.com",
port = 465,
srvType = SrvType.SUBMISSIONS,
security = ConnectionSecurity.SSL_TLS_REQUIRED,
priority = 1
)
priority = 1,
),
),
imapServices = listOf(
newMailService(
host = "imap1.example.com",
port = 143,
srvType = SrvType.IMAP,
security = ConnectionSecurity.STARTTLS_REQUIRED,
priority = 0
priority = 0,
),
newMailService(
host = "imap2.example.com",
port = 143,
srvType = SrvType.IMAP,
security = ConnectionSecurity.STARTTLS_REQUIRED,
priority = 1
)
priority = 1,
),
),
imapsServices = listOf(
newMailService(
host = "imaps1.example.com",
port = 993,
srvType = SrvType.IMAPS,
security = ConnectionSecurity.SSL_TLS_REQUIRED,
priority = 0
priority = 0,
),
newMailService(
host = "imaps2.example.com",
port = 993,
srvType = SrvType.IMAPS,
security = ConnectionSecurity.SSL_TLS_REQUIRED,
priority = 1
)
)
priority = 1,
),
),
)

val srvServiceDiscovery = SrvServiceDiscovery(srvResolver)
Expand All @@ -136,18 +136,18 @@ class SrvServiceDiscoveryTest {
"smtp3.example.com",
"smtp1.example.com",
"smtp4.example.com",
"smtp2.example.com"
"smtp2.example.com",
),
result?.outgoing?.map { it.host }
result?.outgoing?.map { it.host },
)
assertEquals(
listOf(
"imaps1.example.com",
"imap1.example.com",
"imaps2.example.com",
"imap2.example.com"
"imap2.example.com",
),
result?.incoming?.map { it.host }
result?.incoming?.map { it.host },
)
}

Expand All @@ -156,7 +156,7 @@ class SrvServiceDiscoveryTest {
priority: Int = 0,
security: ConnectionSecurity = ConnectionSecurity.STARTTLS_REQUIRED,
srvType: SrvType,
port: Int
port: Int,
): MailService {
return MailService(srvType, host, port, priority, security)
}
Expand All @@ -166,7 +166,7 @@ class SrvServiceDiscoveryTest {
submissionServices: List<MailService> = listOf(),
submissionsServices: List<MailService> = listOf(),
imapServices: List<MailService> = listOf(),
imapsServices: List<MailService> = listOf()
imapsServices: List<MailService> = listOf(),
): MiniDnsSrvResolver {
return mock {
on { lookup(host, SrvType.SUBMISSION) } doReturn submissionServices
Expand Down
Expand Up @@ -13,7 +13,7 @@ class ThunderbirdAutoconfigUrlProvider {
createProviderUrl(domain, email),
createDomainUrl(scheme = "https", domain),
createDomainUrl(scheme = "http", domain),
createIspDbUrl(domain)
createIspDbUrl(domain),
)
}

Expand Down
Expand Up @@ -6,7 +6,7 @@ import com.fsck.k9.autodiscovery.api.DiscoveryResults
class ThunderbirdDiscovery(
private val urlProvider: ThunderbirdAutoconfigUrlProvider,
private val fetcher: ThunderbirdAutoconfigFetcher,
private val parser: ThunderbirdAutoconfigParser
private val parser: ThunderbirdAutoconfigParser,
) : ConnectionSettingsDiscovery {

override fun discover(email: String): DiscoveryResults? {
Expand Down
Expand Up @@ -162,11 +162,11 @@ class ThunderbirdAutoconfigTest {
port = 993,
security = ConnectionSecurity.SSL_TLS_REQUIRED,
authType = AuthType.PLAIN,
username = "test@metacode.biz"
)
username = "test@metacode.biz",
),
),
listOf()
)
listOf(),
),
)
}
}
Expand Up @@ -14,7 +14,7 @@ class ThunderbirdAutoconfigUrlProviderTest {
"https://autoconfig.domain.example/mail/config-v1.1.xml?emailaddress=test%40domain.example",
"https://domain.example/.well-known/autoconfig/mail/config-v1.1.xml",
"http://domain.example/.well-known/autoconfig/mail/config-v1.1.xml",
"https://autoconfig.thunderbird.net/v1.1/domain.example"
"https://autoconfig.thunderbird.net/v1.1/domain.example",
)
}
}
20 changes: 11 additions & 9 deletions app/core/src/main/java/com/fsck/k9/Account.kt
Expand Up @@ -613,41 +613,42 @@ class Account(override val uuid: String) : BaseAccount {
ALL,
FIRST_CLASS,
FIRST_AND_SECOND_CLASS,
NOT_SECOND_CLASS
NOT_SECOND_CLASS,
}

enum class SpecialFolderSelection {
AUTOMATIC,
MANUAL
MANUAL,
}

enum class ShowPictures {
NEVER,
ALWAYS,
ONLY_FROM_CONTACTS
ONLY_FROM_CONTACTS,
}

enum class Searchable {
ALL,
DISPLAYABLE,
NONE
NONE,
}

enum class QuoteStyle {
PREFIX,
HEADER
HEADER,
}

enum class MessageFormat {
TEXT,
HTML,
AUTO
AUTO,
}

enum class Expunge {
EXPUNGE_IMMEDIATELY,
EXPUNGE_MANUALLY,
EXPUNGE_ON_POLL;
EXPUNGE_ON_POLL,
;

fun toBackendExpungePolicy(): ExpungePolicy = when (this) {
EXPUNGE_IMMEDIATELY -> ExpungePolicy.IMMEDIATELY
Expand All @@ -660,7 +661,8 @@ class Account(override val uuid: String) : BaseAccount {
NEVER(0),
SEVEN_DAYS(1),
ON_DELETE(2),
MARK_AS_READ(3);
MARK_AS_READ(3),
;

companion object {
fun fromInt(initialSetting: Int): DeletePolicy {
Expand All @@ -676,7 +678,7 @@ class Account(override val uuid: String) : BaseAccount {
SORT_SENDER(true),
SORT_UNREAD(true),
SORT_FLAGGED(true),
SORT_ATTACHMENT(true);
SORT_ATTACHMENT(true),
}

companion object {
Expand Down