SDP-GeoHunt/geo-hunt

View on GitHub

Showing 168 of 168 total issues

Method TeamProgressScreenContent has 10 arguments (exceeds 4 allowed). Consider refactoring.
Open

    onBack: () -> Unit,
    onLeaderboard: () -> Unit,
    onChat: () -> Unit,
    onClaim: (Challenge) -> Unit,

    Method computeOffsets has 10 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            x: List<Long>,
            xBottom: Long,
            xTop: Long,
            y: List<Long>,
            yBottom: Long,

      Method TeamCreator has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      @Composable
      fun TeamCreator(createTeam: (String) -> Unit, disabled: Boolean) {
          val name = remember { mutableStateOf("") }
      
          Surface(elevation = 4.dp) {

        Method ClaimCard has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        @Composable
        fun ClaimCard(
            retrieveUser: (String) -> StateFlow<User?>,
            claim: Claim,
            fnViewImageCallback: (String) -> Unit

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

              fun deleteTeam(team: Team) {
                  _isBusy.value = true
                  viewModelScope.launch  {
                      teamsRepository.deleteTeam(team)
                      activeBountiesRepository.leaveBounty(bountyId)
          app/src/main/java/com/github/geohunt/app/ui/screens/bounty_team_select/BountyTeamSelectViewModel.kt on lines 60..68
          app/src/main/java/com/github/geohunt/app/ui/screens/bounty_team_select/BountyTeamSelectViewModel.kt on lines 80..88

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

          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

              fun createOwnTeam(name: String) {
                  _isBusy.value = true
                  viewModelScope.launch {
                      teamsRepository.createTeam(name)
                      activeBountiesRepository.joinBounty(bountyId)
          app/src/main/java/com/github/geohunt/app/ui/screens/bounty_team_select/BountyTeamSelectViewModel.kt on lines 60..68
          app/src/main/java/com/github/geohunt/app/ui/screens/bounty_team_select/BountyTeamSelectViewModel.kt on lines 90..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 102.

          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 createChallenge has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              /**
               * Creates a challenge with the given photo, location and options.
               *
               * The challenge will be created on behalf of the currently logged in user. If there are none,
               * throws a [UserNotLoggedInException].

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

                fun joinTeam(teamId: String) {
                    _isBusy.value = true
                    viewModelScope.launch {
                        teamsRepository.joinTeam(teamId)
                        activeBountiesRepository.joinBounty(bountyId)
            app/src/main/java/com/github/geohunt/app/ui/screens/bounty_team_select/BountyTeamSelectViewModel.kt on lines 80..88
            app/src/main/java/com/github/geohunt/app/ui/screens/bounty_team_select/BountyTeamSelectViewModel.kt on lines 90..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 102.

            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 onCreate has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                override fun onCreate(savedInstanceState: Bundle?) {
                    super.onCreate(savedInstanceState)
            
                    setContent {
                        GeoHuntTheme {
            Severity: Minor
            Found in app/src/main/java/com/github/geohunt/app/TutorialActivity.kt - About 1 hr to fix

              Method FlatLongButton has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              /**
               * Implements a Drawer button. A button with full width, as in a table.
               *
               * Mainly inspired by https://github.com/SmartToolFactory/Jetpack-Compose-Tutorials/blob/master/Tutorial1-1Basics/src/main/java/com/smarttoolfactory/tutorial1_1basics/ui/components/DrawerButton.kt
               *

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

                                        {
                                            Text(
                                                text = stringResource(id = if (doesFollow.value) R.string.unfollow else R.string.follow),
                                                fontSize = 11.sp
                                            )
                app/src/main/java/com/github/geohunt/app/ui/components/challenge/BelowImageButton.kt on lines 71..76

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

                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

                            {
                                Text(
                                    text = stringResource(id = if (doesHunt.value) R.string.claim_hunt else R.string.join_hunt),
                                    fontSize = 14.sp
                                )
                app/src/main/java/com/github/geohunt/app/ui/components/challenge/ChallengeViewAuthor.kt on lines 104..109

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

                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

                                    Box(modifier = Modifier
                                            .size(300.dp, 600.dp)
                                            .testTag("bounty-box-${collected.bid}")
                                            .clickable { openBountyView(collected) })
                app/src/main/java/com/github/geohunt/app/ui/components/activehunts/ActiveHuntsList.kt on lines 51..54

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

                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

                                    Box(modifier = Modifier
                                            .size(300.dp, 600.dp)
                                            .testTag("challenge-box-${challenge.id}")
                                            .clickable { openChallengeView(challenge) })
                app/src/main/java/com/github/geohunt/app/ui/components/activehunts/ActiveBountiesList.kt on lines 48..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 98.

                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 TeamsSelector has 9 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    teams: List<Team>?,
                    users: Map<String, List<User>>,
                    join: (Team) -> Unit,
                    leaveTeam: () -> Unit,
                    disabled: Boolean,

                  Method LabelledIcon has 9 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      text: String,
                      painter: Painter,
                      contentDescription: String,
                      modifier: Modifier = Modifier,
                      fontSize: TextUnit = TextUnit.Unspecified,

                    Method ActiveBountiesList has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    /**
                     * Represents a List of bounties, bounties are displayed in a LazyRow and user can scroll through them
                     * @param bounties The bounties to display
                     * @param openExploreTab the callback that should be called by the button on the empty screen (No bounties)
                     * @param openBountyView the callback that should be called when the user clicks on a bounty

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

                                  LazyRow(
                                      modifier = Modifier.testTag("challenge_row"),
                                      contentPadding = PaddingValues(30.dp, 0.dp),
                                      horizontalArrangement = Arrangement.spacedBy(10.dp)
                                  ) {
                      app/src/main/java/com/github/geohunt/app/ui/components/activehunts/ActiveBountiesList.kt on lines 41..45

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

                      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

                                  LazyRow(
                                          modifier = Modifier.testTag("bounty_row"),
                                          contentPadding = PaddingValues(30.dp, 0.dp),
                                          horizontalArrangement = Arrangement.spacedBy(10.dp)
                                  ) {
                      app/src/main/java/com/github/geohunt/app/ui/components/activehunts/ActiveHuntsList.kt on lines 45..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 97.

                      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 ProfileEditPage has a Cognitive Complexity of 25 (exceeds 20 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()

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Severity
                      Category
                      Status
                      Source
                      Language