Bump Spotless 6.22.0 -> 6.23.3 and Ktlint 0.50.0 -> 1.0.1

This commit is contained in:
Wolf-Martell Montwé 2023-12-05 13:59:45 +01:00
parent 3e95ab3b47
commit a230e11910
No known key found for this signature in database
GPG key ID: 6D45B21512ACBF72
15 changed files with 86 additions and 65 deletions

View file

@ -15,7 +15,6 @@ max_line_length = 120
ij_kotlin_imports_layout = *,^ ij_kotlin_imports_layout = *,^
ij_kotlin_allow_trailing_comma = true ij_kotlin_allow_trailing_comma = true
ij_kotlin_allow_trailing_comma_on_call_site = true ij_kotlin_allow_trailing_comma_on_call_site = true
ktlint_ignore_back_ticked_identifier = true
[*.{yml,yaml,json,toml,md}] [*.{yml,yaml,json,toml,md}]
indent_size = 2 indent_size = 2

View file

@ -508,7 +508,9 @@ object K9 : EarlyInit {
@Suppress("ktlint:standard:class-naming") @Suppress("ktlint:standard:class-naming")
enum class BACKGROUND_OPS { enum class BACKGROUND_OPS {
ALWAYS, NEVER, WHEN_CHECKED_AUTO_SYNC ALWAYS,
NEVER,
WHEN_CHECKED_AUTO_SYNC,
} }
/** /**

View file

@ -26,7 +26,8 @@ class NotificationChannelManager(
val miscellaneousChannelId = "misc" val miscellaneousChannelId = "misc"
enum class ChannelType { enum class ChannelType {
MESSAGES, MISCELLANEOUS MESSAGES,
MISCELLANEOUS,
} }
init { init {

View file

@ -14,44 +14,6 @@ import com.fsck.k9.mailstore.MimePartStreamParser
import org.junit.Test import org.junit.Test
class AutocryptGossipHeaderParserTest { class AutocryptGossipHeaderParserTest {
val GOSSIP_DATA_BOB = Base64.decodeBase64(
"""
mQGNBFoBt74BDAC8AMsjPY17kxodbfmHah38ZQipY0yfuo97WUBs2jeiFYlQdunPANi5VMgbAX+H
Mq1XoBRs6qW+WpX8Uj11mu22c57BTUXJRbRr4TnTuuOQmT0egwFDe3x8vHSFmcf9OzG8iKR9ftUE
+F2ewrzzmm3XY8hy7QeUgBfClZVA6A3rsX4gGawjDo6ZRBbYwckINgGX/vQk6rGs
""".trimIndent().toByteArray(),
)
val GOSSIP_HEADER_BOB =
"""
|addr=bob@autocrypt.example; keydata=
| mQGNBFoBt74BDAC8AMsjPY17kxodbfmHah38ZQipY0yfuo97WUBs2jeiFYlQdunPANi5VMgbAX+H
| Mq1XoBRs6qW+WpX8Uj11mu22c57BTUXJRbRr4TnTuuOQmT0egwFDe3x8vHSFmcf9OzG8iKR9ftUE
| +F2ewrzzmm3XY8hy7QeUgBfClZVA6A3rsX4gGawjDo6ZRBbYwckINgGX/vQk6rGs
""".trimMargin()
val GOSSIP_RAW_HEADER_BOB = "Autocrypt-Gossip: $GOSSIP_HEADER_BOB".crlf()
// Example from Autocrypt 1.0 appendix
val GOSSIP_PART =
"""
|Autocrypt-Gossip: $GOSSIP_HEADER_BOB
|Autocrypt-Gossip: addr=carol@autocrypt.example; keydata=
| mQGNBFoBt8oBDADGqfZ6PqW05hUEO1dkKm+ixJXnbVriPz2tRkAqT7lTF4KBGitxo4IPv9RPIjJR
| UMUo89ddyqQfiwKxdFCMDqFDnVRWlDaM+r8sauNJoIFwtTFuvUpkFeCI5gYvneEIIbf1r3Xx1pf5
| Iy9qsd5eg/4Vvc2AezUv+A6p2DUNHgFMX2FfDus+EPO0wgeWbNaV601aE7UhyugB
|Content-Type: text/plain
|
|Hi Bob and Carol,
|
|I wanted to introduce the two of you to each other.
|
|I hope you are both doing well! You can now both "reply all" here,
|and the thread will remain encrypted.
|
|Regards,
|Alice
""".trimMargin().crlf()
private val autocryptGossipHeaderParser = AutocryptGossipHeaderParser.getInstance() private val autocryptGossipHeaderParser = AutocryptGossipHeaderParser.getInstance()
@ -115,4 +77,45 @@ class AutocryptGossipHeaderParserTest {
assertThat(gossipHeader).isNull() assertThat(gossipHeader).isNull()
} }
private companion object {
val GOSSIP_DATA_BOB: ByteArray = Base64.decodeBase64(
"""
mQGNBFoBt74BDAC8AMsjPY17kxodbfmHah38ZQipY0yfuo97WUBs2jeiFYlQdunPANi5VMgbAX+H
Mq1XoBRs6qW+WpX8Uj11mu22c57BTUXJRbRr4TnTuuOQmT0egwFDe3x8vHSFmcf9OzG8iKR9ftUE
+F2ewrzzmm3XY8hy7QeUgBfClZVA6A3rsX4gGawjDo6ZRBbYwckINgGX/vQk6rGs
""".trimIndent().toByteArray(),
)
val GOSSIP_HEADER_BOB =
"""
|addr=bob@autocrypt.example; keydata=
| mQGNBFoBt74BDAC8AMsjPY17kxodbfmHah38ZQipY0yfuo97WUBs2jeiFYlQdunPANi5VMgbAX+H
| Mq1XoBRs6qW+WpX8Uj11mu22c57BTUXJRbRr4TnTuuOQmT0egwFDe3x8vHSFmcf9OzG8iKR9ftUE
| +F2ewrzzmm3XY8hy7QeUgBfClZVA6A3rsX4gGawjDo6ZRBbYwckINgGX/vQk6rGs
""".trimMargin()
val GOSSIP_RAW_HEADER_BOB = "Autocrypt-Gossip: $GOSSIP_HEADER_BOB".crlf()
// Example from Autocrypt 1.0 appendix
val GOSSIP_PART =
"""
|Autocrypt-Gossip: $GOSSIP_HEADER_BOB
|Autocrypt-Gossip: addr=carol@autocrypt.example; keydata=
| mQGNBFoBt8oBDADGqfZ6PqW05hUEO1dkKm+ixJXnbVriPz2tRkAqT7lTF4KBGitxo4IPv9RPIjJR
| UMUo89ddyqQfiwKxdFCMDqFDnVRWlDaM+r8sauNJoIFwtTFuvUpkFeCI5gYvneEIIbf1r3Xx1pf5
| Iy9qsd5eg/4Vvc2AezUv+A6p2DUNHgFMX2FfDus+EPO0wgeWbNaV601aE7UhyugB
|Content-Type: text/plain
|
|Hi Bob and Carol,
|
|I wanted to introduce the two of you to each other.
|
|I hope you are both doing well! You can now both "reply all" here,
|and the thread will remain encrypted.
|
|Regards,
|Alice
""".trimMargin().crlf()
}
} }

View file

@ -48,12 +48,13 @@ class K9NotificationResourceProvider(private val context: Context) : Notificatio
override fun certificateErrorBody(): String = context.getString(R.string.notification_certificate_error_text) override fun certificateErrorBody(): String = context.getString(R.string.notification_certificate_error_text)
override fun newMessagesTitle(newMessagesCount: Int): String = override fun newMessagesTitle(newMessagesCount: Int): String {
context.resources.getQuantityString( return context.resources.getQuantityString(
R.plurals.notification_new_messages_title, R.plurals.notification_new_messages_title,
newMessagesCount, newMessagesCount,
newMessagesCount, newMessagesCount,
) )
}
override fun additionalMessages(overflowMessagesCount: Int, accountName: String): String = override fun additionalMessages(overflowMessagesCount: Int, accountName: String): String =
context.getString(R.string.notification_additional_messages, overflowMessagesCount, accountName) context.getString(R.string.notification_additional_messages, overflowMessagesCount, accountName)
@ -77,11 +78,9 @@ class K9NotificationResourceProvider(private val context: Context) : Notificatio
override fun checkingMailTicker(accountName: String, folderName: String): String = override fun checkingMailTicker(accountName: String, folderName: String): String =
context.getString(R.string.notification_bg_sync_ticker, accountName, folderName) context.getString(R.string.notification_bg_sync_ticker, accountName, folderName)
override fun checkingMailTitle(): String = override fun checkingMailTitle(): String = context.getString(R.string.notification_bg_sync_title)
context.getString(R.string.notification_bg_sync_title)
override fun checkingMailSeparator(): String = override fun checkingMailSeparator(): String = context.getString(R.string.notification_bg_title_separator)
context.getString(R.string.notification_bg_title_separator)
override fun actionMarkAsRead(): String = context.getString(R.string.notification_action_mark_as_read) override fun actionMarkAsRead(): String = context.getString(R.string.notification_action_mark_as_read)

View file

@ -1372,7 +1372,9 @@ open class MessageList :
} }
private enum class DisplayMode { private enum class DisplayMode {
MESSAGE_LIST, MESSAGE_VIEW, SPLIT_VIEW MESSAGE_LIST,
MESSAGE_VIEW,
SPLIT_VIEW,
} }
private class LaunchData( private class LaunchData(

View file

@ -762,6 +762,9 @@ class RecipientPresenter(
} }
enum class CryptoMode { enum class CryptoMode {
SIGN_ONLY, NO_CHOICE, CHOICE_DISABLED, CHOICE_ENABLED SIGN_ONLY,
NO_CHOICE,
CHOICE_DISABLED,
CHOICE_ENABLED,
} }
} }

View file

@ -2046,7 +2046,8 @@ class MessageListFragment :
} }
private enum class FolderOperation { private enum class FolderOperation {
COPY, MOVE COPY,
MOVE,
} }
private enum class Error(@StringRes val errorText: Int) { private enum class Error(@StringRes val errorText: Int) {

View file

@ -986,7 +986,8 @@ class MessageViewFragment :
} }
private enum class FolderOperation { private enum class FolderOperation {
COPY, MOVE COPY,
MOVE,
} }
companion object { companion object {

View file

@ -46,9 +46,7 @@ internal fun CommonExtension<*, *, *, *, *>.configureSharedConfig() {
} }
} }
internal fun CommonExtension<*, *, *, *, *>.configureSharedComposeConfig( internal fun CommonExtension<*, *, *, *, *>.configureSharedComposeConfig(libs: LibrariesForLibs) {
libs: LibrariesForLibs,
) {
buildFeatures { buildFeatures {
compose = true compose = true
} }
@ -63,9 +61,7 @@ internal fun CommonExtension<*, *, *, *, *>.configureSharedComposeConfig(
} }
} }
internal fun DependencyHandler.configureSharedComposeDependencies( internal fun DependencyHandler.configureSharedComposeDependencies(libs: LibrariesForLibs) {
libs: LibrariesForLibs,
) {
val composeBom = platform(libs.androidx.compose.bom) val composeBom = platform(libs.androidx.compose.bom)
implementation(composeBom) implementation(composeBom)
androidTestImplementation(composeBom) androidTestImplementation(composeBom)

View file

@ -19,7 +19,7 @@ configure<DetektExtension> {
tasks.withType<Detekt>().configureEach { tasks.withType<Detekt>().configureEach {
jvmTarget = ThunderbirdProjectConfig.javaCompatibilityVersion.toString() jvmTarget = ThunderbirdProjectConfig.javaCompatibilityVersion.toString()
exclude(DEFAULT_EXCLUDES) exclude(defaultExcludes)
reports { reports {
html.required.set(true) html.required.set(true)
@ -31,14 +31,14 @@ tasks.withType<Detekt>().configureEach {
tasks.withType<DetektCreateBaselineTask>().configureEach { tasks.withType<DetektCreateBaselineTask>().configureEach {
jvmTarget = ThunderbirdProjectConfig.javaCompatibilityVersion.toString() jvmTarget = ThunderbirdProjectConfig.javaCompatibilityVersion.toString()
exclude(DEFAULT_EXCLUDES) exclude(defaultExcludes)
} }
dependencies { dependencies {
detektPlugins(libs.detekt.plugin.compose) detektPlugins(libs.detekt.plugin.compose)
} }
val DEFAULT_EXCLUDES = listOf( val defaultExcludes = listOf(
"**/.gradle/**", "**/.gradle/**",
"**/.idea/**", "**/.idea/**",
"**/build/**", "**/build/**",

View file

@ -7,12 +7,15 @@ plugins {
configure<SpotlessExtension> { configure<SpotlessExtension> {
kotlin { kotlin {
ktlint(libs.versions.ktlint.get()) ktlint(libs.versions.ktlint.get())
.userData(mapOf("android" to "true")) .setEditorConfigPath("$projectDir/.editorconfig")
.editorConfigOverride(editorConfigOverride)
target("**/*.kt") target("**/*.kt")
targetExclude("**/build/", "**/resources/", "plugins/openpgp-api-lib/") targetExclude("**/build/", "**/resources/", "plugins/openpgp-api-lib/")
} }
kotlinGradle { kotlinGradle {
ktlint(libs.versions.ktlint.get()) ktlint(libs.versions.ktlint.get())
.setEditorConfigPath("$projectDir/.editorconfig")
.editorConfigOverride(editorConfigOverride)
target("**/*.gradle.kts") target("**/*.gradle.kts")
targetExclude("**/build/") targetExclude("**/build/")
} }
@ -26,3 +29,11 @@ configure<SpotlessExtension> {
trimTrailingWhitespace() trimTrailingWhitespace()
} }
} }
val editorConfigOverride = mapOf(
"ktlint_function_naming_ignore_when_annotated_with" to "Composable",
"ktlint_standard_property-naming" to "disabled",
"ktlint_standard_function-signature" to "disabled",
"ktlint_standard_parameter-list-spacing" to "disabled",
"ktlint_ignore_back_ticked_identifier" to "true",
)

View file

@ -40,7 +40,9 @@ fun ContentLoadingErrorView(
} }
enum class ContentLoadingErrorState { enum class ContentLoadingErrorState {
Loading, Content, Error Loading,
Content,
Error,
} }
@Composable @Composable

View file

@ -4,7 +4,7 @@
[versions] [versions]
gradle = "8.5" gradle = "8.5"
androidGradlePlugin = "8.1.4" androidGradlePlugin = "8.1.4"
ktlint = "0.50.0" ktlint = "1.0.1"
kotlin = "1.9.20" kotlin = "1.9.20"
kotlinxCoroutines = "1.7.3" kotlinxCoroutines = "1.7.3"
@ -48,7 +48,7 @@ ksp = "com.google.devtools.ksp:1.9.20-1.0.14"
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" } kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
spotless = "com.diffplug.spotless:6.22.0" spotless = "com.diffplug.spotless:6.23.3"
detekt = "io.gitlab.arturbosch.detekt:1.23.4" detekt = "io.gitlab.arturbosch.detekt:1.23.4"
dependency-check = "com.github.ben-manes.versions:0.50.0" dependency-check = "com.github.ben-manes.versions:0.50.0"

View file

@ -196,6 +196,7 @@ internal object DecoderUtil {
} }
private enum class Encoding { private enum class Encoding {
Q, B Q,
B,
} }
} }