Merge pull request #7328 from thunderbird/update_spotless
Update Spotless
This commit is contained in:
commit
19a14fe9d7
19 changed files with 71 additions and 50 deletions
|
@ -2,15 +2,25 @@ root = true
|
|||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
ij_continuation_indent_size = 4
|
||||
tab_width = 4
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
end_of_line = lf
|
||||
max_line_length = 120
|
||||
|
||||
[*.{kt,kts}]
|
||||
ij_kotlin_imports_layout = *,^
|
||||
ij_kotlin_allow_trailing_comma = true
|
||||
ij_kotlin_allow_trailing_comma_on_call_site = true
|
||||
ktlint_ignore_back_ticked_identifier = true
|
||||
|
||||
[*.{yml,yaml,json,toml}]
|
||||
[*.{yml,yaml,json,toml,md}]
|
||||
indent_size = 2
|
||||
tab_width = 2
|
||||
ij_continuation_indent_size = 2
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
|
26
.github/workflows/markdown.yml
vendored
26
.github/workflows/markdown.yml
vendored
|
@ -7,20 +7,20 @@ on:
|
|||
- '.github/workflows/markdown.yml'
|
||||
|
||||
jobs:
|
||||
markdown_quality:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
markdown_quality:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Copy CI gradle.properties
|
||||
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
|
||||
- name: Copy CI gradle.properties
|
||||
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
|
||||
|
||||
- uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: 17
|
||||
- uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: 17
|
||||
|
||||
- uses: gradle/gradle-build-action@v2
|
||||
- uses: gradle/gradle-build-action@v2
|
||||
|
||||
- name: Quality - Spotless Markdown Check
|
||||
run: ./gradlew spotlessMarkdownCheck
|
||||
- name: Quality - Spotless Markdown Check
|
||||
run: ./gradlew spotlessMarkdownCheck
|
||||
|
|
|
@ -38,10 +38,11 @@ class NotificationHelper(
|
|||
try {
|
||||
notificationManager.notify(notificationId, notification)
|
||||
} catch (e: SecurityException) {
|
||||
// When importing settings from another device, we could end up with a NotificationChannel that references a
|
||||
// non-existing notification sound. In that case, we end up with a SecurityException with a message similar
|
||||
// to this:
|
||||
// UID 123 does not have permission to content://media/external_primary/audio/media/42?title=Coins&canonical=1 [user 0]
|
||||
// When importing settings from another device, we could end up with a NotificationChannel that references
|
||||
// a non-existing notification sound. In that case, we end up with a SecurityException with a message
|
||||
// similar to this:
|
||||
// UID 123 does not have permission to
|
||||
// content://media/external_primary/audio/media/42?title=Coins&canonical=1 [user 0]
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O &&
|
||||
e.message?.contains("does not have permission to") == true
|
||||
) {
|
||||
|
|
|
@ -46,7 +46,10 @@ class GenericUriParserTest {
|
|||
assertUriValid("xmpp:example-node@example.com?message")
|
||||
assertUriValid("xmpp:example-node@example.com?message;subject=Hello%20World")
|
||||
assertUriValid("xmpp:nasty!%23\$%25()*+,-.;=%3F%5B%5C%5D%5E_%60%7B%7C%7D~node@example.com")
|
||||
assertUriValid("xmpp:node@example.com/repulsive%20!%23%22\$%25&'()*+,-.%2F:;%3C=%3E%3F%40%5B%5C%5D%5E_%60%7B%7C%7D~resource")
|
||||
assertUriValid(
|
||||
"xmpp:node@example.com/repulsive" +
|
||||
"%20!%23%22\$%25&'()*+,-.%2F:;%3C=%3E%3F%40%5B%5C%5D%5E_%60%7B%7C%7D~resource",
|
||||
)
|
||||
assertUriValid("xmpp:ji%C5%99i@%C4%8Dechy.example/v%20Praze")
|
||||
}
|
||||
|
||||
|
|
|
@ -79,7 +79,13 @@ internal class MigrationTo70(private val db: SQLiteDatabase) {
|
|||
|
||||
private fun recreateFoldersTriggers() {
|
||||
db.execSQL("DROP TRIGGER IF EXISTS delete_folder")
|
||||
db.execSQL("CREATE TRIGGER delete_folder BEFORE DELETE ON folders BEGIN DELETE FROM messages WHERE old.id = folder_id; END;")
|
||||
db.execSQL(
|
||||
"CREATE TRIGGER delete_folder " +
|
||||
"BEFORE DELETE ON folders " +
|
||||
"BEGIN " +
|
||||
"DELETE FROM messages WHERE old.id = folder_id; " +
|
||||
"END;",
|
||||
)
|
||||
|
||||
db.execSQL("DROP TRIGGER IF EXISTS delete_folder_extra_values")
|
||||
db.execSQL(
|
||||
|
|
|
@ -13,7 +13,8 @@ internal class MigrationTo84(private val db: SQLiteDatabase) {
|
|||
|
||||
fun rewriteAddresses() {
|
||||
val addressSets = db.rawQuery(
|
||||
"SELECT id, to_list, cc_list, bcc_list, reply_to_list, sender_list FROM messages WHERE empty = 0 AND deleted = 0",
|
||||
"SELECT id, to_list, cc_list, bcc_list, reply_to_list, sender_list " +
|
||||
"FROM messages WHERE empty = 0 AND deleted = 0",
|
||||
null,
|
||||
).use { cursor ->
|
||||
cursor.map {
|
||||
|
|
|
@ -7,7 +7,6 @@ import com.fsck.k9.message.AutocryptStatusInteractor
|
|||
import com.fsck.k9.message.AutocryptStatusInteractor.RecipientAutocryptStatus
|
||||
import com.fsck.k9.message.CryptoStatus
|
||||
import com.fsck.k9.view.RecipientSelectView.Recipient
|
||||
import org.openintents.openpgp.OpenPgpApiManager
|
||||
import org.openintents.openpgp.OpenPgpApiManager.OpenPgpProviderState
|
||||
|
||||
/** This is an immutable object which contains all relevant metadata entered
|
||||
|
@ -76,10 +75,10 @@ data class ComposeCryptoStatus(
|
|||
val recipientAddressesAsArray = recipientAddresses.toTypedArray()
|
||||
|
||||
private val displayTypeFromProviderError = when (openPgpProviderState) {
|
||||
OpenPgpApiManager.OpenPgpProviderState.OK -> null
|
||||
OpenPgpApiManager.OpenPgpProviderState.UNCONFIGURED -> CryptoStatusDisplayType.UNCONFIGURED
|
||||
OpenPgpApiManager.OpenPgpProviderState.UNINITIALIZED -> CryptoStatusDisplayType.UNINITIALIZED
|
||||
OpenPgpApiManager.OpenPgpProviderState.ERROR, OpenPgpApiManager.OpenPgpProviderState.UI_REQUIRED -> CryptoStatusDisplayType.ERROR
|
||||
OpenPgpProviderState.OK -> null
|
||||
OpenPgpProviderState.UNCONFIGURED -> CryptoStatusDisplayType.UNCONFIGURED
|
||||
OpenPgpProviderState.UNINITIALIZED -> CryptoStatusDisplayType.UNINITIALIZED
|
||||
OpenPgpProviderState.ERROR, OpenPgpProviderState.UI_REQUIRED -> CryptoStatusDisplayType.ERROR
|
||||
}
|
||||
|
||||
private val displayTypeFromAutocryptError = when (recipientAutocryptStatusType) {
|
||||
|
|
|
@ -198,8 +198,8 @@ class MessageViewFragment :
|
|||
if (menuVisible) {
|
||||
messageLoaderHelper.resumeCryptoOperationIfNecessary()
|
||||
} else {
|
||||
// When the menu is hidden, the message associated with this fragment is no longer active. If the user returns
|
||||
// to it, we want to mark the message as opened again.
|
||||
// When the menu is hidden, the message associated with this fragment is no longer active. If the user
|
||||
// returns to it, we want to mark the message as opened again.
|
||||
wasMessageMarkedAsOpened = false
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,7 +94,11 @@ class JmapBackend(
|
|||
return messageServerIds.associateWith { it }
|
||||
}
|
||||
|
||||
override fun moveMessagesAndMarkAsRead(sourceFolderServerId: String, targetFolderServerId: String, messageServerIds: List<String>): Map<String, String>? {
|
||||
override fun moveMessagesAndMarkAsRead(
|
||||
sourceFolderServerId: String,
|
||||
targetFolderServerId: String,
|
||||
messageServerIds: List<String>,
|
||||
): Map<String, String>? {
|
||||
commandMove.moveMessagesAndMarkAsRead(targetFolderServerId, messageServerIds)
|
||||
return messageServerIds.associateWith { it }
|
||||
}
|
||||
|
|
|
@ -84,8 +84,6 @@
|
|||
<ID>MagicNumber:ServerSettingsSerializer.kt$ServerSettingsAdapter$7</ID>
|
||||
<ID>MagicNumber:SettingsExporter.kt$SettingsExporter$3</ID>
|
||||
<ID>MagicNumber:TimberLogger.kt$TimberLogger$26</ID>
|
||||
<ID>MaxLineLength:GenericUriParserTest.kt$GenericUriParserTest$assertUriValid("xmpp:node@example.com/repulsive%20!%23%22\$%25&'()*+,-.%2F:;%3C=%3E%3F%40%5B%5C%5D%5E_%60%7B%7C%7D~resource")</ID>
|
||||
<ID>MaxLineLength:NotificationHelper.kt$NotificationHelper$// UID 123 does not have permission to content://media/external_primary/audio/media/42?title=Coins&canonical=1 [user 0]</ID>
|
||||
<ID>MayBeConst:SummaryNotificationDataCreatorTest.kt$private val TIMESTAMP = 0L</ID>
|
||||
<ID>MemberNameEqualsClassName:HtmlModification.kt$HtmlModification.Replace$abstract fun replace(textToHtml: TextToHtml)</ID>
|
||||
<ID>NestedBlockDepth:HttpUriParser.kt$HttpUriParser$private fun tryMatchIpv6Address(text: CharSequence, startPos: Int): Int</ID>
|
||||
|
|
|
@ -103,8 +103,6 @@
|
|||
<ID>MagicNumber:StorageMigrationTo17.kt$StorageMigrationTo17$0xFFFF00</ID>
|
||||
<ID>MagicNumber:StorageMigrationTo17.kt$StorageMigrationTo17$0xFFFFFF</ID>
|
||||
<ID>MagicNumber:ThreadMessageOperations.kt$ThreadMessageOperations$3</ID>
|
||||
<ID>MaxLineLength:MigrationTo70.kt$MigrationTo70$db.execSQL("CREATE TRIGGER delete_folder BEFORE DELETE ON folders BEGIN DELETE FROM messages WHERE old.id = folder_id; END;")</ID>
|
||||
<ID>MaxLineLength:MigrationTo84.kt$MigrationTo84$"SELECT id, to_list, cc_list, bcc_list, reply_to_list, sender_list FROM messages WHERE empty = 0 AND deleted = 0"</ID>
|
||||
<ID>MaxLineLength:RetrieveMessageListOperationsTest.kt$RetrieveMessageListOperationsTest$fun</ID>
|
||||
<ID>ReturnCount:SaveMessageOperationsTest.kt$SaveMessageOperationsTest$private fun Message.getDownloadState(): MessageDownloadState</ID>
|
||||
<ID>ReturnCount:StorageMigrationTo19.kt$StorageMigrationTo19$private fun markIfGmailAccount(accountUuid: String)</ID>
|
||||
|
|
|
@ -82,14 +82,10 @@
|
|||
<ID>MagicNumber:SizeFormatter.kt$SizeFormatter$1_000_000L</ID>
|
||||
<ID>MagicNumber:SizeFormatter.kt$SizeFormatter$999_950L</ID>
|
||||
<ID>MagicNumber:SizeFormatter.kt$SizeFormatter$999_950_000L</ID>
|
||||
<ID>MaxLineLength:ComposeCryptoStatus.kt$ComposeCryptoStatus$OpenPgpApiManager.OpenPgpProviderState.ERROR, OpenPgpApiManager.OpenPgpProviderState.UI_REQUIRED -> CryptoStatusDisplayType.ERROR</ID>
|
||||
<ID>MaxLineLength:MessageViewFragment.kt$MessageViewFragment$// When the menu is hidden, the message associated with this fragment is no longer active. If the user returns</ID>
|
||||
<ID>MemberNameEqualsClassName:ReplyToView.kt$ReplyToView$private val replyToView: RecipientSelectView = activity.findViewById(R.id.reply_to)</ID>
|
||||
<ID>NestedBlockDepth:MessageList.kt$MessageList$override fun onBackPressed()</ID>
|
||||
<ID>NestedBlockDepth:MessageList.kt$MessageList$override fun onOptionsItemSelected(item: MenuItem): Boolean</ID>
|
||||
<ID>NestedBlockDepth:MessageList.kt$MessageList$private fun decodeExtrasToLaunchData(intent: Intent): LaunchData</ID>
|
||||
<ID>ReturnCount:AccountSetupBasics.kt$AccountSetupBasics$private fun providersXmlDiscoveryDiscover(email: String): ConnectionSettings?</ID>
|
||||
<ID>ReturnCount:AccountSetupBasics.kt$private fun DiscoveredServerSettings.toServerSettings(): ServerSettings?</ID>
|
||||
<ID>ReturnCount:AccountSetupCheckSettings.kt$AccountSetupCheckSettings.CheckAccountTask$private fun isCanceled(): Boolean</ID>
|
||||
<ID>ReturnCount:ChooseFolderActivity.kt$ChooseFolderActivity$private fun decodeArguments(savedInstanceState: Bundle?): Boolean</ID>
|
||||
<ID>ReturnCount:EditIdentity.kt$EditIdentity$override fun onOptionsItemSelected(item: MenuItem): Boolean</ID>
|
||||
|
@ -162,7 +158,6 @@
|
|||
<ID>TooGenericExceptionThrown:MessageViewFragment.kt$MessageViewFragment$throw RuntimeException("Called showDialog(int) with unknown dialog id.")</ID>
|
||||
<ID>TooManyFunctions:AccountSettingsDataStore.kt$AccountSettingsDataStore : PreferenceDataStore</ID>
|
||||
<ID>TooManyFunctions:AccountSettingsFragment.kt$AccountSettingsFragment : PreferenceFragmentCompatConfirmationDialogFragmentListener</ID>
|
||||
<ID>TooManyFunctions:AccountSetupBasics.kt$AccountSetupBasics : K9Activity</ID>
|
||||
<ID>TooManyFunctions:AccountSetupCheckSettings.kt$AccountSetupCheckSettings : K9ActivityConfirmationDialogFragmentListener</ID>
|
||||
<ID>TooManyFunctions:AuthViewModel.kt$AuthViewModel : AndroidViewModel</ID>
|
||||
<ID>TooManyFunctions:AutocryptKeyTransferActivity.kt$AutocryptKeyTransferActivity : K9Activity</ID>
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
<ManuallySuppressedIssues></ManuallySuppressedIssues>
|
||||
<CurrentIssues>
|
||||
<ID>ForbiddenComment:CommandSync.kt$CommandSync$// FIXME: Add sort parameter</ID>
|
||||
<ID>MaxLineLength:JmapBackend.kt$JmapBackend$override</ID>
|
||||
<ID>ReturnCount:JmapAccountDiscovery.kt$JmapAccountDiscovery$fun discover(emailAddress: String, password: String): JmapDiscoveryResult</ID>
|
||||
<ID>SwallowedException:JmapAccountDiscovery.kt$JmapAccountDiscovery$e: EndpointNotFoundException</ID>
|
||||
<ID>SwallowedException:JmapAccountDiscovery.kt$JmapAccountDiscovery$e: UnauthorizedException</ID>
|
||||
|
|
|
@ -51,7 +51,6 @@
|
|||
<ID>MagicNumber:Utf8.kt$3</ID>
|
||||
<ID>MagicNumber:Utf8.kt$4</ID>
|
||||
<ID>MagicNumber:Utf8.kt$6</ID>
|
||||
<ID>MaxLineLength:BoundaryGeneratorTest.kt$BoundaryGeneratorTest$0</ID>
|
||||
<ID>ReturnCount:DecoderUtil.kt$DecoderUtil$@JvmStatic fun decodeEncodedWords(body: String, message: Message?): String</ID>
|
||||
<ID>ReturnCount:DecoderUtil.kt$DecoderUtil$private fun extractEncodedWord(body: String, begin: Int, end: Int, message: Message?): EncodedWord?</ID>
|
||||
<ID>ReturnCount:FormatFlowedHelper.kt$FormatFlowedHelper$@JvmStatic fun checkFormatFlowed(contentTypeHeaderValue: String?): FormatFlowedResult</ID>
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
<ID>MagicNumber:RealImapFolder.kt$RealImapFolder$9</ID>
|
||||
<ID>MagicNumber:UidValidityResponse.kt$UidValidityResponse.Companion$0xFFFFFFFFL</ID>
|
||||
<ID>MaxLineLength:RealImapFolder.kt$RealImapFolder$// [MESSAGE, RFC822, [NAME, Fwd: [#HTR-517941]: update plans at 1am Friday - Memory allocation - displayware.eml], NIL, NIL, 7BIT, 5974, NIL, [INLINE, [FILENAME*0, Fwd: [#HTR-517941]: update plans at 1am Friday - Memory all, FILENAME*1, ocation - displayware.eml]], NIL]</ID>
|
||||
<ID>MaxLineLength:RealImapFolder.kt$RealImapFolder$val canCreateForwardedFlag = canCreateKeywords || internalImapStore.getPermanentFlagsIndex().contains(Flag.FORWARDED)</ID>
|
||||
<ID>MaxLineLength:RealImapStoreTest.kt$RealImapStoreTest$fun</ID>
|
||||
<ID>NestedBlockDepth:RealImapFolder.kt$RealImapFolder$@Throws(MessagingException::class) override fun appendMessages(messages: List<Message>): Map<String, String>?</ID>
|
||||
<ID>NestedBlockDepth:RealImapFolder.kt$RealImapFolder$@Throws(MessagingException::class) override fun fetch( messages: List<ImapMessage>, fetchProfile: FetchProfile, listener: FetchListener?, maxDownloadSize: Int, )</ID>
|
||||
|
|
|
@ -135,7 +135,9 @@ inline fun <reified STATE, EVENT, EFFECT> UnidirectionalViewModel<STATE, EVENT,
|
|||
*/
|
||||
@Suppress("MaxLineLength")
|
||||
@Composable
|
||||
inline fun <reified STATE, EVENT, EFFECT> UnidirectionalViewModel<STATE, EVENT, EFFECT>.observeWithoutEffect(): StateDispatch<STATE, EVENT> {
|
||||
inline fun <reified STATE, EVENT, EFFECT> UnidirectionalViewModel<STATE, EVENT, EFFECT>.observeWithoutEffect(
|
||||
// no effect handler
|
||||
): StateDispatch<STATE, EVENT> {
|
||||
val collectedState = state.collectAsStateWithLifecycle()
|
||||
val dispatch: (EVENT) -> Unit = { event(it) }
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ ksp = "com.google.devtools.ksp:1.9.10-1.0.13"
|
|||
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
|
||||
kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" }
|
||||
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
|
||||
spotless = "com.diffplug.spotless:6.21.0"
|
||||
spotless = "com.diffplug.spotless:6.22.0"
|
||||
detekt = "io.gitlab.arturbosch.detekt:1.23.0"
|
||||
dependency-check = "com.github.ben-manes.versions:0.48.0"
|
||||
|
||||
|
|
|
@ -19,9 +19,10 @@ class BoundaryGeneratorTest {
|
|||
|
||||
@Test
|
||||
fun generateBoundary() {
|
||||
val random = createRandom(
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 35,
|
||||
)
|
||||
val seed = IntRange(0, 28).toList().toIntArray()
|
||||
|
||||
val random = createRandom(*seed, 35)
|
||||
|
||||
val boundaryGenerator = BoundaryGenerator(random)
|
||||
|
||||
val result = boundaryGenerator.generateBoundary()
|
||||
|
|
|
@ -970,9 +970,12 @@ internal class RealImapFolder(
|
|||
|
||||
val encodeFolderName = folderNameCodec.encode(prefixedName)
|
||||
val escapedFolderName = ImapUtility.encodeString(encodeFolderName)
|
||||
val canCreateForwardedFlag = canCreateKeywords ||
|
||||
internalImapStore.getPermanentFlagsIndex().contains(Flag.FORWARDED)
|
||||
|
||||
val combinedFlags = ImapUtility.combineFlags(
|
||||
message.flags,
|
||||
canCreateKeywords || internalImapStore.getPermanentFlagsIndex().contains(Flag.FORWARDED),
|
||||
canCreateForwardedFlag,
|
||||
)
|
||||
val command = String.format(
|
||||
Locale.US,
|
||||
|
@ -1101,7 +1104,9 @@ internal class RealImapFolder(
|
|||
open(OpenMode.READ_WRITE)
|
||||
checkOpen()
|
||||
|
||||
val canCreateForwardedFlag = canCreateKeywords || internalImapStore.getPermanentFlagsIndex().contains(Flag.FORWARDED)
|
||||
val canCreateForwardedFlag = canCreateKeywords ||
|
||||
internalImapStore.getPermanentFlagsIndex().contains(Flag.FORWARDED)
|
||||
|
||||
try {
|
||||
val combinedFlags = ImapUtility.combineFlags(flags, canCreateForwardedFlag)
|
||||
val command = String.format(
|
||||
|
@ -1123,7 +1128,8 @@ internal class RealImapFolder(
|
|||
checkOpen()
|
||||
|
||||
val uids = messages.map { it.uid.toLong() }.toSet()
|
||||
val canCreateForwardedFlag = canCreateKeywords || internalImapStore.getPermanentFlagsIndex().contains(Flag.FORWARDED)
|
||||
val canCreateForwardedFlag = canCreateKeywords ||
|
||||
internalImapStore.getPermanentFlagsIndex().contains(Flag.FORWARDED)
|
||||
val combinedFlags = ImapUtility.combineFlags(flags, canCreateForwardedFlag)
|
||||
val commandSuffix = String.format("%sFLAGS.SILENT (%s)", if (value) "+" else "-", combinedFlags)
|
||||
try {
|
||||
|
|
Loading…
Reference in a new issue