Skip to content

Commit 0382f6a

Browse files
committed
chore: lint
1 parent e790017 commit 0382f6a

File tree

2 files changed

+6
-17
lines changed

2 files changed

+6
-17
lines changed

app/detekt-baseline.xml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,8 @@
3333
<ID>EnumNaming:BlocktankNotificationType.kt$BlocktankNotificationType$orderPaymentConfirmed</ID>
3434
<ID>EnumNaming:BlocktankNotificationType.kt$BlocktankNotificationType$wakeToTimeout</ID>
3535
<ID>ForbiddenComment:ActivityDetailScreen.kt$/* TODO: Implement assign functionality */</ID>
36-
<ID>ForbiddenComment:ActivityRow.kt$// TODO: calculate confirmsIn text</ID>
3736
<ID>ForbiddenComment:BoostTransactionViewModel.kt$BoostTransactionUiState$// TODO: Implement dynamic time estimation</ID>
3837
<ID>ForbiddenComment:ContentView.kt$// TODO: display as sheet</ID>
39-
<ID>ForbiddenComment:Env.kt$Env$// TODO: remove this to load from BT API instead</ID>
4038
<ID>ForbiddenComment:ExternalNodeViewModel.kt$ExternalNodeViewModel$// TODO: pass customFeeRate to ldk-node when supported</ID>
4139
<ID>ForbiddenComment:LightningConnectionsViewModel.kt$LightningConnectionsViewModel$// TODO: sort channels to get consistent index; node.listChannels returns a list in random order</ID>
4240
<ID>ForbiddenComment:LightningService.kt$LightningService$// TODO: cleanup sensitive data after implementing a `SecureString` value holder for Keychain return values</ID>
@@ -60,15 +58,12 @@
6058
<ID>LongParameterList:CoreService.kt$OnchainService$( mnemonicPhrase: String, derivationPathStr: String?, network: Network?, bip39Passphrase: String?, isChange: Boolean?, startIndex: UInt?, count: UInt?, )</ID>
6159
<ID>LongParameterList:WidgetsRepo.kt$WidgetsRepo$( @BgDispatcher private val bgDispatcher: CoroutineDispatcher, private val newsService: NewsService, private val factsService: FactsService, private val blocksService: BlocksService, private val weatherService: WeatherService, private val priceService: PriceService, private val widgetsStore: WidgetsStore, private val settingsStore: SettingsStore, )</ID>
6260
<ID>LoopWithTooManyJumpStatements:MonetaryVisualTransformation.kt$MonetaryVisualTransformation.&lt;no name provided&gt;$for</ID>
63-
<ID>MagicNumber:ActivityDetailScreen.kt$40</ID>
64-
<ID>MagicNumber:ActivityExploreScreen.kt$40</ID>
6561
<ID>MagicNumber:ActivityListViewModel.kt$ActivityListViewModel$300</ID>
6662
<ID>MagicNumber:AddressViewerScreen.kt$1500000L</ID>
6763
<ID>MagicNumber:AddressViewerScreen.kt$250000L</ID>
6864
<ID>MagicNumber:AddressViewerViewModel.kt$AddressViewerViewModel$300</ID>
6965
<ID>MagicNumber:AppStatus.kt$0.4f</ID>
7066
<ID>MagicNumber:ArticleModel.kt$24</ID>
71-
<ID>MagicNumber:ArticleModel.kt$30</ID>
7267
<ID>MagicNumber:ArticleModel.kt$60</ID>
7368
<ID>MagicNumber:BackupNavSheetViewModel.kt$BackupNavSheetViewModel$200</ID>
7469
<ID>MagicNumber:ChannelDetailScreen.kt$1.5f</ID>
@@ -97,7 +92,6 @@
9792
<ID>MagicNumber:ShowMnemonicScreen.kt$12</ID>
9893
<ID>MagicNumber:ShowMnemonicScreen.kt$24</ID>
9994
<ID>MagicNumber:ShowMnemonicScreen.kt$300</ID>
100-
<ID>MagicNumber:Slider.kt$20</ID>
10195
<ID>MagicNumber:SpendingConfirmScreen.kt$300</ID>
10296
<ID>MagicNumber:SwipeToConfirm.kt$1500</ID>
10397
<ID>MatchingDeclarationName:AddressType.kt$AddressTypeInfo</ID>
@@ -118,7 +112,6 @@
118112
<ID>MaxLineLength:HeadlineCard.kt$headline = "How Bitcoin changed El Salvador in more ways a big headline to test the text overflooooooow"</ID>
119113
<ID>MaxLineLength:LightningBalance.kt$is LightningBalance.ClaimableAwaitingConfirmations -&gt; "Claimable Awaiting Confirmations (Height: $confirmationHeight)"</ID>
120114
<ID>MaxLineLength:LightningConnectionsScreen.kt$if (showClosed) R.string.lightning__conn_closed_hide else R.string.lightning__conn_closed_show</ID>
121-
<ID>MaxLineLength:LightningRepo.kt$LightningRepo$"Cannot execute $operationName: Node is ${_lightningState.value.nodeLifecycleState} and not starting"</ID>
122115
<ID>MaxLineLength:LightningRepo.kt$LightningRepo$"accelerateByCpfp error originalTxId: $originalTxId, satsPerVByte: $satsPerVByte destinationAddress: $destinationAddress"</ID>
123116
<ID>MaxLineLength:LightningRepo.kt$LightningRepo$"accelerateByCpfp success, newDestinationTxId: $newDestinationTxId originalTxId: $originalTxId, satsPerVByte: $satsPerVByte destinationAddress: $destinationAddress"</ID>
124117
<ID>MaxLineLength:LightningRepo.kt$LightningRepo$"bumpFeeByRbf success, replacementTxId: $replacementTxId originalTxId: $originalTxId, satsPerVByte: $satsPerVByte"</ID>
@@ -144,14 +137,11 @@
144137
<ID>MaximumLineLength:SettingsScreen.kt$ </ID>
145138
<ID>MaximumLineLength:WeatherService.kt$WeatherService$ </ID>
146139
<ID>MayBeConst:Env.kt$Env$val walletSyncIntervalSecs = 10_uL // TODO review</ID>
147-
<ID>MayBeConst:Env.kt$Env.TransactionDefaults$/** * Minimum value in sats for an output. Outputs below the dust limit may not be processed because the fees * required to include them in a block would be greater than the value of the transaction itself. * */ val dustLimit = 546u</ID>
148-
<ID>MayBeConst:Env.kt$Env.TransactionDefaults$/** Total recommended tx base fee in sats */ val recommendedBaseFee = 256u</ID>
149140
<ID>MemberNameEqualsClassName:Keychain.kt$Keychain$private val keychain = context.keychainDataStore</ID>
150141
<ID>NestedBlockDepth:Context.kt$fun Context.copyAssetToStorage(asset: String, dest: String)</ID>
151142
<ID>NestedBlockDepth:LogsRepo.kt$LogsRepo$private fun createZipBase64(logFiles: List&lt;LogFile&gt;): String</ID>
152143
<ID>NestedBlockDepth:MonetaryVisualTransformation.kt$MonetaryVisualTransformation$private fun createOffsetMapping(original: String, transformed: String): OffsetMapping</ID>
153144
<ID>NestedBlockDepth:ShopWebViewInterface.kt$ShopWebViewInterface$@JavascriptInterface fun postMessage(message: String)</ID>
154-
<ID>NoUnusedImports:ActivityDetailScreen.kt$to.bitkit.ui.screens.wallets.activity.ActivityDetailScreen.kt</ID>
155145
<ID>NoWildcardImports:LightningChannel.kt$import androidx.compose.foundation.layout.*</ID>
156146
<ID>PrintStackTrace:ShareSheet.kt$e</ID>
157147
<ID>ReturnCount:AppViewModel.kt$AppViewModel$private suspend fun handleSanityChecks(amountSats: ULong)</ID>

app/src/main/java/to/bitkit/repositories/LightningRepo.kt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,26 +119,25 @@ class LightningRepo @Inject constructor(
119119
): Result<T> = withContext(bgDispatcher) {
120120
Logger.verbose("Operation called: $operationName", context = TAG)
121121

122-
if (_lightningState.value.nodeLifecycleState.isRunning()) {
122+
val nodeLifecycleState = _lightningState.value.nodeLifecycleState
123+
if (nodeLifecycleState.isRunning()) {
123124
return@withContext executeOperation(operationName, operation)
124125
}
125126

126127
// If node is not in a state that can become running, fail fast
127-
if (!_lightningState.value.nodeLifecycleState.canRun()) {
128+
if (!nodeLifecycleState.canRun()) {
128129
return@withContext Result.failure(
129-
Exception(
130-
"Cannot execute '$operationName': Node is ${_lightningState.value.nodeLifecycleState} and not starting"
131-
)
130+
Exception("Cannot execute '$operationName': node is '$nodeLifecycleState' and not starting")
132131
)
133132
}
134133

135134
val nodeRunning = withTimeoutOrNull(waitTimeout) {
136-
if (_lightningState.value.nodeLifecycleState.isRunning()) {
135+
if (nodeLifecycleState.isRunning()) {
137136
return@withTimeoutOrNull true
138137
}
139138

140139
// Otherwise, wait for it to transition to running state
141-
Logger.verbose("Waiting for node runs to execute '$operationName'", context = TAG)
140+
Logger.verbose("Waiting for node to run before executing '$operationName'", context = TAG)
142141
_lightningState.first { it.nodeLifecycleState.isRunning() }
143142
Logger.debug("Operation executed: '$operationName'", context = TAG)
144143
true

0 commit comments

Comments
 (0)