SDP-GeoHunt/geo-hunt

View on GitHub

Showing 168 of 168 total issues

Method CreateNewChallenge has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

@Composable
fun CreateNewChallenge(
    onFailure: (Throwable) -> Unit = {},
    onSuccess: (Challenge) -> Unit = {},
    viewModel: CreateChallengeViewModel = viewModel(factory = CreateChallengeViewModel.Factory)

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

        private val teamsRepositories = DataPool<String, TeamsRepository> { bid ->
            TeamsRepository(
                bountiesTeam.child(bid),
                userRepository,
                ioDispatcher = ioDispatcher
    app/src/main/java/com/github/geohunt/app/data/repository/bounties/BountiesRepository.kt on lines 41..47

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

    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

        private val messagesRepository = DataPool<String, MessagesRepository> { bid ->
            MessagesRepository(
                bountiesTeam.child(bid),
                userRepository,
                ioDispatcher = ioDispatcher
    app/src/main/java/com/github/geohunt/app/data/repository/bounties/BountiesRepository.kt on lines 33..39

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

    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

    Method HomeScreen has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    @OptIn(ExperimentalMaterial3Api::class)
    @Composable
    fun HomeScreen(
        onUserClick: (User) -> Unit,
        onOpenMap: (Challenge) -> Unit,

      Method ProfileEditPage has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      @Composable
      fun ProfileEditPage(onBackButton: () -> Unit, vm: ProfileEditPageViewModel = viewModel(factory = ProfileEditPageViewModel.Factory)) {
          // Getting user
          val user by vm.user.collectAsState()
          val eu by vm.editedUser.collectAsState()

        Method ActiveHuntsList has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        /**
         * Creates a scrollable list of active hunts using the given list.
         *
         * If the list is empty, uses the [EmptyScreen] as fallback.
         *

          Method onCreate has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              override fun onCreate(savedInstanceState: Bundle?) {
                  super.onCreate(savedInstanceState)
          
                  // Check that the user is not already logged in
                  if (viewModel.isLoggedIn()) {
          Severity: Minor
          Found in app/src/main/java/com/github/geohunt/app/LoginActivity.kt - About 1 hr to fix

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

            ): DynamicPagedList<U> {
                return DynamicPagedList(
                    size = list.size,
                    fetcher = { i -> fetcher(list[i]) },
                    coroutineScope = coroutineScope,
            app/src/main/java/com/github/geohunt/app/ui/utils/pagination/StaticPagedList.kt on lines 44..51

            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

            ): StaticPagedList<U> {
                return StaticPagedList(
                    size = list.size,
                    fetcher = { i -> fetcher(list[i]) },
                    coroutineScope = coroutineScope,
            app/src/main/java/com/github/geohunt/app/ui/utils/pagination/DynamicPagedList.kt on lines 42..49

            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

            Method RadioItem has 8 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                title: String,
                value: T,
                isSelected: Boolean,
                onSelect: (T) -> Unit,
                modifier: Modifier = Modifier,
            Severity: Major
            Found in app/src/main/java/com/github/geohunt/app/ui/settings/RadioItem.kt - About 1 hr to fix

              Method HomeBountyCard has 8 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  author: Flow<User?>,
                  onUserClick: (User) -> Unit,
                  name: String,
                  expiresIn: LocalDateTime,
                  challengesFlows: Flow<List<Challenge>?>,

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

                            duration.toDays() > 29 ->
                                fmt.format((duration.toDays() + 15) / 30,
                                    direction,
                                    RelativeDateTimeFormatter.RelativeUnit.MONTHS
                                )
                app/src/main/java/com/github/geohunt/app/i18n/DateFormatUtils.kt on lines 53..57

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

                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

                            duration.toDays() > 182 ->
                                fmt.format((duration.toDays() + 182) / 365,
                                    direction,
                                    RelativeDateTimeFormatter.RelativeUnit.YEARS
                                )
                app/src/main/java/com/github/geohunt/app/i18n/DateFormatUtils.kt on lines 58..62

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

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

                                    false -> Icon(
                                        Icons.Default.PersonAdd,
                                        contentDescription = stringResource(id = R.string.join_team),
                                        modifier = Modifier.testTag("join-btn")
                                    )
                app/src/main/java/com/github/geohunt/app/ui/screens/bounty_team_select/BountyTeamSelectPage.kt on lines 204..208
                app/src/main/java/com/github/geohunt/app/ui/screens/bounty_team_select/BountyTeamSelectPage.kt on lines 221..225

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

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

                                    Icon(
                                        Icons.Default.Delete,
                                        contentDescription = stringResource(id = R.string.delete_team),
                                        modifier = Modifier.testTag("delete-btn")
                                    )
                app/src/main/java/com/github/geohunt/app/ui/screens/bounty_team_select/BountyTeamSelectPage.kt on lines 215..219
                app/src/main/java/com/github/geohunt/app/ui/screens/bounty_team_select/BountyTeamSelectPage.kt on lines 221..225

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

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

                                    true -> Icon(
                                        Icons.Default.Logout,
                                        contentDescription = stringResource(id = R.string.leave_team),
                                        modifier = Modifier.testTag("leave-btn")
                                    )
                app/src/main/java/com/github/geohunt/app/ui/screens/bounty_team_select/BountyTeamSelectPage.kt on lines 204..208
                app/src/main/java/com/github/geohunt/app/ui/screens/bounty_team_select/BountyTeamSelectPage.kt on lines 215..219

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

                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

                    suspend fun uploadChallengePhoto(photo: LocalPicture, coarseHash: String, id: String) =
                        uploadImage(photo, ImageType.CHALLENGE_PHOTO, "$coarseHash/$id")
                app/src/main/java/com/github/geohunt/app/data/repository/ImageRepository.kt on lines 97..98

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

                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

                    suspend fun uploadBountyClaimPhoto(photo: LocalPicture, id: String, bid: String) =
                        uploadImage(photo, ImageType.BOUNTY_CLAIM_PHOTO, "$id-$bid")
                app/src/main/java/com/github/geohunt/app/data/repository/ImageRepository.kt on lines 86..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 85.

                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

                Method TeamSelector has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    name: String,
                    users: List<User>? = listOf(),
                    onAction: () -> Unit = {},
                    disabled: Boolean = false,
                    isUserInside: Boolean = false,

                  Method HomeScreen has 7 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      onUserClick: (User) -> Unit,
                      onOpenMap: (Challenge) -> Unit,
                      onOpenChallenge: (Challenge) -> Unit,
                      onClaim: (Challenge) -> Unit,
                      onOpenExplore: () -> Unit,
                  Severity: Major
                  Found in app/src/main/java/com/github/geohunt/app/ui/screens/home/HomeScreen.kt - About 50 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language