MeilCli/FoodSearch

View on GitHub
features/base/src/main/kotlin/net/meilcli/foodsearch/services/GnaviService.kt

Summary

Maintainability
A
0 mins
Test Coverage

Similar blocks of code found in 3 locations. Consider refactoring.
Invalid

    override suspend fun getMiddleArea(largeArea: LargeArea): List<MiddleArea> {
        val middleArea = middleAreaCache ?: GnaviApiClient.getMiddleArea(createAreaRequestQuery()).middleArea
        middleAreaCache = middleArea
        return middleArea.filter { it.largeArea.code == largeArea.code }
    }
features/base/src/main/kotlin/net/meilcli/foodsearch/services/GnaviService.kt on lines 116..120
features/base/src/main/kotlin/net/meilcli/foodsearch/services/GnaviService.kt on lines 128..132

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 138.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Invalid

    override suspend fun getLargeArea(prefectureArea: PrefectureArea): List<LargeArea> {
        val largeArea = largeAreaCache ?: GnaviApiClient.getLargeArea(createAreaRequestQuery()).largeArea
        largeAreaCache = largeArea
        return largeArea.filter { it.prefectureArea.code == prefectureArea.code }
    }
features/base/src/main/kotlin/net/meilcli/foodsearch/services/GnaviService.kt on lines 122..126
features/base/src/main/kotlin/net/meilcli/foodsearch/services/GnaviService.kt on lines 128..132

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 138.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Invalid

    override suspend fun getSmallArea(middleArea: MiddleArea): List<SmallArea> {
        val smallArea = smallAreaCache ?: GnaviApiClient.getSmallArea(createAreaRequestQuery()).smallArea
        smallAreaCache = smallArea
        return smallArea.filter { it.middleArea.code == middleArea.code }
    }
features/base/src/main/kotlin/net/meilcli/foodsearch/services/GnaviService.kt on lines 116..120
features/base/src/main/kotlin/net/meilcli/foodsearch/services/GnaviService.kt on lines 122..126

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 138.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Invalid

    override fun createRestaurantRequestModel(id: String): RestaurantRequestModel {
        return when (val language = configurationService.currentLanguage) {
            Language.Japanese -> RestaurantRequestModel.Japanese(RestaurantRequestQuery(), id)
            Language.English -> RestaurantRequestModel.Foreign(ForeignRestaurantRequestQuery(), id, language)
        }
features/base/src/main/kotlin/net/meilcli/foodsearch/services/GnaviService.kt on lines 31..36

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 105.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Invalid

    override fun createRestaurantRequestModel(ids: Array<String>): RestaurantRequestModel {
        return when (val language = configurationService.currentLanguage) {
            Language.Japanese -> RestaurantRequestModel.Japanese(RestaurantRequestQuery(), ids)
            Language.English -> RestaurantRequestModel.Foreign(ForeignRestaurantRequestQuery(), ids, language)
        }
features/base/src/main/kotlin/net/meilcli/foodsearch/services/GnaviService.kt on lines 24..29

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 105.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Invalid

    override suspend fun getSmallCategories(): List<SmallCategory> {
        val smallCategories =
            smallCategoriesCache ?: GnaviApiClient.getSmallCategories(createCategoryRequestQuery()).smallCategories
        smallCategoriesCache = smallCategories
        return smallCategories
features/base/src/main/kotlin/net/meilcli/foodsearch/services/GnaviService.kt on lines 95..100
features/base/src/main/kotlin/net/meilcli/foodsearch/services/GnaviService.kt on lines 109..114

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 86.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Invalid

    override suspend fun getLargeCategories(): List<LargeCategory> {
        val largeCategories =
            largeCategoriesCache ?: GnaviApiClient.getLargeCategories(createCategoryRequestQuery()).largeCategories
        largeCategoriesCache = largeCategories
        return largeCategories
features/base/src/main/kotlin/net/meilcli/foodsearch/services/GnaviService.kt on lines 102..107
features/base/src/main/kotlin/net/meilcli/foodsearch/services/GnaviService.kt on lines 109..114

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 86.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Invalid

    override suspend fun getPrefectureArea(): List<PrefectureArea> {
        val prefectureArea =
            prefectureAreaCache ?: GnaviApiClient.getPrefectureArea(createAreaRequestQuery()).prefectureArea
        prefectureAreaCache = prefectureArea
        return prefectureArea
features/base/src/main/kotlin/net/meilcli/foodsearch/services/GnaviService.kt on lines 95..100
features/base/src/main/kotlin/net/meilcli/foodsearch/services/GnaviService.kt on lines 102..107

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 86.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Invalid

    private fun createAreaRequestQuery(): AreaRequestQuery {
        return AreaRequestQuery().apply {
            language = configurationService.currentLanguage.toGnaviLanguage()
        }
    }
features/base/src/main/kotlin/net/meilcli/foodsearch/services/GnaviService.kt on lines 83..87

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 65.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Invalid

    private fun createCategoryRequestQuery(): CategoryRequestQuery {
        return CategoryRequestQuery().apply {
            language = configurationService.currentLanguage.toGnaviLanguage()
        }
    }
features/base/src/main/kotlin/net/meilcli/foodsearch/services/GnaviService.kt on lines 89..93

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 65.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

There are no issues that match your filters.

Category
Status