Skip to content

Commit

Permalink
style: format code
Browse files Browse the repository at this point in the history
  • Loading branch information
Tgo1014 committed Mar 18, 2024
1 parent 005f652 commit 3583349
Show file tree
Hide file tree
Showing 25 changed files with 139 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ object StorageModuleTest {

@Singleton
@Provides
fun providesFakeBeerRepository(): ArtRepository = FakeArtRepository()
fun providesFakeArtRepository(): ArtRepository = FakeArtRepository()

}
1 change: 0 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ subprojects {
configure<SpotlessExtension> {
kotlin {
ktlint()
.setUseExperimental(true)
.editorConfigOverride(
mapOf(
"ij_kotlin_allow_trailing_comma" to "true",
Expand Down
98 changes: 93 additions & 5 deletions config/detekt/detekt.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,115 @@
TwitterCompose:
#TwitterCompose:
# ContentEmitterReturningValues:
# active: true
# ModifierComposable:
# active: true
# ModifierMissing:
# active: true
# ModifierReused:
# active: true
# ModifierWithoutDefault:
# active: true
# MultipleEmitters:
# active: true
# MutableParams:
# active: true
# ComposableNaming:
# active: true
# ComposableParamOrder:
# active: true
# PreviewPublic:
# active: false # Triggering even for private methods
# RememberMissing:
# active: true
# ViewModelForwarding:
# active: true
# ViewModelInjection:
# active: true
Compose:
ComposableAnnotationNaming:
active: true
ComposableNaming:
active: true
# -- You can optionally disable the checks in this rule for regex matches against the composable name (e.g. molecule presenters)
# allowedComposableFunctionNames: .*Presenter,.*MoleculePresenter
ComposableParamOrder:
active: true
# -- You can optionally have a list of types to be treated as lambdas (e.g. typedefs or fun interfaces not picked up automatically)
# treatAsLambda: MyLambdaType
CompositionLocalAllowlist:
active: true
# -- You can optionally define a list of CompositionLocals that are allowed here
# allowedCompositionLocals: LocalSomething,LocalSomethingElse
CompositionLocalNaming:
active: true
ContentEmitterReturningValues:
active: true
# -- You can optionally add your own composables here
# contentEmitters: MyComposable,MyOtherComposable
DefaultsVisibility:
active: true
LambdaParameterInRestartableEffect:
active: true
# -- You can optionally have a list of types to be treated as lambdas (e.g. typedefs or fun interfaces not picked up automatically)
# treatAsLambda: MyLambdaType
ModifierClickableOrder:
active: true
# -- You can optionally add your own Modifier types
# customModifiers: BananaModifier,PotatoModifier
ModifierComposable:
active: true
# -- You can optionally add your own Modifier types
# customModifiers: BananaModifier,PotatoModifier
ModifierMissing:
active: true
# -- You can optionally control the visibility of which composables to check for here
# -- Possible values are: `only_public`, `public_and_internal` and `all` (default is `only_public`)
# checkModifiersForVisibility: only_public
# -- You can optionally add your own Modifier types
# customModifiers: BananaModifier,PotatoModifier
ModifierNaming:
active: true
# -- You can optionally add your own Modifier types
# customModifiers: BananaModifier,PotatoModifier
ModifierNotUsedAtRoot:
active: true
# -- You can optionally add your own composables here
# contentEmitters: MyComposable,MyOtherComposable
# -- You can optionally add your own Modifier types
# customModifiers: BananaModifier,PotatoModifier
ModifierReused:
active: true
# -- You can optionally add your own Modifier types
# customModifiers: BananaModifier,PotatoModifier
ModifierWithoutDefault:
active: true
MultipleEmitters:
active: true
# -- You can optionally add your own composables here that will count as content emitters
# contentEmitters: MyComposable,MyOtherComposable
# -- You can add composables here that you don't want to count as content emitters (e.g. custom dialogs or modals)
# contentEmittersDenylist: MyNonEmitterComposable
MutableParams:
active: true
ComposableNaming:
MutableStateParam:
active: true
ComposableParamOrder:
PreviewAnnotationNaming:
active: true
PreviewPublic:
active: false # Triggering even for private methods
active: true
RememberMissing:
active: true
RememberContentMissing:
active: true
UnstableCollections:
active: false # with strong skipping enabled this is not necessary
ViewModelForwarding:
active: true
# -- You can optionally use this rule on things other than types ending in "ViewModel" or "Presenter" (which are the defaults). You can add your own via a regex here:
# allowedStateHolderNames: .*ViewModel,.*Presenter
# -- You can optionally add an allowlist for Composable names that won't be affected by this rule
# allowedForwarding: .*Content,.*FancyStuff
ViewModelInjection:
active: true
active: true
# -- You can optionally add your own ViewModel factories here
# viewModelFactories: hiltViewModel,potatoViewModel
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ data class ArtObjectDomain(
val principalMaker: String = "",
val materialsList: List<String> = emptyList(),
val mainType: String = "",
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ package tgo1014.listofarts.domain.models

data class CountFacetsDomain(
val hasimage: Int = 0,
val ondisplay: Int = 0
)
val ondisplay: Int = 0,
)
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ data class FacetDomain(
val facets: List<FacetsDomain> = listOf(),
val name: String = "",
val otherTerms: Int = 0,
val prettyName: Int = 0
)
val prettyName: Int = 0,
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ package tgo1014.listofarts.domain.models

data class FacetsDomain(
val key: String = "",
val value: Int = 0
)
val value: Int = 0,
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ data class HeaderImageDomain(
val offsetPercentageY: Int = 0,
val width: Int = 0,
val height: Int = 0,
val url: String = ""
)
val url: String = "",
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ package tgo1014.listofarts.domain.models

data class LinksDomain(
val self: String = "",
val web: String = ""
)
val web: String = "",
)
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ data class ResponseDomain(
val count: Int = 0,
val countFacets: CountFacetsDomain = CountFacetsDomain(),
val artObjects: List<ArtObjectDomain> = listOf(),
val facets: List<FacetDomain> = listOf()
)
val facets: List<FacetDomain> = listOf(),
)
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ data class WebImageDomain(
val width: Int = 0,
val height: Int = 0,
val url: String = "",
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ interface ArtRepository {
): List<ArtObjectDomain>

suspend fun getArtById(
id: String
id: String,
): ArtObjectDomain

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,4 @@ class GetArtObjectByIdUseCase @Inject constructor(
artRepository.getArtById(id.replace("en-", ""))
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class GetArtObjectByIdUseCaseTest {
fakeArtRepository = FakeArtRepository()
usecase = GetArtObjectByIdUseCase(
artRepository = fakeArtRepository,
coroutineProvider = fakeCoroutineProvider
coroutineProvider = fakeCoroutineProvider,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class GetArtObjectsUseCaseTest {
fakeArtRepository = FakeArtRepository()
usecase = GetArtObjectsUseCase(
artRepository = fakeArtRepository,
coroutineProvider = fakeCoroutineProvider
coroutineProvider = fakeCoroutineProvider,
)
}

Expand Down
11 changes: 7 additions & 4 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ accompanistNavigationMaterial = "0.34.0"
coilCompose = "2.6.0"
compose = "1.7.0-alpha04"
compose-compiler = "1.5.10"
detekt = "1.23.4"
detekt = "1.23.5"
detektRules = "0.3.12"
hilt = "2.51"
hiltNavigationCompose = "1.2.0"
javaxInject = "1"
Expand All @@ -23,14 +24,16 @@ mockwebserver = "5.0.0-alpha.12"
retrofit = "2.9.0"
retrofit2KotlinxSerializationConverter = "1.0.0"
runner = "1.5+"
spotless = "6.12.0"
spotless = "6.25.0"
timber = "5.0.1"
turbine = "1.1.0"
zoomimageComposeCoil = "1.0.2"


optIns = "-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi,com.google.accompanist.navigation.material.ExperimentalMaterialNavigationApi,androidx.compose.ui.test.ExperimentalTestApi"
sdk-compile = "34"
sdk-target = "34"
sdk-min = "21"
zoomimageComposeCoil = "1.0.2"

[libraries]
accompanist-navigation-material = { module = "com.google.accompanist:accompanist-navigation-material", version.ref = "accompanistNavigationMaterial" }
Expand All @@ -45,7 +48,7 @@ androidx-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview
androidx-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose" }
androidx-ui-util = { module = "androidx.compose.ui:ui-util", version.ref = "compose" }
coil-compose = { module = "io.coil-kt:coil-compose", version.ref = "coilCompose" }
detekt = { module = "io.nlopez.compose.rules:detekt", version.ref = "detekt" }
detekt = { module = "io.nlopez.compose.rules:detekt", version.ref = "detektRules" }
hilt-android = { module = "com.google.dagger:hilt-android", version.ref = "hilt" }
hilt-android-compiler = { module = "com.google.dagger:hilt-android-compiler", version.ref = "hilt" }
hilt-android-testing = { module = "com.google.dagger:hilt-android-testing", version.ref = "hilt" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import tgo1014.listofarts.presentation.R
import tgo1014.listofarts.presentation.ui.composables.previews.DefaultPreview
import tgo1014.listofarts.presentation.ui.composables.previews.PreviewDefault
import tgo1014.listofarts.presentation.ui.theme.ListOfArtsTheme

@Composable
Expand All @@ -37,7 +37,7 @@ fun EmptyState(
}
}

@DefaultPreview
@PreviewDefault
@Composable
private fun EmptyStatePreview() = ListOfArtsTheme {
Surface { EmptyState() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import androidx.compose.ui.text.font.FontStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.withStyle
import androidx.compose.ui.tooling.preview.PreviewParameter
import tgo1014.listofarts.presentation.ui.composables.previews.DefaultPreview
import tgo1014.listofarts.presentation.ui.composables.previews.PreviewDefault
import tgo1014.listofarts.presentation.ui.composables.providers.ThemeProvider
import tgo1014.listofarts.presentation.ui.theme.ListOfArtsTheme

Expand All @@ -39,7 +39,7 @@ fun LogoText(
)
}

@DefaultPreview
@PreviewDefault
@Composable
private fun LogoTextPreview(
@PreviewParameter(ThemeProvider::class) materialYouColors: Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.unit.dp
import tgo1014.listofarts.presentation.models.Filter
import tgo1014.listofarts.presentation.ui.composables.previews.DefaultPreview
import tgo1014.listofarts.presentation.ui.composables.previews.PreviewDefault
import tgo1014.listofarts.presentation.ui.composables.providers.ThemeProvider
import tgo1014.listofarts.presentation.ui.theme.ListOfArtsTheme

Expand Down Expand Up @@ -42,7 +42,7 @@ fun PrimaryContainerFilterChip(
)
}

@DefaultPreview
@PreviewDefault
@Composable
private fun FilterChipPreview(
@PreviewParameter(ThemeProvider::class) materialYouColors: Boolean
Expand All @@ -52,7 +52,7 @@ private fun FilterChipPreview(
}
}

@DefaultPreview
@PreviewDefault
@Composable
private fun FilterChipDisabledPreview(
@PreviewParameter(ThemeProvider::class) materialYouColors: Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.unit.dp
import tgo1014.listofarts.presentation.R
import tgo1014.listofarts.presentation.ui.composables.previews.DefaultPreview
import tgo1014.listofarts.presentation.ui.composables.previews.PreviewDefault
import tgo1014.listofarts.presentation.ui.composables.providers.ThemeProvider
import tgo1014.listofarts.presentation.ui.theme.ListOfArtsTheme

Expand Down Expand Up @@ -69,7 +69,7 @@ fun SearchBar(
)
}

@DefaultPreview
@PreviewDefault
@Composable
private fun SearchBarPreview(
@PreviewParameter(ThemeProvider::class) materialYouColors: Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.unit.dp
import kotlinx.coroutines.delay
import tgo1014.listofarts.presentation.R
import tgo1014.listofarts.presentation.ui.composables.previews.DefaultPreview
import tgo1014.listofarts.presentation.ui.composables.previews.PreviewDefault
import tgo1014.listofarts.presentation.ui.composables.previews.isPreviewMode
import tgo1014.listofarts.presentation.ui.composables.providers.ThemeProvider
import tgo1014.listofarts.presentation.ui.theme.ListOfArtsTheme
Expand All @@ -75,10 +75,10 @@ import kotlin.time.Duration.Companion.milliseconds
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun SearchFab(
modifier: Modifier = Modifier,
searchText: String,
buttonState: SearchFabState,
isLoading: Boolean,
modifier: Modifier = Modifier,
onCloseClicked: () -> Unit = {},
onSearchTextChanged: (String) -> Unit = {},
onButtonClicked: () -> Unit = {},
Expand Down Expand Up @@ -275,7 +275,7 @@ private fun SearchFabPreviewSearchLoading() = ListOfArtsTheme {
}
}

@DefaultPreview
@PreviewDefault
@Composable
private fun HomeScreenPreview(
@PreviewParameter(ThemeProvider::class) materialYouColors: Boolean
Expand Down
Loading

0 comments on commit 3583349

Please sign in to comment.