diff --git a/.github/workflows/lint-action.yml b/.github/workflows/lint-action.yml index d0a15a59..4c40f303 100644 --- a/.github/workflows/lint-action.yml +++ b/.github/workflows/lint-action.yml @@ -1,11 +1,14 @@ name: Lint Action -run-name: ${{ github.actor }} is testing out GitHub Actions 🚀 +run-name: Running KtLint for linting on: [pull_request] jobs: Lint-Action: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - name: GitHub Action for ktlint + uses: yutailang0119/action-ktlint@v3.1.0 + + + - - name: Run KtFormat - run: ./gradlew ktFormat diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/TextFieldAtom.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/TextFieldAtom.kt deleted file mode 100644 index 9a67addd..00000000 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/atoms/TextFieldAtom.kt +++ /dev/null @@ -1,14 +0,0 @@ -package com.kevinschildhorn.atomik.atomic.atoms - -/* -public class TextFieldAtom( - override val textColor: AtomikColor, - private val disabledTextColor: AtomikColor, - private val hintTextColor: AtomikColor, - override val borderColor: AtomikColor, - override val typography: AtomikTypography, - override val fontFamily: AtomikFontFamily?, -) : Atom(), TextAtom, BorderedAtom { - override val type: AtomType - get() = AtomType.TEXTFIELD -}*/ diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/molecules/OutlinedTextFieldMolecule.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/molecules/OutlinedTextFieldMolecule.kt index a4edccee..5c144c65 100644 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/molecules/OutlinedTextFieldMolecule.kt +++ b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/molecules/OutlinedTextFieldMolecule.kt @@ -35,17 +35,16 @@ public open class OutlinedTextFieldMolecule( override val unFocusedBorderColor: AtomikColor = focusedBorderColor, override val radius: Int, ) : TextFieldMolecule( - textAtom, - backgroundColorAtom, - hintTextAtom, - errorTextAtom, - disabledColorAtom, - cursorColor, - errorColor, -), + textAtom, + backgroundColorAtom, + hintTextAtom, + errorTextAtom, + disabledColorAtom, + cursorColor, + errorColor, + ), BorderedAtom, RoundedAtom { - @Composable public fun colors(): TextFieldColors { val textColor = textAtom.textColor.composeColor @@ -57,26 +56,26 @@ public open class OutlinedTextFieldMolecule( textColor = textColor, backgroundColor = backgroundColor, placeholderColor = - hintTextAtom?.textColor?.composeColor ?: backgroundColor.copy( - ContentAlpha.medium, - ), + hintTextAtom?.textColor?.composeColor ?: backgroundColor.copy( + ContentAlpha.medium, + ), cursorColor = cursorColor?.composeColor ?: textColor, focusedBorderColor = focusedBorderColor.composeColor, unfocusedBorderColor = unFocusedBorderColor.composeColor, disabledTextColor = - disabledColorAtom?.color?.composeColor - ?: textColor.copy(ContentAlpha.disabled), + disabledColorAtom?.color?.composeColor + ?: textColor.copy(ContentAlpha.disabled), disabledBorderColor = disabledColorAtom?.color?.composeColor ?: disabledBackgroundColor, disabledLabelColor = disabledColorAtom?.color?.composeColor ?: disabledBackgroundColor, disabledLeadingIconColor = - disabledColorAtom?.color?.composeColor - ?: disabledBackgroundColor, + disabledColorAtom?.color?.composeColor + ?: disabledBackgroundColor, disabledPlaceholderColor = - disabledColorAtom?.color?.composeColor - ?: disabledBackgroundColor, + disabledColorAtom?.color?.composeColor + ?: disabledBackgroundColor, disabledTrailingIconColor = - disabledColorAtom?.color?.composeColor - ?: disabledBackgroundColor, + disabledColorAtom?.color?.composeColor + ?: disabledBackgroundColor, errorCursorColor = errorColor?.composeColor ?: errorTextColor, errorBorderColor = errorColor?.composeColor ?: errorTextColor, errorLabelColor = errorColor?.composeColor ?: errorTextColor, diff --git a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/molecules/TextFieldMolecule.kt b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/molecules/TextFieldMolecule.kt index 62d5791e..45edde9e 100644 --- a/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/molecules/TextFieldMolecule.kt +++ b/atomik/src/commonMain/kotlin/com/kevinschildhorn/atomik/atomic/molecules/TextFieldMolecule.kt @@ -43,21 +43,27 @@ public open class TextFieldMolecule( return TextFieldDefaults.textFieldColors( textColor = textColor, backgroundColor = backgroundColor, - placeholderColor = hintTextAtom?.textColor?.composeColor ?: backgroundColor.copy( - ContentAlpha.medium, - ), + placeholderColor = + hintTextAtom?.textColor?.composeColor ?: backgroundColor.copy( + ContentAlpha.medium, + ), cursorColor = cursorColor?.composeColor ?: textColor, - disabledTextColor = disabledColorAtom?.color?.composeColor - ?: textColor.copy(ContentAlpha.disabled), - disabledIndicatorColor = disabledColorAtom?.color?.composeColor - ?: disabledBackgroundColor, + disabledTextColor = + disabledColorAtom?.color?.composeColor + ?: textColor.copy(ContentAlpha.disabled), + disabledIndicatorColor = + disabledColorAtom?.color?.composeColor + ?: disabledBackgroundColor, disabledLabelColor = disabledColorAtom?.color?.composeColor ?: disabledBackgroundColor, - disabledLeadingIconColor = disabledColorAtom?.color?.composeColor - ?: disabledBackgroundColor, - disabledPlaceholderColor = disabledColorAtom?.color?.composeColor - ?: disabledBackgroundColor, - disabledTrailingIconColor = disabledColorAtom?.color?.composeColor - ?: disabledBackgroundColor, + disabledLeadingIconColor = + disabledColorAtom?.color?.composeColor + ?: disabledBackgroundColor, + disabledPlaceholderColor = + disabledColorAtom?.color?.composeColor + ?: disabledBackgroundColor, + disabledTrailingIconColor = + disabledColorAtom?.color?.composeColor + ?: disabledBackgroundColor, errorCursorColor = errorColor?.composeColor ?: errorTextColor, errorIndicatorColor = errorColor?.composeColor ?: errorTextColor, errorLabelColor = errorColor?.composeColor ?: errorTextColor, diff --git a/shared/build.gradle.kts b/shared/build.gradle.kts index f1c8943d..a08359e5 100644 --- a/shared/build.gradle.kts +++ b/shared/build.gradle.kts @@ -113,3 +113,7 @@ android { multiplatformResources { multiplatformResourcesPackage = "com.kevinschildhorn.fotopresenter" // required } + +dependencies { + ktlintRuleset("com.twitter.compose.rules:ktlint:0.0.26") +} diff --git a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/atoms/LoginScreenAtoms.kt b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/atoms/LoginScreenAtoms.kt index b3b28f06..da75ce3a 100644 --- a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/atoms/LoginScreenAtoms.kt +++ b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/atoms/LoginScreenAtoms.kt @@ -33,11 +33,11 @@ object LoginScreenAtoms { disabledColor = FotoColors.disabled, radius = 15, textAtom = - SimpleTextAtom( - textColor = FotoColors.primaryText, - typography = FotoTypography.button, - fontFamily = null, - ), + SimpleTextAtom( + textColor = FotoColors.primaryText, + typography = FotoTypography.button, + fontFamily = null, + ), ) val textFieldMolecule = OutlinedTextFieldMolecule( diff --git a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/compose/LoginScreen.kt b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/compose/LoginScreen.kt index 78896a9a..52141fb2 100644 --- a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/compose/LoginScreen.kt +++ b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/compose/LoginScreen.kt @@ -33,11 +33,11 @@ fun LoginScreen( TitleView( "Foto", modifier = - Modifier.padding( - top = Padding.SMALL.dp, - start = Padding.STANDARD.dp, - bottom = Padding.LARGE.dp, - ), + Modifier.padding( + top = Padding.SMALL.dp, + start = Padding.STANDARD.dp, + bottom = Padding.LARGE.dp, + ), ) LoginScreenForm( uiState = uiState, diff --git a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/compose/common/ErrorView.kt b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/compose/common/ErrorView.kt index 9bbbf39f..65e73ae0 100644 --- a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/compose/common/ErrorView.kt +++ b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/compose/common/ErrorView.kt @@ -24,10 +24,10 @@ fun ErrorView( } Box( modifier = - configuredModifier.padding( - horizontal = atom.paddingHorizontal?.dp ?: 0.dp, - vertical = atom.paddingVertical?.dp ?: 0.dp, - ), + configuredModifier.padding( + horizontal = atom.paddingHorizontal?.dp ?: 0.dp, + vertical = atom.paddingVertical?.dp ?: 0.dp, + ), ) { Text( text = message, diff --git a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/compose/common/PrimaryButton.kt b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/compose/common/PrimaryButton.kt index 6adff0cd..96ff0768 100644 --- a/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/compose/common/PrimaryButton.kt +++ b/shared/src/commonMain/kotlin/com/kevinschildhorn/fotopresenter/ui/compose/common/PrimaryButton.kt @@ -26,10 +26,10 @@ fun PrimaryButton( modifier = modifier.height(44.dp), enabled = buttonState.enabled, colors = - ButtonDefaults.buttonColors( - backgroundColor = molecule.color.composeColor, - disabledBackgroundColor = molecule.disabledColor.composeColor, - ), + ButtonDefaults.buttonColors( + backgroundColor = molecule.color.composeColor, + disabledBackgroundColor = molecule.disabledColor.composeColor, + ), ) { if (buttonState.loading) { CircularProgressIndicator( diff --git a/shared/src/commonTest/kotlin/com/kevinschildhorn/fotopresenter/domain/AutoConnectUseCaseTest.kt b/shared/src/commonTest/kotlin/com/kevinschildhorn/fotopresenter/domain/AutoConnectUseCaseTest.kt index a4640bb6..e13e7367 100644 --- a/shared/src/commonTest/kotlin/com/kevinschildhorn/fotopresenter/domain/AutoConnectUseCaseTest.kt +++ b/shared/src/commonTest/kotlin/com/kevinschildhorn/fotopresenter/domain/AutoConnectUseCaseTest.kt @@ -30,13 +30,13 @@ class AutoConnectUseCaseTest : KoinTest { modules( testingModule( settings = - MapSettings( - KEY_HOSTNAME to "192.168.1.1", - KEY_USERNAME to "admin", - KEY_PASSWORD to "password", - KEY_SHAREDFOLDER to "Public", - KEY_AUTOCONNECT to false, - ), + MapSettings( + KEY_HOSTNAME to "192.168.1.1", + KEY_USERNAME to "admin", + KEY_PASSWORD to "password", + KEY_SHAREDFOLDER to "Public", + KEY_AUTOCONNECT to false, + ), ), ) } @@ -52,13 +52,13 @@ class AutoConnectUseCaseTest : KoinTest { modules( testingModule( settings = - MapSettings( - KEY_HOSTNAME to "google.com", - KEY_USERNAME to "admin", - KEY_PASSWORD to "password", - KEY_SHAREDFOLDER to "Public", - KEY_AUTOCONNECT to false, - ), + MapSettings( + KEY_HOSTNAME to "google.com", + KEY_USERNAME to "admin", + KEY_PASSWORD to "password", + KEY_SHAREDFOLDER to "Public", + KEY_AUTOCONNECT to false, + ), ), ) } @@ -83,13 +83,13 @@ class AutoConnectUseCaseTest : KoinTest { modules( testingModule( settings = - MapSettings( - KEY_HOSTNAME to "throw", - KEY_USERNAME to "admin", - KEY_PASSWORD to "password", - KEY_SHAREDFOLDER to "Public", - KEY_AUTOCONNECT to false, - ), + MapSettings( + KEY_HOSTNAME to "throw", + KEY_USERNAME to "admin", + KEY_PASSWORD to "password", + KEY_SHAREDFOLDER to "Public", + KEY_AUTOCONNECT to false, + ), ), ) }