Skip to content

Commit 1fd0679

Browse files
HekmatullahAminNagarjuna0033
authored andcommitted
refactor: Configure & Fix Detekt Issues for KMP (openMF#2765)
1 parent 460f3ad commit 1fd0679

File tree

56 files changed

+710
-530
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+710
-530
lines changed

build-logic/convention/src/main/kotlin/org/mifos/mobile/Detekt.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ import org.gradle.kotlin.dsl.named
99
internal fun Project.configureDetekt(extension: DetektExtension) = extension.apply {
1010
tasks.named<Detekt>("detekt") {
1111
jvmTarget = "17"
12+
source(files(rootDir))
13+
include("**/*.kt")
14+
exclude("**/*.kts")
15+
exclude("**/resources/**")
16+
exclude("**/build/**")
17+
exclude("**/generated/**")
18+
exclude("**/build-logic/**")
19+
exclude("**/spotless/**")
1220
reports {
1321
xml.required.set(true)
1422
html.required.set(true)

cmp-navigation/src/commonMain/kotlin/cmp/navigation/navigation/FeatureNavHost.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const val WELCOME_ROUTE = "home_route"
2626
@Composable
2727
internal fun FeatureNavHost(
2828
appState: AppState,
29-
onClickLogout: () -> Unit,
29+
// onClickLogout: () -> Unit,
3030
modifier: Modifier = Modifier,
3131
) {
3232
NavHost(
@@ -46,9 +46,11 @@ fun NavGraphBuilder.homeScreen() {
4646
}
4747

4848
@Composable
49-
fun WelcomeScreen() {
49+
fun WelcomeScreen(
50+
modifier: Modifier = Modifier,
51+
) {
5052
Column(
51-
modifier = Modifier.fillMaxSize(),
53+
modifier = modifier.fillMaxSize(),
5254
verticalArrangement = Arrangement.Center,
5355
horizontalAlignment = Alignment.CenterHorizontally,
5456
) {

cmp-navigation/src/commonMain/kotlin/cmp/navigation/navigation/RootNavGraph.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ fun RootNavGraph(
3232
) {
3333
composable(MAIN_GRAPH) {
3434
App(
35-
modifier = modifier,
3635
networkMonitor = networkMonitor,
3736
)
3837
}

cmp-navigation/src/commonMain/kotlin/cmp/navigation/ui/App.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ fun App(
7979
) {
8080
FeatureNavHost(
8181
appState = appState,
82-
onClickLogout = {},
82+
// onClickLogout = {},
8383
modifier = Modifier,
8484
)
8585
}

config/detekt/detekt.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,13 @@ naming:
450450
MatchingDeclarationName:
451451
active: true
452452
mustBeFirst: true
453+
excludes:
454+
- "**/*.jvm.kt"
455+
- "**/*.desktop.kt"
456+
- "**/*.wasmJs.kt"
457+
- "**/*.native.kt"
458+
- "**/*.js.kt"
459+
- "**/*.android.kt"
453460
MemberNameEqualsClassName:
454461
active: true
455462
ignoreOverridden: true

core/common/src/commonMain/kotlin/org/mifos/mobile/core/common/utils/StringExtensions.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ fun maskString(input: String, maskChar: Char = '*'): String {
2828
}
2929
}
3030

31-
fun String.capitalizeWords(): String = split(" ").joinToString(" ") { it ->
32-
it.replaceFirstChar { if (it.isLowerCase()) it.titlecase() else it.toString() }
31+
fun String.capitalizeWords(): String = split(" ").joinToString(" ") { string ->
32+
string.replaceFirstChar { if (it.isLowerCase()) it.titlecase() else it.toString() }
3333
}

core/database/src/commonMain/kotlin/org/mifos/mobile/core/database/Room.kt

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,11 @@ expect annotation class Entity(
5858
val ignoredColumns: Array<String>,
5959
)
6060

61-
class OnConflictStrategy {
62-
companion object {
63-
const val NONE = 0
64-
const val REPLACE = 1
65-
const val ROLLBACK = 2
66-
const val ABORT = 3
67-
const val FAIL = 4
68-
const val IGNORE = 5
69-
}
61+
object OnConflictStrategy {
62+
const val NONE = 0
63+
const val REPLACE = 1
64+
const val ROLLBACK = 2
65+
const val ABORT = 3
66+
const val FAIL = 4
67+
const val IGNORE = 5
7068
}

core/datastore/src/commonMain/kotlin/org/mifos/mobile/core/datastore/UserPreferencesRepositoryImpl.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import org.mifos.mobile.core.datastore.model.UserData
2222

2323
class UserPreferencesRepositoryImpl(
2424
private val preferenceManager: UserPreferencesDataSource,
25-
private val ioDispatcher: CoroutineDispatcher,
25+
// private val ioDispatcher: CoroutineDispatcher,
2626
unconfinedDispatcher: CoroutineDispatcher,
2727
) : UserPreferencesRepository {
2828
private val unconfinedScope = CoroutineScope(unconfinedDispatcher)

core/datastore/src/commonMain/kotlin/org/mifos/mobile/core/datastore/di/PreferenceModule.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ val PreferencesModule = module {
2929
single<UserPreferencesRepository> {
3030
UserPreferencesRepositoryImpl(
3131
preferenceManager = get(),
32-
ioDispatcher = get(named(MifosDispatchers.IO.name)),
32+
// ioDispatcher = get(named(MifosDispatchers.IO.name)),
3333
unconfinedDispatcher = get(named(MifosDispatchers.Unconfined.name)),
3434
)
3535
}

core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosLoadingDialog.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import org.mifos.mobile.core.designsystem.theme.MifosMobileTheme
3535
@Composable
3636
fun MifosLoadingDialog(
3737
visibilityState: LoadingDialogState,
38+
modifier: Modifier = Modifier,
3839
) {
3940
when (visibilityState) {
4041
is LoadingDialogState.Hidden -> Unit
@@ -51,7 +52,7 @@ fun MifosLoadingDialog(
5152
colors = CardDefaults.cardColors(
5253
containerColor = MaterialTheme.colorScheme.surfaceContainerHigh,
5354
),
54-
modifier = Modifier
55+
modifier = modifier
5556
.semantics {
5657
testTag = "AlertPopup"
5758
}

0 commit comments

Comments
 (0)