studhub-epfl/studhub-app

View on GitHub
app/src/main/java/com/studhub/app/domain/repository/ListingRepository.kt

Summary

Maintainability
A
2 hrs
Test Coverage
F
0%

Method getListingsBySearch has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

        keyword: String,
        minPrice: String,
        maxPrice: String,
        chosenCategories: List<Category>,
        blockedUsers: Map<String, Boolean>
Severity: Minor
Found in app/src/main/java/com/studhub/app/domain/repository/ListingRepository.kt - About 35 mins to fix

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        suspend fun getListingsBySearch(
            keyword: String,
            minPrice: String,
            maxPrice: String,
            chosenCategories: List<Category>,
    app/src/main/java/com/studhub/app/data/repository/ListingRepositoryImpl.kt on lines 198..204

    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 92.

    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.
    Open

        /**
         * update a [Listing] to be of bidding type
         * @param [listing] the listing to be updated
         * @param [startingPrice] the starting price for the bidding type
         * @param [deadline] the deadline for the fixing the bidding price
    app/src/main/java/com/studhub/app/domain/repository/UserRepository.kt on lines 28..28

    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 74.

    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 11 locations. Consider refactoring.
    Invalid

        /**
         * Updates the [Listing] with the given [listingId]
         * @param [listingId] the listingId we want to match
         * @param [updatedListing] the Listing we want to replace
         * @return A [Flow] of [ApiResponse] with the last one containing the updated [Listing] pushed to the database on success
    app/src/main/java/com/studhub/app/domain/repository/AuthRepository.kt on lines 17..21
    app/src/main/java/com/studhub/app/domain/repository/AuthRepository.kt on lines 31..35
    app/src/main/java/com/studhub/app/domain/repository/ConversationRepository.kt on lines 19..27
    app/src/main/java/com/studhub/app/domain/repository/UserRepository.kt on lines 12..12
    app/src/main/java/com/studhub/app/domain/repository/UserRepository.kt on lines 14..17
    app/src/main/java/com/studhub/app/domain/repository/UserRepository.kt on lines 19..22
    app/src/main/java/com/studhub/app/domain/repository/UserRepository.kt on lines 25..25
    app/src/main/java/com/studhub/app/domain/repository/UserRepository.kt on lines 26..26
    app/src/main/java/com/studhub/app/domain/repository/UserRepository.kt on lines 27..27
    app/src/main/java/com/studhub/app/domain/repository/UserRepository.kt on lines 29..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 63.

    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