Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true

[*.{kt,kts}]
indent_size = 4
continuation_indent_size = 4

# Kotlin naming conventions
ktlint_standard_class-naming = enabled
ktlint_standard_property-naming = enabled
ktlint_standard_package-name = enabled
ktlint_standard_enum-entry-name-case = enabled

# Function naming - allow Composable functions to start with uppercase
ktlint_function_naming_ignore_when_annotated_with = Composable

# Spacing and formatting
ktlint_standard_spacing-around-colon = enabled
ktlint_standard_spacing-around-comma = enabled
ktlint_standard_spacing-around-curly = enabled
ktlint_standard_spacing-around-dot = enabled
ktlint_standard_spacing-around-keyword = enabled
ktlint_standard_spacing-around-operators = enabled
ktlint_standard_spacing-around-parens = enabled
ktlint_standard_spacing-around-range-operator = enabled
ktlint_standard_spacing-between-declarations-with-annotations = enabled
ktlint_standard_spacing-between-declarations-with-comments = enabled

# Code organization
ktlint_standard_no-blank-line-before-rbrace = enabled
ktlint_standard_no-blank-lines-in-chained-method-calls = enabled
ktlint_standard_no-consecutive-blank-lines = enabled
ktlint_standard_no-empty-class-body = enabled
ktlint_standard_no-trailing-spaces = enabled

# Import organization
ktlint_standard_no-wildcard-imports = enabled
ktlint_standard_no-unused-imports = enabled

# Line length and wrapping
ktlint_standard_max-line-length = disabled
ktlint_standard_parameter-list-wrapping = enabled
ktlint_standard_argument-list-wrapping = enabled

# Trailing commas
ktlint_standard_trailing-comma-on-call-site = enabled
ktlint_standard_trailing-comma-on-declaration-site = enabled

# Indentation
ktlint_standard_indent = enabled
ktlint_standard_parameter-list-spacing = enabled

[*.xml]
indent_size = 4

[*.{json,yml,yaml}]
indent_size = 2
6 changes: 6 additions & 0 deletions .github/workflows/android-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,11 @@ jobs:
- name: Build app and feature demos
run: ./gradlew :app:assembleDebug :feature:home:demo:assembleDebug :feature:product:demo:assembleDebug

- name: Check code format with Spotless
run: ./gradlew spotlessCheck

- name: Run static code analysis with Detekt
run: ./gradlew detekt --build-cache --parallel --max-workers=2

- name: Run tests for all features
run: ./gradlew :feature:home:impl:testDebugUnitTest :feature:order:impl:testDebugUnitTest :feature:product:impl:testDebugUnitTest
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ package com.example.feature.templatefeature.api

sealed interface TemplateFeatureDestination {
data class Detail(val templatefeatureId: Int) : TemplateFeatureDestination
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ package com.example.feature.templatefeature.api

import com.example.core.navigation.FeatureEntry

interface TemplateFeatureEntry : FeatureEntry
interface TemplateFeatureEntry : FeatureEntry
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ import android.content.Intent
interface TemplateFeatureNavigator {
fun intentFor(
context: Context,
destination: TemplateFeatureDestination
destination: TemplateFeatureDestination,
): Intent
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ import com.example.feature.templatefeature.api.domain.model.TemplateFeature

interface TemplateFeatureRepository {
suspend fun getTemplateFeatures(): DomainResult<List<TemplateFeature>>
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ data class TemplateFeature(
val description: String,
val category: String,
val image: String,
val rating: Rating
val rating: Rating,
)

data class Rating(
val rate: Double,
val count: Int
)
val count: Int,
)
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ import com.example.feature.templatefeature.api.domain.model.TemplateFeature

interface GetTemplateFeaturesUseCase {
suspend fun getTemplateFeatures(): DomainResult<List<TemplateFeature>>
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ object DemoModule {
@Singleton
@GlobalBaseUrl
fun provideGlobalBaseUrl(): String = BuildConfig.GLOBAL_BASE_URL
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ class DemoTemplateFeatureActivity : AppCompatActivity() {
return featureEntries.filterIsInstance<TemplateFeatureEntry>().firstOrNull()
?: error("TemplateFeatureEntry not found in featureEntries")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ import android.app.Application
import dagger.hilt.android.HiltAndroidApp

@HiltAndroidApp
class DemoTemplateFeatureApplication : Application()
class DemoTemplateFeatureApplication : Application()
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ class TemplateFeatureEntryImpl @Inject constructor() : TemplateFeatureEntry {
}

fun createRootFragment(): Fragment = TemplateFeatureListFragment()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ data class ApiTemplateFeature(
val description: String,
val category: String,
val image: String,
val rating: ApiRating
val rating: ApiRating,
)

data class ApiRating(
val rate: Double,
val count: Int
)
val count: Int,
)
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.example.feature.templatefeature.impl.data

import com.example.core.mapper.Mapper
import com.example.feature.templatefeature.api.domain.model.TemplateFeature
import com.example.feature.templatefeature.api.domain.model.Rating
import com.example.feature.templatefeature.api.domain.model.TemplateFeature

class ApiTemplateFeatureMapper : Mapper<ApiTemplateFeature, TemplateFeature> {
override fun map(from: ApiTemplateFeature): TemplateFeature = TemplateFeature(
Expand All @@ -14,7 +14,7 @@ class ApiTemplateFeatureMapper : Mapper<ApiTemplateFeature, TemplateFeature> {
image = from.image,
rating = Rating(
rate = from.rating.rate,
count = from.rating.count
)
count = from.rating.count,
),
)
}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package com.example.feature.templatefeature.impl.data.repository

import com.example.core.domain.DomainResult
import com.example.feature.templatefeature.api.domain.model.TemplateFeature
import com.example.feature.templatefeature.api.data.TemplateFeatureRepository
import com.example.feature.templatefeature.api.domain.model.TemplateFeature
import com.example.feature.templatefeature.impl.data.ApiTemplateFeatureMapper
import com.example.feature.templatefeature.impl.remote.TemplateFeatureApi
import javax.inject.Inject

class TemplateFeatureRepositoryImpl @Inject constructor(
private val api: TemplateFeatureApi,
private val mapper: ApiTemplateFeatureMapper
private val mapper: ApiTemplateFeatureMapper,
) : TemplateFeatureRepository {

override suspend fun getTemplateFeatures(): DomainResult<List<TemplateFeature>> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import javax.inject.Inject

class TemplateFeatureRepositoryMockImpl @Inject constructor(
private val context: Context,
private val mapper: ApiTemplateFeatureMapper
private val mapper: ApiTemplateFeatureMapper,
) : TemplateFeatureRepository {

override suspend fun getTemplateFeatures(): DomainResult<List<TemplateFeature>> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import com.example.feature.templatefeature.api.domain.usecase.GetTemplateFeature
import javax.inject.Inject

class GetTemplateFeaturesUseCaseImpl @Inject constructor(
private val repository: TemplateFeatureRepository
private val repository: TemplateFeatureRepository,
) : GetTemplateFeaturesUseCase {

override suspend fun getTemplateFeatures(): DomainResult<List<TemplateFeature>> {
return repository.getTemplateFeatures()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import javax.inject.Inject
class TemplateFeatureNavigatorImpl @Inject constructor() : TemplateFeatureNavigator {
override fun intentFor(
context: Context,
destination: TemplateFeatureDestination
destination: TemplateFeatureDestination,
): Intent {
// TODO: Properly route to a templatefeature detail/activity if needed
return Intent()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ import retrofit2.http.GET
interface TemplateFeatureApi {
@GET("templatefeatures")
suspend fun getTemplateFeatures(): List<ApiTemplateFeature>
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ class TemplateFeatureListFragment : Fragment() {
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
savedInstanceState: Bundle?,
): View {
return ComposeView(requireContext()).apply {
setContent {
TemplateFeatureScreen(viewModel = viewModel)
}
}
}
}
}
Loading