From 53f5550bf42a94d8ab91d1e24c08d50c7fe62ced Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Honza=20Rychnovsk=C3=BD?= Date: Tue, 20 Jun 2023 11:26:38 +0200 Subject: [PATCH] [#1066] Detekt enhancement * [#1083] Detekt Compose 0.1.10 * [#1066] Detekt - MaxLineLength rule turn on * Remove default values As we keep only those that differ from the default in the latest Detekt update. * [#1086] Improve TODO inline occurrence pattern --- .../internal/jni/RustDerivationToolTest.kt | 3 +- .../darkside/MultiAccountIntegrationTest.kt | 2 + .../android/sdk/darkside/MultiAccountTest.kt | 2 + .../darkside/MultiRecipientIntegrationTest.kt | 2 + .../sdk/darkside/OutboundTransactionsTest.kt | 2 + .../sdk/darkside/reorgs/InboundTxTests.kt | 1 + .../sdk/darkside/reorgs/ReorgBasicTest.kt | 2 + .../sdk/darkside/reorgs/ReorgLargeTest.kt | 2 + .../android/sdk/darkside/reorgs/SetupTest.kt | 4 +- .../darkside/test/DarksideTestCoordinator.kt | 6 +- .../android/sdk/darkside/test/TestWallet.kt | 19 +++-- .../sdk/sample/demoapp/SampleCodeTest.kt | 6 +- .../entry/BooleanPreferenceDefaultTest.kt | 8 +- .../entry/IntegerPreferenceDefaultTest.kt | 4 +- .../entry/StringPreferenceDefaultTest.kt | 4 +- .../sdk/sample/demoapp/ui/common/Global.kt | 3 +- .../model/entry/BooleanPreferenceDefault.kt | 3 +- .../model/entry/IntegerPreferenceDefault.kt | 3 +- .../demoapp/ui/screen/home/view/HomeView.kt | 5 +- .../screen/home/viewmodel/WalletViewModel.kt | 3 +- .../ui/screen/seed/view/ConfigureSeedView.kt | 4 +- gradle.properties | 2 +- .../kotlin/cash/z/ecc/android/sdk/Global.kt | 3 +- .../FiatCurrencyConversionRateStateTest.kt | 53 ++++++++++--- .../sdk/model/PersistableWalletTest.kt | 5 +- .../ecc/android/sdk/model/ZecStringExtTest.kt | 55 +++++++++++-- .../android/sdk/model/CurrencyConversion.kt | 4 +- .../android/sdk/annotation/MaintainedTest.kt | 3 +- .../z/ecc/android/sdk/ext/TestExtensions.kt | 2 + .../ecc/android/sdk/fixture/WalletFixture.kt | 4 +- .../sdk/integration/TestnetIntegrationTest.kt | 12 +-- .../block/FileCompactBlockRepositoryTest.kt | 4 +- .../z/ecc/android/sdk/jni/BranchIdTest.kt | 77 ++++++++++++++++--- .../z/ecc/android/sdk/jni/TransparentTest.kt | 5 +- .../android/sdk/sample/ShieldFundsSample.kt | 5 +- .../sdk/sample/TransparentRestoreSample.kt | 8 +- .../cash/z/ecc/android/sdk/util/TestWallet.kt | 19 +++-- .../cash/z/ecc/android/sdk/Synchronizer.kt | 4 +- .../sdk/block/CompactBlockProcessor.kt | 6 +- .../internal/block/CompactBlockDownloader.kt | 2 +- tools/detekt-baseline.xml | 6 +- tools/detekt.yml | 20 +++-- 42 files changed, 294 insertions(+), 93 deletions(-) diff --git a/backend-lib/src/androidTest/java/cash/z/ecc/android/sdk/internal/jni/RustDerivationToolTest.kt b/backend-lib/src/androidTest/java/cash/z/ecc/android/sdk/internal/jni/RustDerivationToolTest.kt index 00e02b79..f5efd906 100644 --- a/backend-lib/src/androidTest/java/cash/z/ecc/android/sdk/internal/jni/RustDerivationToolTest.kt +++ b/backend-lib/src/androidTest/java/cash/z/ecc/android/sdk/internal/jni/RustDerivationToolTest.kt @@ -10,7 +10,8 @@ class RustDerivationToolTest { companion object { private const val SEED_PHRASE = - "kitchen renew wide common vague fold vacuum tilt amazing pear square gossip jewel month tree shock scan alpha just spot fluid toilet view dinner" + "kitchen renew wide common vague fold vacuum tilt amazing pear square gossip jewel month tree shock scan" + + " alpha just spot fluid toilet view dinner" } @Test diff --git a/darkside-test-lib/src/androidTest/java/cash/z/ecc/android/sdk/darkside/MultiAccountIntegrationTest.kt b/darkside-test-lib/src/androidTest/java/cash/z/ecc/android/sdk/darkside/MultiAccountIntegrationTest.kt index 307de94c..4e519437 100644 --- a/darkside-test-lib/src/androidTest/java/cash/z/ecc/android/sdk/darkside/MultiAccountIntegrationTest.kt +++ b/darkside-test-lib/src/androidTest/java/cash/z/ecc/android/sdk/darkside/MultiAccountIntegrationTest.kt @@ -1,3 +1,5 @@ +@file:Suppress("MaxLineLength") + package cash.z.ecc.android.sdk.darkside // package cash.z.ecc.android.sdk.integration // // import cash.z.ecc.android.sdk.test.ScopedTest diff --git a/darkside-test-lib/src/androidTest/java/cash/z/ecc/android/sdk/darkside/MultiAccountTest.kt b/darkside-test-lib/src/androidTest/java/cash/z/ecc/android/sdk/darkside/MultiAccountTest.kt index 6e696b79..275e1eec 100644 --- a/darkside-test-lib/src/androidTest/java/cash/z/ecc/android/sdk/darkside/MultiAccountTest.kt +++ b/darkside-test-lib/src/androidTest/java/cash/z/ecc/android/sdk/darkside/MultiAccountTest.kt @@ -1,3 +1,5 @@ +@file:Suppress("MaxLineLength") + package cash.z.ecc.android.sdk.darkside // import cash.z.ecc.android.sdk.SdkSynchronizer diff --git a/darkside-test-lib/src/androidTest/java/cash/z/ecc/android/sdk/darkside/MultiRecipientIntegrationTest.kt b/darkside-test-lib/src/androidTest/java/cash/z/ecc/android/sdk/darkside/MultiRecipientIntegrationTest.kt index 867e1763..109638ca 100644 --- a/darkside-test-lib/src/androidTest/java/cash/z/ecc/android/sdk/darkside/MultiRecipientIntegrationTest.kt +++ b/darkside-test-lib/src/androidTest/java/cash/z/ecc/android/sdk/darkside/MultiRecipientIntegrationTest.kt @@ -1,3 +1,5 @@ +@file:Suppress("MaxLineLength") + package cash.z.ecc.android.sdk.darkside // package cash.z.ecc.android.sdk.integration // // import cash.z.ecc.android.sdk.test.ScopedTest diff --git a/darkside-test-lib/src/androidTest/java/cash/z/ecc/android/sdk/darkside/OutboundTransactionsTest.kt b/darkside-test-lib/src/androidTest/java/cash/z/ecc/android/sdk/darkside/OutboundTransactionsTest.kt index 79d33643..ffe7a5f0 100644 --- a/darkside-test-lib/src/androidTest/java/cash/z/ecc/android/sdk/darkside/OutboundTransactionsTest.kt +++ b/darkside-test-lib/src/androidTest/java/cash/z/ecc/android/sdk/darkside/OutboundTransactionsTest.kt @@ -1,3 +1,5 @@ +@file:Suppress("MaxLineLength") + package cash.z.ecc.android.sdk.darkside // package cash.z.ecc.android.sdk.integration // // import cash.z.ecc.android.sdk.test.ScopedTest diff --git a/darkside-test-lib/src/androidTest/java/cash/z/ecc/android/sdk/darkside/reorgs/InboundTxTests.kt b/darkside-test-lib/src/androidTest/java/cash/z/ecc/android/sdk/darkside/reorgs/InboundTxTests.kt index 002ea3ce..8e0e136c 100644 --- a/darkside-test-lib/src/androidTest/java/cash/z/ecc/android/sdk/darkside/reorgs/InboundTxTests.kt +++ b/darkside-test-lib/src/androidTest/java/cash/z/ecc/android/sdk/darkside/reorgs/InboundTxTests.kt @@ -43,6 +43,7 @@ class InboundTxTests : ScopedTest() { .applyTipHeight(targetHeight) } + @Suppress("MaxLineLength") companion object { private const val blocksUrl = "https://raw.githubusercontent.com/zcash-hackworks/darksidewalletd-test-data/master/basic-reorg/before-reorg.txt" private const val tx663174 = "https://raw.githubusercontent.com/zcash-hackworks/darksidewalletd-test-data/master/transactions/recv/0821a89be7f2fc1311792c3fa1dd2171a8cdfb2effd98590cbd5ebcdcfcf491f.txt" diff --git a/darkside-test-lib/src/androidTest/java/cash/z/ecc/android/sdk/darkside/reorgs/ReorgBasicTest.kt b/darkside-test-lib/src/androidTest/java/cash/z/ecc/android/sdk/darkside/reorgs/ReorgBasicTest.kt index 2cba645f..82114b5a 100644 --- a/darkside-test-lib/src/androidTest/java/cash/z/ecc/android/sdk/darkside/reorgs/ReorgBasicTest.kt +++ b/darkside-test-lib/src/androidTest/java/cash/z/ecc/android/sdk/darkside/reorgs/ReorgBasicTest.kt @@ -1,3 +1,5 @@ +@file:Suppress("MaxLineLength") + package cash.z.ecc.android.sdk.darkside.reorgs // package cash.z.ecc.android.sdk.integration // // import cash.z.ecc.android.sdk.test.ScopedTest diff --git a/darkside-test-lib/src/androidTest/java/cash/z/ecc/android/sdk/darkside/reorgs/ReorgLargeTest.kt b/darkside-test-lib/src/androidTest/java/cash/z/ecc/android/sdk/darkside/reorgs/ReorgLargeTest.kt index 7eaf6dd4..1f92e0cb 100644 --- a/darkside-test-lib/src/androidTest/java/cash/z/ecc/android/sdk/darkside/reorgs/ReorgLargeTest.kt +++ b/darkside-test-lib/src/androidTest/java/cash/z/ecc/android/sdk/darkside/reorgs/ReorgLargeTest.kt @@ -1,3 +1,5 @@ +@file:Suppress("MaxLineLength") + package cash.z.ecc.android.sdk.darkside.reorgs // package cash.z.ecc.android.sdk.integration // // import androidx.test.platform.app.InstrumentationRegistry diff --git a/darkside-test-lib/src/androidTest/java/cash/z/ecc/android/sdk/darkside/reorgs/SetupTest.kt b/darkside-test-lib/src/androidTest/java/cash/z/ecc/android/sdk/darkside/reorgs/SetupTest.kt index fd70f0c6..401899fd 100644 --- a/darkside-test-lib/src/androidTest/java/cash/z/ecc/android/sdk/darkside/reorgs/SetupTest.kt +++ b/darkside-test-lib/src/androidTest/java/cash/z/ecc/android/sdk/darkside/reorgs/SetupTest.kt @@ -38,7 +38,8 @@ class SetupTest : ScopedTest() { @Test @Ignore("This test is broken") fun tempTest() { - val phrase = "still champion voice habit trend flight survey between bitter process artefact blind carbon truly provide dizzy crush flush breeze blouse charge solid fish spread" + val phrase = "still champion voice habit trend flight survey between bitter process artefact blind" + + " carbon truly provide dizzy crush flush breeze blouse charge solid fish spread" val result = SimpleMnemonics().toSeed(phrase.toCharArray()).toHex() assertEquals("abc", result) } @@ -54,6 +55,7 @@ class SetupTest : ScopedTest() { } companion object { + @Suppress("MaxLineLength") private const val blocksUrl = "https://raw.githubusercontent.com/zcash-hackworks/darksidewalletd-test-data/master/basic-reorg/before-reorg.txt" private const val firstBlock = 663150 private const val lastBlock = 663200 diff --git a/darkside-test-lib/src/androidTest/java/cash/z/ecc/android/sdk/darkside/test/DarksideTestCoordinator.kt b/darkside-test-lib/src/androidTest/java/cash/z/ecc/android/sdk/darkside/test/DarksideTestCoordinator.kt index 48809bde..76526d06 100644 --- a/darkside-test-lib/src/androidTest/java/cash/z/ecc/android/sdk/darkside/test/DarksideTestCoordinator.kt +++ b/darkside-test-lib/src/androidTest/java/cash/z/ecc/android/sdk/darkside/test/DarksideTestCoordinator.kt @@ -55,8 +55,8 @@ class DarksideTestCoordinator(val wallet: TestWallet) { // verify that we are on the darkside try { initiate() - - // In the future, we may want to have the SDK internally verify being on the darkside by matching the network type + // In the future, we may want to have the SDK internally verify being on the darkside by matching the + // network type // synchronizer.getServerInfo().apply { // assertTrue( @@ -263,6 +263,7 @@ class DarksideTestCoordinator(val wallet: TestWallet) { * The chain starts at block 663150 and ends at block 663250 */ fun makeSimpleChain() { + @Suppress("MaxLineLength") darkside .reset(BlockHeightUnsafe(DEFAULT_START_HEIGHT.value)) .stageBlocks("https://raw.githubusercontent.com/zcash-hackworks/darksidewalletd-test-data/master/tx-incoming/blocks.txt") @@ -285,6 +286,7 @@ class DarksideTestCoordinator(val wallet: TestWallet) { } } + @Suppress("MaxLineLength") companion object { /** * This is a special localhost value on the Android emulator, which allows it to contact diff --git a/darkside-test-lib/src/androidTest/java/cash/z/ecc/android/sdk/darkside/test/TestWallet.kt b/darkside-test-lib/src/androidTest/java/cash/z/ecc/android/sdk/darkside/test/TestWallet.kt index d613d2f4..8e4cc667 100644 --- a/darkside-test-lib/src/androidTest/java/cash/z/ecc/android/sdk/darkside/test/TestWallet.kt +++ b/darkside-test-lib/src/androidTest/java/cash/z/ecc/android/sdk/darkside/test/TestWallet.kt @@ -139,10 +139,11 @@ class TestWallet( } enum class Backups(val seedPhrase: String, val testnetBirthday: BlockHeight, val mainnetBirthday: BlockHeight) { - // TODO: [#902] Get the proper birthday values for test wallets - // TODO: [#902] https://github.com/zcash/zcash-android-wallet-sdk/issues/902 + // TODO [#902]: Get the proper birthday values for test wallets + // TODO [#902]: https://github.com/zcash/zcash-android-wallet-sdk/issues/902 DEFAULT( - "column rhythm acoustic gym cost fit keen maze fence seed mail medal shrimp tell relief clip cannon foster soldier shallow refuse lunar parrot banana", + "column rhythm acoustic gym cost fit keen maze fence seed mail medal shrimp tell relief clip" + + " cannon foster soldier shallow refuse lunar parrot banana", BlockHeight.new( ZcashNetwork.Testnet, 1_355_928 @@ -150,7 +151,8 @@ class TestWallet( BlockHeight.new(ZcashNetwork.Mainnet, 1_000_000) ), SAMPLE_WALLET( - "input frown warm senior anxiety abuse yard prefer churn reject people glimpse govern glory crumble swallow verb laptop switch trophy inform friend permit purpose", + "input frown warm senior anxiety abuse yard prefer churn reject people glimpse govern glory" + + " crumble swallow verb laptop switch trophy inform friend permit purpose", BlockHeight.new( ZcashNetwork.Testnet, 1_330_190 @@ -158,7 +160,8 @@ class TestWallet( BlockHeight.new(ZcashNetwork.Mainnet, 1_000_000) ), DEV_WALLET( - "still champion voice habit trend flight survey between bitter process artefact blind carbon truly provide dizzy crush flush breeze blouse charge solid fish spread", + "still champion voice habit trend flight survey between bitter process artefact blind carbon" + + " truly provide dizzy crush flush breeze blouse charge solid fish spread", BlockHeight.new( ZcashNetwork.Testnet, 1_000_000 @@ -166,7 +169,8 @@ class TestWallet( BlockHeight.new(ZcashNetwork.Mainnet, 991645) ), ALICE( - "quantum whisper lion route fury lunar pelican image job client hundred sauce chimney barely life cliff spirit admit weekend message recipe trumpet impact kitten", + "quantum whisper lion route fury lunar pelican image job client hundred sauce chimney barely" + + " life cliff spirit admit weekend message recipe trumpet impact kitten", BlockHeight.new( ZcashNetwork.Testnet, 1_330_190 @@ -174,7 +178,8 @@ class TestWallet( BlockHeight.new(ZcashNetwork.Mainnet, 1_000_000) ), BOB( - "canvas wine sugar acquire garment spy tongue odor hole cage year habit bullet make label human unit option top calm neutral try vocal arena", + "canvas wine sugar acquire garment spy tongue odor hole cage year habit bullet make label" + + " human unit option top calm neutral try vocal arena", BlockHeight.new( ZcashNetwork.Testnet, 1_330_190 diff --git a/demo-app/src/androidTest/java/cash/z/wallet/sdk/sample/demoapp/SampleCodeTest.kt b/demo-app/src/androidTest/java/cash/z/wallet/sdk/sample/demoapp/SampleCodeTest.kt index 7bec418e..9d03e048 100644 --- a/demo-app/src/androidTest/java/cash/z/wallet/sdk/sample/demoapp/SampleCodeTest.kt +++ b/demo-app/src/androidTest/java/cash/z/wallet/sdk/sample/demoapp/SampleCodeTest.kt @@ -178,7 +178,11 @@ class SampleCodeTest { val amount = 0.123.convertZecToZatoshi() val address = "ztestsapling1tklsjr0wyw0d58f3p7wufvrj2cyfv6q6caumyueadq8qvqt8lda6v6tpx474rfru9y6u75u7qnw" val memo = "Test Transaction" - val spendingKey = DerivationTool.getInstance().deriveUnifiedSpendingKey(seed, ZcashNetwork.Mainnet, Account.DEFAULT) + val spendingKey = DerivationTool.getInstance().deriveUnifiedSpendingKey( + seed, + ZcashNetwork.Mainnet, + Account.DEFAULT + ) synchronizer.sendToAddress(spendingKey, amount, address, memo) } diff --git a/demo-app/src/androidTest/java/cash/z/wallet/sdk/sample/demoapp/preference/model/entry/BooleanPreferenceDefaultTest.kt b/demo-app/src/androidTest/java/cash/z/wallet/sdk/sample/demoapp/preference/model/entry/BooleanPreferenceDefaultTest.kt index d3dc6aad..f154f62b 100644 --- a/demo-app/src/androidTest/java/cash/z/wallet/sdk/sample/demoapp/preference/model/entry/BooleanPreferenceDefaultTest.kt +++ b/demo-app/src/androidTest/java/cash/z/wallet/sdk/sample/demoapp/preference/model/entry/BooleanPreferenceDefaultTest.kt @@ -30,14 +30,18 @@ class BooleanPreferenceDefaultTest { @Test fun value_from_config_false() = runTest { val entry = BooleanPreferenceDefaultFixture.newTrue() - val mockPreferenceProvider = MockPreferenceProvider { mutableMapOf(BooleanPreferenceDefaultFixture.KEY.key to false.toString()) } + val mockPreferenceProvider = MockPreferenceProvider { + mutableMapOf(BooleanPreferenceDefaultFixture.KEY.key to false.toString()) + } assertFalse(entry.getValue(mockPreferenceProvider)) } @Test fun value_from_config_true() = runTest { val entry = BooleanPreferenceDefaultFixture.newTrue() - val mockPreferenceProvider = MockPreferenceProvider { mutableMapOf(BooleanPreferenceDefaultFixture.KEY.key to true.toString()) } + val mockPreferenceProvider = MockPreferenceProvider { + mutableMapOf(BooleanPreferenceDefaultFixture.KEY.key to true.toString()) + } assertTrue(entry.getValue(mockPreferenceProvider)) } } diff --git a/demo-app/src/androidTest/java/cash/z/wallet/sdk/sample/demoapp/preference/model/entry/IntegerPreferenceDefaultTest.kt b/demo-app/src/androidTest/java/cash/z/wallet/sdk/sample/demoapp/preference/model/entry/IntegerPreferenceDefaultTest.kt index 17a212ea..a037b19f 100644 --- a/demo-app/src/androidTest/java/cash/z/wallet/sdk/sample/demoapp/preference/model/entry/IntegerPreferenceDefaultTest.kt +++ b/demo-app/src/androidTest/java/cash/z/wallet/sdk/sample/demoapp/preference/model/entry/IntegerPreferenceDefaultTest.kt @@ -25,7 +25,9 @@ class IntegerPreferenceDefaultTest { val expected = IntegerPreferenceDefaultFixture.DEFAULT_VALUE + 5 val entry = IntegerPreferenceDefaultFixture.new() - val mockPreferenceProvider = MockPreferenceProvider { mutableMapOf(StringDefaultPreferenceFixture.KEY.key to expected.toString()) } + val mockPreferenceProvider = MockPreferenceProvider { + mutableMapOf(StringDefaultPreferenceFixture.KEY.key to expected.toString()) + } assertEquals(expected, entry.getValue(mockPreferenceProvider)) } diff --git a/demo-app/src/androidTest/java/cash/z/wallet/sdk/sample/demoapp/preference/model/entry/StringPreferenceDefaultTest.kt b/demo-app/src/androidTest/java/cash/z/wallet/sdk/sample/demoapp/preference/model/entry/StringPreferenceDefaultTest.kt index 85c1c0d6..35a88255 100644 --- a/demo-app/src/androidTest/java/cash/z/wallet/sdk/sample/demoapp/preference/model/entry/StringPreferenceDefaultTest.kt +++ b/demo-app/src/androidTest/java/cash/z/wallet/sdk/sample/demoapp/preference/model/entry/StringPreferenceDefaultTest.kt @@ -23,7 +23,9 @@ class StringPreferenceDefaultTest { fun value_override() = runTest { val entry = StringDefaultPreferenceFixture.new() - val mockPreferenceProvider = MockPreferenceProvider { mutableMapOf(StringDefaultPreferenceFixture.KEY.key to "override") } + val mockPreferenceProvider = MockPreferenceProvider { + mutableMapOf(StringDefaultPreferenceFixture.KEY.key to "override") + } assertEquals("override", entry.getValue(mockPreferenceProvider)) } diff --git a/demo-app/src/androidTest/java/cash/z/wallet/sdk/sample/demoapp/ui/common/Global.kt b/demo-app/src/androidTest/java/cash/z/wallet/sdk/sample/demoapp/ui/common/Global.kt index ad276fed..14668389 100644 --- a/demo-app/src/androidTest/java/cash/z/wallet/sdk/sample/demoapp/ui/common/Global.kt +++ b/demo-app/src/androidTest/java/cash/z/wallet/sdk/sample/demoapp/ui/common/Global.kt @@ -9,6 +9,7 @@ import java.util.Locale fun getStringResource(@StringRes resId: Int) = ApplicationProvider.getApplicationContext().getString(resId) -fun getStringResourceWithArgs(@StringRes resId: Int, formatArgs: Array) = ApplicationProvider.getApplicationContext().getString(resId, *formatArgs) +fun getStringResourceWithArgs(@StringRes resId: Int, formatArgs: Array) = + ApplicationProvider.getApplicationContext().getString(resId, *formatArgs) fun isLocaleRTL(locale: Locale) = TextUtils.getLayoutDirectionFromLocale(locale) == View.LAYOUT_DIRECTION_RTL diff --git a/demo-app/src/main/java/cash/z/ecc/android/sdk/demoapp/preference/model/entry/BooleanPreferenceDefault.kt b/demo-app/src/main/java/cash/z/ecc/android/sdk/demoapp/preference/model/entry/BooleanPreferenceDefault.kt index 943c354a..99166aba 100644 --- a/demo-app/src/main/java/cash/z/ecc/android/sdk/demoapp/preference/model/entry/BooleanPreferenceDefault.kt +++ b/demo-app/src/main/java/cash/z/ecc/android/sdk/demoapp/preference/model/entry/BooleanPreferenceDefault.kt @@ -12,7 +12,8 @@ data class BooleanPreferenceDefault( try { it.toBooleanStrict() } catch (e: IllegalArgumentException) { - // [TODO #32]: Log coercion failure instead of just silently returning default + // TODO [#32]: Log coercion failure instead of just silently returning default + // TODO [#32]: https://github.com/zcash/zcash-android-wallet-sdk/issues/32 defaultValue } } ?: defaultValue diff --git a/demo-app/src/main/java/cash/z/ecc/android/sdk/demoapp/preference/model/entry/IntegerPreferenceDefault.kt b/demo-app/src/main/java/cash/z/ecc/android/sdk/demoapp/preference/model/entry/IntegerPreferenceDefault.kt index 63f0176c..9b7eee7a 100644 --- a/demo-app/src/main/java/cash/z/ecc/android/sdk/demoapp/preference/model/entry/IntegerPreferenceDefault.kt +++ b/demo-app/src/main/java/cash/z/ecc/android/sdk/demoapp/preference/model/entry/IntegerPreferenceDefault.kt @@ -11,7 +11,8 @@ data class IntegerPreferenceDefault( try { it.toInt() } catch (e: NumberFormatException) { - // [TODO #32]: Log coercion failure instead of just silently returning default + // TODO [#32]: Log coercion failure instead of just silently returning default + // TODO [#32]: https://github.com/zcash/zcash-android-wallet-sdk/issues/32 defaultValue } } ?: defaultValue diff --git a/demo-app/src/main/java/cash/z/ecc/android/sdk/demoapp/ui/screen/home/view/HomeView.kt b/demo-app/src/main/java/cash/z/ecc/android/sdk/demoapp/ui/screen/home/view/HomeView.kt index cd7fcc07..c6f0305a 100644 --- a/demo-app/src/main/java/cash/z/ecc/android/sdk/demoapp/ui/screen/home/view/HomeView.kt +++ b/demo-app/src/main/java/cash/z/ecc/android/sdk/demoapp/ui/screen/home/view/HomeView.kt @@ -31,9 +31,9 @@ import cash.z.ecc.android.sdk.demoapp.fixture.WalletSnapshotFixture import cash.z.ecc.android.sdk.demoapp.ui.common.DisableScreenTimeout import cash.z.ecc.android.sdk.demoapp.ui.screen.home.viewmodel.WalletSnapshot -@Preview +@Preview(name = "Home") @Composable -fun ComposablePreviewHome() { +private fun ComposablePreviewHome() { MaterialTheme { Home( WalletSnapshotFixture.new(), @@ -48,7 +48,6 @@ fun ComposablePreviewHome() { } } -@OptIn(ExperimentalMaterial3Api::class) @Suppress("LongParameterList") @Composable fun Home( diff --git a/demo-app/src/main/java/cash/z/ecc/android/sdk/demoapp/ui/screen/home/viewmodel/WalletViewModel.kt b/demo-app/src/main/java/cash/z/ecc/android/sdk/demoapp/ui/screen/home/viewmodel/WalletViewModel.kt index b2715f27..da0f9967 100644 --- a/demo-app/src/main/java/cash/z/ecc/android/sdk/demoapp/ui/screen/home/viewmodel/WalletViewModel.kt +++ b/demo-app/src/main/java/cash/z/ecc/android/sdk/demoapp/ui/screen/home/viewmodel/WalletViewModel.kt @@ -263,7 +263,8 @@ sealed class SendState { /** * Represents all kind of Synchronizer errors */ -// TODO [#529] https://github.com/zcash/secant-android-wallet/issues/529 +// TODO [#529]: Localize Synchronizer Errors +// TODO [#529]: https://github.com/zcash/secant-android-wallet/issues/529 sealed class SynchronizerError { abstract fun getCauseMessage(): String? diff --git a/demo-app/src/main/java/cash/z/ecc/android/sdk/demoapp/ui/screen/seed/view/ConfigureSeedView.kt b/demo-app/src/main/java/cash/z/ecc/android/sdk/demoapp/ui/screen/seed/view/ConfigureSeedView.kt index bed28218..17e0cf9a 100644 --- a/demo-app/src/main/java/cash/z/ecc/android/sdk/demoapp/ui/screen/seed/view/ConfigureSeedView.kt +++ b/demo-app/src/main/java/cash/z/ecc/android/sdk/demoapp/ui/screen/seed/view/ConfigureSeedView.kt @@ -21,9 +21,9 @@ import cash.z.ecc.android.sdk.model.PersistableWallet import cash.z.ecc.android.sdk.model.SeedPhrase import cash.z.ecc.android.sdk.model.ZcashNetwork -@Preview +@Preview(name = "Seed") @Composable -fun ComposablePreview() { +private fun ComposablePreview() { MaterialTheme { Seed( ZcashNetwork.Mainnet, diff --git a/gradle.properties b/gradle.properties index 01fb4117..aceb4287 100644 --- a/gradle.properties +++ b/gradle.properties @@ -85,7 +85,7 @@ ANDROID_NDK_VERSION=22.1.7171670 ANDROID_GRADLE_PLUGIN_VERSION=8.0.2 DETEKT_VERSION=1.23.0 -DETEKT_COMPOSE_RULES_VERSION=0.1.6 +DETEKT_COMPOSE_RULES_VERSION=0.1.10 DOKKA_VERSION=1.8.10 EMULATOR_WTF_GRADLE_PLUGIN_VERSION=0.12.2 FLANK_VERSION=23.04.0 diff --git a/sdk-incubator-lib/src/androidTest/kotlin/cash/z/ecc/android/sdk/Global.kt b/sdk-incubator-lib/src/androidTest/kotlin/cash/z/ecc/android/sdk/Global.kt index f51bb39e..466f57ce 100644 --- a/sdk-incubator-lib/src/androidTest/kotlin/cash/z/ecc/android/sdk/Global.kt +++ b/sdk-incubator-lib/src/androidTest/kotlin/cash/z/ecc/android/sdk/Global.kt @@ -9,6 +9,7 @@ import java.util.Locale fun getStringResource(@StringRes resId: Int) = ApplicationProvider.getApplicationContext().getString(resId) -fun getStringResourceWithArgs(@StringRes resId: Int, formatArgs: Array) = ApplicationProvider.getApplicationContext().getString(resId, *formatArgs) +fun getStringResourceWithArgs(@StringRes resId: Int, formatArgs: Array) = + ApplicationProvider.getApplicationContext().getString(resId, *formatArgs) fun isLocaleRTL(locale: Locale) = TextUtils.getLayoutDirectionFromLocale(locale) == View.LAYOUT_DIRECTION_RTL diff --git a/sdk-incubator-lib/src/androidTest/kotlin/cash/z/ecc/android/sdk/model/FiatCurrencyConversionRateStateTest.kt b/sdk-incubator-lib/src/androidTest/kotlin/cash/z/ecc/android/sdk/model/FiatCurrencyConversionRateStateTest.kt index c74822b4..d45a775f 100644 --- a/sdk-incubator-lib/src/androidTest/kotlin/cash/z/ecc/android/sdk/model/FiatCurrencyConversionRateStateTest.kt +++ b/sdk-incubator-lib/src/androidTest/kotlin/cash/z/ecc/android/sdk/model/FiatCurrencyConversionRateStateTest.kt @@ -23,7 +23,12 @@ class FiatCurrencyConversionRateStateTest { val currencyConversion = CurrencyConversionFixture.new() - val result = zatoshi.toFiatCurrencyState(currencyConversion, LocaleFixture.new(), MonetarySeparatorsFixture.new(), frozenClock) + val result = zatoshi.toFiatCurrencyState( + currencyConversion, + LocaleFixture.new(), + MonetarySeparatorsFixture.new(), + frozenClock + ) assertIs(result) } @@ -34,12 +39,19 @@ class FiatCurrencyConversionRateStateTest { val zatoshi = ZatoshiFixture.new() val frozenClock = FrozenClock( - CurrencyConversionFixture.TIMESTAMP - FiatCurrencyConversionRateState.FUTURE_CUTOFF_AGE_INCLUSIVE - 1.seconds + CurrencyConversionFixture.TIMESTAMP - + FiatCurrencyConversionRateState.FUTURE_CUTOFF_AGE_INCLUSIVE - + 1.seconds ) val currencyConversion = CurrencyConversionFixture.new() - val result = zatoshi.toFiatCurrencyState(currencyConversion, LocaleFixture.new(), MonetarySeparatorsFixture.new(), frozenClock) + val result = zatoshi.toFiatCurrencyState( + currencyConversion, + LocaleFixture.new(), + MonetarySeparatorsFixture.new(), + frozenClock + ) assertIs(result) } @@ -55,7 +67,12 @@ class FiatCurrencyConversionRateStateTest { timestamp = CurrencyConversionFixture.TIMESTAMP - 1.seconds ) - val result = zatoshi.toFiatCurrencyState(currencyConversion, LocaleFixture.new(), MonetarySeparatorsFixture.new(), frozenClock) + val result = zatoshi.toFiatCurrencyState( + currencyConversion, + LocaleFixture.new(), + MonetarySeparatorsFixture.new(), + frozenClock + ) assertIs(result) } @@ -68,10 +85,17 @@ class FiatCurrencyConversionRateStateTest { val frozenClock = FrozenClock(CurrencyConversionFixture.TIMESTAMP) val currencyConversion = CurrencyConversionFixture.new( - timestamp = CurrencyConversionFixture.TIMESTAMP - FiatCurrencyConversionRateState.CURRENT_CUTOFF_AGE_INCLUSIVE - 1.seconds + timestamp = CurrencyConversionFixture.TIMESTAMP - + FiatCurrencyConversionRateState.CURRENT_CUTOFF_AGE_INCLUSIVE - + 1.seconds ) - val result = zatoshi.toFiatCurrencyState(currencyConversion, LocaleFixture.new(), MonetarySeparatorsFixture.new(), frozenClock) + val result = zatoshi.toFiatCurrencyState( + currencyConversion, + LocaleFixture.new(), + MonetarySeparatorsFixture.new(), + frozenClock + ) assertIs(result) } @@ -84,10 +108,17 @@ class FiatCurrencyConversionRateStateTest { val frozenClock = FrozenClock(CurrencyConversionFixture.TIMESTAMP) val currencyConversion = CurrencyConversionFixture.new( - timestamp = CurrencyConversionFixture.TIMESTAMP - FiatCurrencyConversionRateState.STALE_CUTOFF_AGE_INCLUSIVE - 1.seconds + timestamp = CurrencyConversionFixture.TIMESTAMP - + FiatCurrencyConversionRateState.STALE_CUTOFF_AGE_INCLUSIVE - + 1.seconds ) - val result = zatoshi.toFiatCurrencyState(currencyConversion, LocaleFixture.new(), MonetarySeparatorsFixture.new(), frozenClock) + val result = zatoshi.toFiatCurrencyState( + currencyConversion, + LocaleFixture.new(), + MonetarySeparatorsFixture.new(), + frozenClock + ) assertIs(result) } @@ -97,7 +128,11 @@ class FiatCurrencyConversionRateStateTest { fun null_conversion_rate() { val zatoshi = ZatoshiFixture.new() - val result = zatoshi.toFiatCurrencyState(null, LocaleFixture.new(), MonetarySeparatorsFixture.new()) + val result = zatoshi.toFiatCurrencyState( + null, + LocaleFixture.new(), + MonetarySeparatorsFixture.new() + ) assertIs(result) } diff --git a/sdk-incubator-lib/src/androidTest/kotlin/cash/z/ecc/android/sdk/model/PersistableWalletTest.kt b/sdk-incubator-lib/src/androidTest/kotlin/cash/z/ecc/android/sdk/model/PersistableWalletTest.kt index 150228d5..39ab60f1 100644 --- a/sdk-incubator-lib/src/androidTest/kotlin/cash/z/ecc/android/sdk/model/PersistableWalletTest.kt +++ b/sdk-incubator-lib/src/androidTest/kotlin/cash/z/ecc/android/sdk/model/PersistableWalletTest.kt @@ -24,7 +24,10 @@ class PersistableWalletTest { assertEquals(1, jsonObject.getInt(PersistableWallet.KEY_VERSION)) assertEquals(ZcashNetwork.Testnet.id, jsonObject.getInt(PersistableWallet.KEY_NETWORK_ID)) - assertEquals(PersistableWalletFixture.SEED_PHRASE.joinToString(), jsonObject.getString(PersistableWallet.KEY_SEED_PHRASE)) + assertEquals( + PersistableWalletFixture.SEED_PHRASE.joinToString(), + jsonObject.getString(PersistableWallet.KEY_SEED_PHRASE) + ) // Birthday serialization is tested in a separate file } diff --git a/sdk-incubator-lib/src/androidTest/kotlin/cash/z/ecc/android/sdk/model/ZecStringExtTest.kt b/sdk-incubator-lib/src/androidTest/kotlin/cash/z/ecc/android/sdk/model/ZecStringExtTest.kt index a94717fd..2571a510 100644 --- a/sdk-incubator-lib/src/androidTest/kotlin/cash/z/ecc/android/sdk/model/ZecStringExtTest.kt +++ b/sdk-incubator-lib/src/androidTest/kotlin/cash/z/ecc/android/sdk/model/ZecStringExtTest.kt @@ -89,7 +89,11 @@ class ZecStringExtTest { assertTrue(it.matches("123${EN_US_SEPARATORS.decimal}456")) assertTrue(it.matches("123${EN_US_SEPARATORS.grouping}456${EN_US_SEPARATORS.decimal}")) assertTrue(it.matches("123${EN_US_SEPARATORS.grouping}456${EN_US_SEPARATORS.decimal}789")) - assertTrue(it.matches("1${EN_US_SEPARATORS.grouping}234${EN_US_SEPARATORS.grouping}567${EN_US_SEPARATORS.decimal}00")) + assertTrue( + it.matches( + "1${EN_US_SEPARATORS.grouping}234${EN_US_SEPARATORS.grouping}567${EN_US_SEPARATORS.decimal}00" + ) + ) } } @@ -152,17 +156,52 @@ class ZecStringExtTest { fun check_digits_between_grouping_separators_valid_test() { assertTrue(ZecStringExt.checkFor3Digits(EN_US_SEPARATORS, "123")) assertTrue(ZecStringExt.checkFor3Digits(EN_US_SEPARATORS, "1${EN_US_SEPARATORS.grouping}234")) - assertTrue(ZecStringExt.checkFor3Digits(EN_US_SEPARATORS, "1${EN_US_SEPARATORS.grouping}234${EN_US_SEPARATORS.grouping}")) - assertTrue(ZecStringExt.checkFor3Digits(EN_US_SEPARATORS, "1${EN_US_SEPARATORS.grouping}234${EN_US_SEPARATORS.grouping}5")) - assertTrue(ZecStringExt.checkFor3Digits(EN_US_SEPARATORS, "1${EN_US_SEPARATORS.grouping}234${EN_US_SEPARATORS.grouping}567${EN_US_SEPARATORS.grouping}8")) + assertTrue( + ZecStringExt.checkFor3Digits( + EN_US_SEPARATORS, + "1${EN_US_SEPARATORS.grouping}234${EN_US_SEPARATORS.grouping}" + ) + ) + assertTrue( + ZecStringExt.checkFor3Digits( + EN_US_SEPARATORS, + "1${EN_US_SEPARATORS.grouping}234${EN_US_SEPARATORS.grouping}5" + ) + ) + assertTrue( + ZecStringExt.checkFor3Digits( + EN_US_SEPARATORS, + "1${EN_US_SEPARATORS.grouping}234${EN_US_SEPARATORS.grouping}567${EN_US_SEPARATORS.grouping}8" + ) + ) } @Test @SmallTest fun check_digits_between_grouping_separators_invalid_test() { - assertFalse(ZecStringExt.checkFor3Digits(EN_US_SEPARATORS, "1${EN_US_SEPARATORS.grouping}1${EN_US_SEPARATORS.grouping}2")) - assertFalse(ZecStringExt.checkFor3Digits(EN_US_SEPARATORS, "1${EN_US_SEPARATORS.grouping}12${EN_US_SEPARATORS.grouping}3")) - assertFalse(ZecStringExt.checkFor3Digits(EN_US_SEPARATORS, "1${EN_US_SEPARATORS.grouping}1234${EN_US_SEPARATORS.grouping}")) - assertFalse(ZecStringExt.checkFor3Digits(EN_US_SEPARATORS, "1${EN_US_SEPARATORS.grouping}123${EN_US_SEPARATORS.grouping}4${EN_US_SEPARATORS.grouping}")) + assertFalse( + ZecStringExt.checkFor3Digits( + EN_US_SEPARATORS, + "1${EN_US_SEPARATORS.grouping}1${EN_US_SEPARATORS.grouping}2" + ) + ) + assertFalse( + ZecStringExt.checkFor3Digits( + EN_US_SEPARATORS, + "1${EN_US_SEPARATORS.grouping}12${EN_US_SEPARATORS.grouping}3" + ) + ) + assertFalse( + ZecStringExt.checkFor3Digits( + EN_US_SEPARATORS, + "1${EN_US_SEPARATORS.grouping}1234${EN_US_SEPARATORS.grouping}" + ) + ) + assertFalse( + ZecStringExt.checkFor3Digits( + EN_US_SEPARATORS, + "1${EN_US_SEPARATORS.grouping}123${EN_US_SEPARATORS.grouping}4${EN_US_SEPARATORS.grouping}" + ) + ) } } diff --git a/sdk-incubator-lib/src/main/java/cash/z/ecc/android/sdk/model/CurrencyConversion.kt b/sdk-incubator-lib/src/main/java/cash/z/ecc/android/sdk/model/CurrencyConversion.kt index d8db6a8e..5df0c68f 100644 --- a/sdk-incubator-lib/src/main/java/cash/z/ecc/android/sdk/model/CurrencyConversion.kt +++ b/sdk-incubator-lib/src/main/java/cash/z/ecc/android/sdk/model/CurrencyConversion.kt @@ -29,7 +29,7 @@ data class FiatCurrency(val code: String) { init { require(code.length == 3) { "Fiat currency code must be 3 characters long." } - // TODO [#532] https://github.com/zcash/secant-android-wallet/issues/532 - // Add another check to make sure the code is in the known ISO currency code list. + // TODO [#532]: Add another check to make sure the code is in the known ISO currency code list. + // TODO [#532]: https://github.com/zcash/secant-android-wallet/issues/532 } } diff --git a/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/annotation/MaintainedTest.kt b/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/annotation/MaintainedTest.kt index c461f44f..8e5f225b 100644 --- a/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/annotation/MaintainedTest.kt +++ b/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/annotation/MaintainedTest.kt @@ -16,7 +16,8 @@ enum class TestPurpose { COMMIT, /** - * These tests require a running instance of [darksidewalletd](https://github.com/zcash/lightwalletd/blob/master/docs/darksidewalletd.md). + * These tests require a running instance of + * [darksidewalletd](https://github.com/zcash/lightwalletd/blob/master/docs/darksidewalletd.md). */ DARKSIDE } diff --git a/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/ext/TestExtensions.kt b/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/ext/TestExtensions.kt index 2cca93ab..b3f2968a 100644 --- a/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/ext/TestExtensions.kt +++ b/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/ext/TestExtensions.kt @@ -20,6 +20,7 @@ object BlockExplorer { } object Transactions { + @Suppress("MaxLineLength") val outbound = arrayOf( "https://raw.githubusercontent.com/zcash-hackworks/darksidewalletd-test-data/master/transactions/t-shielded-spend.txt", "https://raw.githubusercontent.com/zcash-hackworks/darksidewalletd-test-data/master/transactions/sent/c9e35e6ff444b071d63bf9bab6480409d6361760445c8a28d24179adb35c2495.txt", @@ -32,6 +33,7 @@ object Transactions { "https://raw.githubusercontent.com/zcash-hackworks/darksidewalletd-test-data/master/transactions/sent/73c5edf8ffba774d99155121ccf07e67fbcf14284458f7e732751fea60d3bcbc.txt" ) + @Suppress("MaxLineLength") val inbound = arrayOf( "https://raw.githubusercontent.com/zcash-hackworks/darksidewalletd-test-data/master/transactions/recv/8f064d23c66dc36e32445e5f3b50e0f32ac3ddb78cff21fb521eb6c19c07c99a.txt", "https://raw.githubusercontent.com/zcash-hackworks/darksidewalletd-test-data/master/transactions/recv/15a677b6770c5505fb47439361d3d3a7c21238ee1a6874fdedad18ae96850590.txt", diff --git a/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/fixture/WalletFixture.kt b/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/fixture/WalletFixture.kt index 6cd67ee1..f018d95d 100644 --- a/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/fixture/WalletFixture.kt +++ b/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/fixture/WalletFixture.kt @@ -8,8 +8,8 @@ import cash.z.ecc.android.sdk.model.ZcashNetwork object WalletFixture { val NETWORK = ZcashNetwork.Mainnet - const val SEED_PHRASE = - "kitchen renew wide common vague fold vacuum tilt amazing pear square gossip jewel month tree shock scan alpha just spot fluid toilet view dinner" + const val SEED_PHRASE = "kitchen renew wide common vague fold vacuum tilt amazing pear square gossip jewel month" + + " tree shock scan alpha just spot fluid toilet view dinner" suspend fun getUnifiedSpendingKey( seed: String = SEED_PHRASE, diff --git a/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/integration/TestnetIntegrationTest.kt b/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/integration/TestnetIntegrationTest.kt index f507e860..02224d19 100644 --- a/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/integration/TestnetIntegrationTest.kt +++ b/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/integration/TestnetIntegrationTest.kt @@ -19,7 +19,6 @@ import co.electriccoin.lightwallet.client.model.BlockHeightUnsafe import co.electriccoin.lightwallet.client.model.LightWalletEndpoint import co.electriccoin.lightwallet.client.model.Response import co.electriccoin.lightwallet.client.new -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.delay import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull @@ -41,7 +40,6 @@ class TestnetIntegrationTest : ScopedTest() { @Test @Ignore("This test is broken") - @OptIn(ExperimentalCoroutinesApi::class) fun testLatestBlockTest() = runTest { val service = LightWalletClient.new( context, @@ -101,7 +99,11 @@ class TestnetIntegrationTest : ScopedTest() { } private suspend fun sendFunds(): Boolean { - val spendingKey = DerivationTool.getInstance().deriveUnifiedSpendingKey(seed, synchronizer.network, Account.DEFAULT) + val spendingKey = DerivationTool.getInstance().deriveUnifiedSpendingKey( + seed, + synchronizer.network, + Account.DEFAULT + ) log("sending to address") synchronizer.sendToAddress( spendingKey, @@ -121,8 +123,8 @@ class TestnetIntegrationTest : ScopedTest() { val lightWalletEndpoint = LightWalletEndpoint("lightwalletd.testnet.z.cash", 9087, true) private const val birthdayHeight = 963150L private const val targetHeight = 663250 - private const val seedPhrase = - "still champion voice habit trend flight survey between bitter process artefact blind carbon truly provide dizzy crush flush breeze blouse charge solid fish spread" + private const val seedPhrase = "still champion voice habit trend flight survey between bitter process" + + " artefact blind carbon truly provide dizzy crush flush breeze blouse charge solid fish spread" val seed = "cash.z.ecc.android.sdk.integration.IntegrationTest.seed.value.64bytes".toByteArray() val address = "zs1m30y59wxut4zk9w24d6ujrdnfnl42hpy0ugvhgyhr8s0guszutqhdj05c7j472dndjstulph74m" val toAddress = "zs1vp7kvlqr4n9gpehztr76lcn6skkss9p8keqs3nv8avkdtjrcctrvmk9a7u494kluv756jeee5k0" diff --git a/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/internal/storage/block/FileCompactBlockRepositoryTest.kt b/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/internal/storage/block/FileCompactBlockRepositoryTest.kt index 943a7731..dfa554ba 100644 --- a/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/internal/storage/block/FileCompactBlockRepositoryTest.kt +++ b/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/internal/storage/block/FileCompactBlockRepositoryTest.kt @@ -250,7 +250,9 @@ class FileCompactBlockRepositoryTest { val tempFile = block.createTemporaryFile(blocksDir) - val finalizedFile = File(tempFile.absolutePath.dropLast(FileCompactBlockRepository.TEMPORARY_FILENAME_SUFFIX.length)) + val finalizedFile = File( + tempFile.absolutePath.dropLast(FileCompactBlockRepository.TEMPORARY_FILENAME_SUFFIX.length) + ) assertFalse { finalizedFile.existsSuspend() } tempFile.finalizeFile() diff --git a/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/jni/BranchIdTest.kt b/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/jni/BranchIdTest.kt index 8dae2521..310288b8 100644 --- a/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/jni/BranchIdTest.kt +++ b/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/jni/BranchIdTest.kt @@ -32,19 +32,28 @@ class BranchIdTest internal constructor( fun testBranchId_Hex() { val branchId = rustBackend.getBranchIdForHeight(height) val clientBranch = "%x".format(branchId) - assertEquals("Invalid branch Id Hex value for $networkName at height $height on ${rustBackend.network.networkName}", branchHex, clientBranch) + assertEquals( + "Invalid branch Id Hex value for $networkName at height $height on ${rustBackend.network.networkName}", + branchHex, + clientBranch + ) } @Test fun testBranchId_Numeric() { val actual = rustBackend.getBranchIdForHeight(height) - assertEquals("Invalid branch ID for $networkName at height $height on ${rustBackend.network.networkName}", branchId, actual) + assertEquals( + "Invalid branch ID for $networkName at height $height on ${rustBackend.network.networkName}", + branchId, + actual + ) } companion object { @JvmStatic @Parameterized.Parameters + @Suppress("LongMethod") fun wallets(): List> { // init values don't matter for this test because we're just checking branchIds, which // is an abnormal use of the SDK because this really should run at the rust level @@ -70,16 +79,64 @@ class BranchIdTest internal constructor( } return listOf( // Mainnet Cases - arrayOf("Sapling", BlockHeight.new(ZcashNetwork.Mainnet, 419_200), 1991772603L, "76b809bb", mainnetBackend), - arrayOf("Blossom", BlockHeight.new(ZcashNetwork.Mainnet, 653_600), 733220448L, "2bb40e60", mainnetBackend), - arrayOf("Heartwood", BlockHeight.new(ZcashNetwork.Mainnet, 903_000), 4122551051L, "f5b9230b", mainnetBackend), - arrayOf("Canopy", BlockHeight.new(ZcashNetwork.Mainnet, 1_046_400), 3925833126L, "e9ff75a6", mainnetBackend), + arrayOf( + "Sapling", + BlockHeight.new(ZcashNetwork.Mainnet, 419_200), + 1991772603L, + "76b809bb", + mainnetBackend + ), + arrayOf( + "Blossom", + BlockHeight.new(ZcashNetwork.Mainnet, 653_600), + 733220448L, + "2bb40e60", + mainnetBackend + ), + arrayOf( + "Heartwood", + BlockHeight.new(ZcashNetwork.Mainnet, 903_000), + 4122551051L, + "f5b9230b", + mainnetBackend + ), + arrayOf( + "Canopy", + BlockHeight.new(ZcashNetwork.Mainnet, 1_046_400), + 3925833126L, + "e9ff75a6", + mainnetBackend + ), // Testnet Cases - arrayOf("Sapling", BlockHeight.new(ZcashNetwork.Testnet, 280_000), 1991772603L, "76b809bb", testnetBackend), - arrayOf("Blossom", BlockHeight.new(ZcashNetwork.Testnet, 584_000), 733220448L, "2bb40e60", testnetBackend), - arrayOf("Heartwood", BlockHeight.new(ZcashNetwork.Testnet, 903_800), 4122551051L, "f5b9230b", testnetBackend), - arrayOf("Canopy", BlockHeight.new(ZcashNetwork.Testnet, 1_028_500), 3925833126L, "e9ff75a6", testnetBackend) + arrayOf( + "Sapling", + BlockHeight.new(ZcashNetwork.Testnet, 280_000), + 1991772603L, + "76b809bb", + testnetBackend + ), + arrayOf( + "Blossom", + BlockHeight.new(ZcashNetwork.Testnet, 584_000), + 733220448L, + "2bb40e60", + testnetBackend + ), + arrayOf( + "Heartwood", + BlockHeight.new(ZcashNetwork.Testnet, 903_800), + 4122551051L, + "f5b9230b", + testnetBackend + ), + arrayOf( + "Canopy", + BlockHeight.new(ZcashNetwork.Testnet, 1_028_500), + 3925833126L, + "e9ff75a6", + testnetBackend + ) ) } } diff --git a/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/jni/TransparentTest.kt b/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/jni/TransparentTest.kt index 6d0928a3..b2e569c8 100644 --- a/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/jni/TransparentTest.kt +++ b/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/jni/TransparentTest.kt @@ -39,10 +39,12 @@ class TransparentTest(val expected: Expected, val network: ZcashNetwork) { } companion object { - const val PHRASE = "deputy visa gentle among clean scout farm drive comfort patch skin salt ranch cool ramp warrior drink narrow normal lunch behind salt deal person" + const val PHRASE = "deputy visa gentle among clean scout farm drive comfort patch skin salt ranch cool ramp" + + " warrior drink narrow normal lunch behind salt deal person" val MNEMONIC = MnemonicCode(PHRASE) val SEED = MNEMONIC.toSeed() + @Suppress("MaxLineLength") object ExpectedMainnet : Expected { override val tAddr = "t1PKtYdJJHhc3Pxowmznkg7vdTwnhEsCvR4" override val zAddr = "zs1yc4sgtfwwzz6xfsy2xsradzr6m4aypgxhfw2vcn3hatrh5ryqsr08sgpemlg39vdh9kfupx20py" @@ -52,6 +54,7 @@ class TransparentTest(val expected: Expected, val network: ZcashNetwork) { override val tpk = "03b1d7fb28d17c125b504d06b1530097e0a3c76ada184237e3bc0925041230a5af" } + @Suppress("MaxLineLength") object ExpectedTestnet : Expected { override val tAddr = "tm9v3KTsjXK8XWSqiwFjic6Vda6eHY9Mjjq" override val zAddr = "ztestsapling1wn3tw9w5rs55x5yl586gtk72e8hcfdq8zsnjzcu8p7ghm8lrx54axc74mvm335q7lmy3g0sqje6" diff --git a/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/sample/ShieldFundsSample.kt b/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/sample/ShieldFundsSample.kt index 2a0c4fbf..c770f305 100644 --- a/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/sample/ShieldFundsSample.kt +++ b/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/sample/ShieldFundsSample.kt @@ -13,7 +13,10 @@ import org.junit.Test */ class ShieldFundsSample { - val SEED_PHRASE = "still champion voice habit trend flight survey between bitter process artefact blind carbon truly provide dizzy crush flush breeze blouse charge solid fish spread" // \"//\"deputy visa gentle among clean scout farm drive comfort patch skin salt ranch cool ramp warrior drink narrow normal lunch behind salt deal person"//"deputy visa gentle among clean scout farm drive comfort patch skin salt ranch cool ramp warrior drink narrow normal lunch behind salt deal person" + val SEED_PHRASE = "still champion voice habit trend flight survey between bitter process artefact blind carbon" + + " truly provide dizzy crush flush breeze blouse charge solid fish spread" + // "deputy visa gentle among clean scout farm drive comfort patch skin salt ranch cool ramp warrior drink narrow + // normal lunch behind salt deal person" /** * This test will construct a t2z transaction. It is safe to run this repeatedly, because diff --git a/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/sample/TransparentRestoreSample.kt b/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/sample/TransparentRestoreSample.kt index b42caf13..2f05e964 100644 --- a/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/sample/TransparentRestoreSample.kt +++ b/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/sample/TransparentRestoreSample.kt @@ -1,3 +1,5 @@ +@file:Suppress("MaxLineLength") + package cash.z.ecc.android.sdk.sample import androidx.test.filters.LargeTest @@ -55,7 +57,11 @@ class TransparentRestoreSample { val tbalance = wallet.transparentBalance() val address = wallet.transparentAddress - Assert.assertTrue("Not enough funds to run sample. Expected some Zatoshi but found ${tbalance.available}. Try adding funds to $address", tbalance.available.value > 0) + Assert.assertTrue( + "Not enough funds to run sample. Expected some Zatoshi but found ${tbalance.available}. " + + "Try adding funds to $address", + tbalance.available.value > 0 + ) // wallet.shieldFunds() } diff --git a/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/util/TestWallet.kt b/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/util/TestWallet.kt index a15ce35a..992dbae8 100644 --- a/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/util/TestWallet.kt +++ b/sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/util/TestWallet.kt @@ -145,10 +145,11 @@ class TestWallet( } enum class Backups(val seedPhrase: String, val testnetBirthday: BlockHeight, val mainnetBirthday: BlockHeight) { - // TODO: [#902] Get the proper birthday values for test wallets - // TODO: [#902] https://github.com/zcash/zcash-android-wallet-sdk/issues/902 + // TODO [#902]: Get the proper birthday values for test wallets + // TODO [#902]: https://github.com/zcash/zcash-android-wallet-sdk/issues/902 DEFAULT( - "column rhythm acoustic gym cost fit keen maze fence seed mail medal shrimp tell relief clip cannon foster soldier shallow refuse lunar parrot banana", + "column rhythm acoustic gym cost fit keen maze fence seed mail medal shrimp tell relief clip" + + " cannon foster soldier shallow refuse lunar parrot banana", BlockHeight.new( ZcashNetwork.Testnet, 1_355_928 @@ -156,7 +157,8 @@ class TestWallet( BlockHeight.new(ZcashNetwork.Mainnet, 1_000_000) ), SAMPLE_WALLET( - "input frown warm senior anxiety abuse yard prefer churn reject people glimpse govern glory crumble swallow verb laptop switch trophy inform friend permit purpose", + "input frown warm senior anxiety abuse yard prefer churn reject people glimpse govern glory" + + " crumble swallow verb laptop switch trophy inform friend permit purpose", BlockHeight.new( ZcashNetwork.Testnet, 1_330_190 @@ -164,7 +166,8 @@ class TestWallet( BlockHeight.new(ZcashNetwork.Mainnet, 1_000_000) ), DEV_WALLET( - "still champion voice habit trend flight survey between bitter process artefact blind carbon truly provide dizzy crush flush breeze blouse charge solid fish spread", + "still champion voice habit trend flight survey between bitter process artefact blind carbon" + + " truly provide dizzy crush flush breeze blouse charge solid fish spread", BlockHeight.new( ZcashNetwork.Testnet, 1_000_000 @@ -172,7 +175,8 @@ class TestWallet( BlockHeight.new(ZcashNetwork.Mainnet, 991645) ), ALICE( - "quantum whisper lion route fury lunar pelican image job client hundred sauce chimney barely life cliff spirit admit weekend message recipe trumpet impact kitten", + "quantum whisper lion route fury lunar pelican image job client hundred sauce chimney barely" + + " life cliff spirit admit weekend message recipe trumpet impact kitten", BlockHeight.new( ZcashNetwork.Testnet, 1_330_190 @@ -180,7 +184,8 @@ class TestWallet( BlockHeight.new(ZcashNetwork.Mainnet, 1_000_000) ), BOB( - "canvas wine sugar acquire garment spy tongue odor hole cage year habit bullet make label human unit option top calm neutral try vocal arena", + "canvas wine sugar acquire garment spy tongue odor hole cage year habit bullet make label human" + + " unit option top calm neutral try vocal arena", BlockHeight.new( ZcashNetwork.Testnet, 1_330_190 diff --git a/sdk-lib/src/main/java/cash/z/ecc/android/sdk/Synchronizer.kt b/sdk-lib/src/main/java/cash/z/ecc/android/sdk/Synchronizer.kt index 42964bb6..5a7c0e99 100644 --- a/sdk-lib/src/main/java/cash/z/ecc/android/sdk/Synchronizer.kt +++ b/sdk-lib/src/main/java/cash/z/ecc/android/sdk/Synchronizer.kt @@ -186,7 +186,7 @@ interface Synchronizer { /** * Returns true when the given address is a valid z-addr. Invalid addresses will throw an - * exception. Valid z-addresses have these characteristics: //TODO copy info from related ZIP + * exception. See valid z-addresses characteristics in related ZIP. * * @param address the address to validate. * @@ -198,7 +198,7 @@ interface Synchronizer { /** * Returns true when the given address is a valid t-addr. Invalid addresses will throw an - * exception. Valid t-addresses have these characteristics: //TODO copy info from related ZIP + * exception. See valid t-addresses characteristics in related ZIP. * * @param address the address to validate. * diff --git a/sdk-lib/src/main/java/cash/z/ecc/android/sdk/block/CompactBlockProcessor.kt b/sdk-lib/src/main/java/cash/z/ecc/android/sdk/block/CompactBlockProcessor.kt index ac12f8c2..1daf0298 100644 --- a/sdk-lib/src/main/java/cash/z/ecc/android/sdk/block/CompactBlockProcessor.kt +++ b/sdk-lib/src/main/java/cash/z/ecc/android/sdk/block/CompactBlockProcessor.kt @@ -480,7 +480,7 @@ class CompactBlockProcessor internal constructor( runCatching { info.blockHeightUnsafe.toBlockHeight(network) }.getOrNull() if (null == serverBlockHeight) { - // TODO Better signal network connection issue + // Note: we could better signal network connection issue CompactBlockProcessorException.BadBlockHeight(info.blockHeightUnsafe) } else { val clientBranch = "%x".format( @@ -534,7 +534,7 @@ class CompactBlockProcessor internal constructor( internal suspend fun refreshUtxos(account: Account, startHeight: BlockHeight): Int { Twig.debug { "Checking for UTXOs above height $startHeight" } var count = 0 - // TODO [683]: cleanup the way that we prevent this from running excessively + // TODO [#683]: cleanup the way that we prevent this from running excessively // For now, try for about 3 blocks per app launch. If the service fails it is // probably disabled on ligthtwalletd, so then stop trying until the next app launch. // TODO [#683]: https://github.com/zcash/zcash-android-wallet-sdk/issues/683 @@ -606,7 +606,7 @@ class CompactBlockProcessor internal constructor( * @return True in case of the UTXO processed successfully, false otherwise */ internal suspend fun processUtxoResult(utxo: GetAddressUtxosReplyUnsafe): Boolean { - // TODO(str4d): We no longer clear UTXOs here, as rustBackend.putUtxo now uses an upsert instead of an insert. + // Note (str4d): We no longer clear UTXOs here, as rustBackend.putUtxo now uses an upsert instead of an insert. // This means that now-spent UTXOs would previously have been deleted, but now are left in the database (like // shielded notes). Due to the fact that the lightwalletd query only returns _current_ UTXOs, we don't learn // about recently-spent UTXOs here, so the transparent balance does not get updated here. Instead, when a diff --git a/sdk-lib/src/main/java/cash/z/ecc/android/sdk/internal/block/CompactBlockDownloader.kt b/sdk-lib/src/main/java/cash/z/ecc/android/sdk/internal/block/CompactBlockDownloader.kt index c282ade4..6b1d7c77 100644 --- a/sdk-lib/src/main/java/cash/z/ecc/android/sdk/internal/block/CompactBlockDownloader.kt +++ b/sdk-lib/src/main/java/cash/z/ecc/android/sdk/internal/block/CompactBlockDownloader.kt @@ -92,7 +92,7 @@ open class CompactBlockDownloader private constructor(val compactBlockRepository * @param height the height to which the data will rewind. */ suspend fun rewindToHeight(height: BlockHeight) = - // TODO [#685]: cancel anything in flight + // TODO [#685]: Cancel anything in flight // TODO [#685]: https://github.com/zcash/zcash-android-wallet-sdk/issues/685 compactBlockRepository.rewindTo(height) diff --git a/tools/detekt-baseline.xml b/tools/detekt-baseline.xml index 2c083678..32acc0ba 100644 --- a/tools/detekt-baseline.xml +++ b/tools/detekt-baseline.xml @@ -39,14 +39,14 @@ UnusedPrivateProperty:InboundTxTests.kt$InboundTxTests.Companion$private val txRecv = arrayOf( "https://raw.githubusercontent.com/zcash-hackworks/darksidewalletd-test-data/master/transactions/recv/8f064d23c66dc36e32445e5f3b50e0f32ac3ddb78cff21fb521eb6c19c07c99a.txt", "https://raw.githubusercontent.com/zcash-hackworks/darksidewalletd-test-data/master/transactions/recv/15a677b6770c5505fb47439361d3d3a7c21238ee1a6874fdedad18ae96850590.txt", "https://raw.githubusercontent.com/zcash-hackworks/darksidewalletd-test-data/master/transactions/recv/d2e7be14bbb308f9d4d68de424d622cbf774226d01cd63cc6f155fafd5cd212c.txt", "https://raw.githubusercontent.com/zcash-hackworks/darksidewalletd-test-data/master/transactions/recv/e6566be3a4f9a80035dab8e1d97e40832a639e3ea938fb7972ea2f8482ff51ce.txt", "https://raw.githubusercontent.com/zcash-hackworks/darksidewalletd-test-data/master/transactions/recv/0821a89be7f2fc1311792c3fa1dd2171a8cdfb2effd98590cbd5ebcdcfcf491f.txt", "https://raw.githubusercontent.com/zcash-hackworks/darksidewalletd-test-data/master/transactions/recv/e9527891b5d43d1ac72f2c0a3ac18a33dc5a0529aec04fa600616ed35f8123f8.txt", "https://raw.githubusercontent.com/zcash-hackworks/darksidewalletd-test-data/master/transactions/recv/4dcc95dd0a2f1f51bd64bb9f729b423c6de1690664a1b6614c75925e781662f7.txt", "https://raw.githubusercontent.com/zcash-hackworks/darksidewalletd-test-data/master/transactions/recv/75f2cdd2ff6a94535326abb5d9e663d53cbfa5f31ebb24b4d7e420e9440d41a2.txt", "https://raw.githubusercontent.com/zcash-hackworks/darksidewalletd-test-data/master/transactions/recv/7690c8ec740c1be3c50e2aedae8bf907ac81141ae8b6a134c1811706c73f49a6.txt", "https://raw.githubusercontent.com/zcash-hackworks/darksidewalletd-test-data/master/transactions/recv/71935e29127a7de0b96081f4c8a42a9c11584d83adedfaab414362a6f3d965cf.txt" ) UnusedPrivateProperty:InboundTxTests.kt$InboundTxTests.Companion$private val txSend = arrayOf( "https://raw.githubusercontent.com/zcash-hackworks/darksidewalletd-test-data/master/transactions/t-shielded-spend.txt", "https://raw.githubusercontent.com/zcash-hackworks/darksidewalletd-test-data/master/transactions/sent/c9e35e6ff444b071d63bf9bab6480409d6361760445c8a28d24179adb35c2495.txt", "https://raw.githubusercontent.com/zcash-hackworks/darksidewalletd-test-data/master/transactions/sent/72a29d7db511025da969418880b749f7fc0fc910cdb06f52193b5fa5c0401d9d.txt", "https://raw.githubusercontent.com/zcash-hackworks/darksidewalletd-test-data/master/transactions/sent/ff6ea36765dc29793775c7aa71de19fca039c5b5b873a0497866e9c4bc48af01.txt", "https://raw.githubusercontent.com/zcash-hackworks/darksidewalletd-test-data/master/transactions/sent/34e507cab780546f980176f3ff2695cd404917508c7e5ee18cc1d2ff3858cb08.txt", "https://raw.githubusercontent.com/zcash-hackworks/darksidewalletd-test-data/master/transactions/sent/6edf869063eccff3345676b0fed9f1aa6988fb2524e3d9ca7420a13cfadcd76c.txt", "https://raw.githubusercontent.com/zcash-hackworks/darksidewalletd-test-data/master/transactions/sent/de97394ae220c28a33ba78b944e82dabec8cb404a4407650b134b3d5950358c0.txt", "https://raw.githubusercontent.com/zcash-hackworks/darksidewalletd-test-data/master/transactions/sent/4eaa902279f8380914baf5bcc470d8b7c11d84fda809f67f517a7cb48912b87b.txt", "https://raw.githubusercontent.com/zcash-hackworks/darksidewalletd-test-data/master/transactions/sent/73c5edf8ffba774d99155121ccf07e67fbcf14284458f7e732751fea60d3bcbc.txt" ) UnusedPrivateProperty:LightWalletClientImplTest.kt$LightWalletClientImplTest$private val channelFactory = AndroidChannelFactory(getAppContext()) - UnusedPrivateProperty:SetupTest.kt$SetupTest.Companion$private const val blocksUrl = "https://raw.githubusercontent.com/zcash-hackworks/darksidewalletd-test-data/master/basic-reorg/before-reorg.txt" + UnusedPrivateProperty:SetupTest.kt$SetupTest.Companion$@Suppress("MaxLineLength") private const val blocksUrl = "https://raw.githubusercontent.com/zcash-hackworks/darksidewalletd-test-data/master/basic-reorg/before-reorg.txt" UnusedPrivateProperty:SetupTest.kt$SetupTest.Companion$private const val firstBlock = 663150 UnusedPrivateProperty:SetupTest.kt$SetupTest.Companion$private const val lastBlock = 663200 UnusedPrivateProperty:SetupTest.kt$SetupTest.Companion$private const val lastBlockHash = "2fc7b4682f5ba6ba6f86e170b40f0aa9302e1d3becb2a6ee0db611ff87835e4a" - UnusedPrivateProperty:TestnetIntegrationTest.kt$TestnetIntegrationTest.Companion$private const val seedPhrase = "still champion voice habit trend flight survey between bitter process artefact blind carbon truly provide dizzy crush flush breeze blouse charge solid fish spread" + UnusedPrivateProperty:TestnetIntegrationTest.kt$TestnetIntegrationTest.Companion$private const val seedPhrase = "still champion voice habit trend flight survey between bitter process" + " artefact blind carbon truly provide dizzy crush flush breeze blouse charge solid fish spread" UnusedPrivateProperty:TestnetIntegrationTest.kt$TestnetIntegrationTest.Companion$private const val targetHeight = 663250 VariableNaming:FakeRustBackendFixture.kt$FakeRustBackendFixture$private val DEFAULT_NETWORK = ZcashNetwork.Testnet - VariableNaming:ShieldFundsSample.kt$ShieldFundsSample$val SEED_PHRASE = "still champion voice habit trend flight survey between bitter process artefact blind carbon truly provide dizzy crush flush breeze blouse charge solid fish spread" // \"//\"deputy visa gentle among clean scout farm drive comfort patch skin salt ranch cool ramp warrior drink narrow normal lunch behind salt deal person"//"deputy visa gentle among clean scout farm drive comfort patch skin salt ranch cool ramp warrior drink narrow normal lunch behind salt deal person" + VariableNaming:ShieldFundsSample.kt$ShieldFundsSample$val SEED_PHRASE = "still champion voice habit trend flight survey between bitter process artefact blind carbon" + " truly provide dizzy crush flush breeze blouse charge solid fish spread" VariableNaming:TransparentRestoreSample.kt$TransparentRestoreSample$val TX_VALUE = Zatoshi(ZcashSdk.MINERS_FEE.value / 2) diff --git a/tools/detekt.yml b/tools/detekt.yml index 10ec435d..5e1aa20a 100644 --- a/tools/detekt.yml +++ b/tools/detekt.yml @@ -13,20 +13,24 @@ style: ForbiddenComment: active: true comments: - - reason: 'Forbidden FIXME todo marker in comment, please fix the problem.' - value: 'FIXME:' - - reason: 'Forbidden TODO todo marker in comment, please fix the problem or add the issue number (e.g. TODO [#123]).' - value: 'TODO:(?! \[[^\]]\d+\])' - MaxLineLength: - active: false + - reason: 'Forbidden FIXME todo marker in comment, please fix the problem. Or include issue number prefix for + FIXME comments, e.g. `FIXME [#123]: Fix this later`' + value: 'FIXME' + - reason: 'Forbidden STOPSHIP todo marker in comment, please address the problem before shipping the code. Or + include issue number prefix for STOPSHIP comments, e.g. `STOPSHIP [#123]: Fix this later`' + value: 'STOPSHIP' + - reason: 'Forbidden TODO todo marker in comment, please do the changes. Or include issue number prefix for TODO + comments, e.g. `TODO [#123]: Fix this later`' + value: 'TODO' + allowedPatterns: '[TODO|FIXME|STOPSHIP]+\s\[#\d+\]:\s.+' NewLineAtEndOfFile: active: false UnusedPrivateMember: active: true allowedNames: '(_|ignored|expected|serialVersionUID)' excludes: [ '**/*.kts' ] - WildcardImport: - active: false + ignoreAnnotated: + - 'Preview' Compose: ModifierMissing: