SDP-GeoHunt/geo-hunt

View on GitHub

Showing 168 of 168 total issues

Method LeaderboardPodiumItem has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

/**
 * Creates a podium list item for the top 3 users.
 * The position argument affects the exact UI of the item, including the background color and the
 * height of the item.
 *

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

    /**
     * A grid for showing past challenges
     */
    @Composable
    fun PastChallengesContent(challenges: List<Challenge>?, openChallengeView: (Challenge) -> Unit) {
    app/src/main/java/com/github/geohunt/app/ui/components/profile/PastChallengeAndHunts.kt on lines 67..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 177.

    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

    /**
     * A grid for showing past hunts
     */
    @Composable
    fun PastHuntsContent(hunts: List<Challenge>?, openChallengeView: (Challenge) -> Unit) {
    app/src/main/java/com/github/geohunt/app/ui/components/profile/PastChallengeAndHunts.kt on lines 56..65

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

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

    @Composable
    fun ChallengeFeed(
        chosenFeed: HomeScreenFeed,
        onUserClick: (User) -> Unit,
        onOpenMap: (Challenge) -> Unit,

      Method TeamProgressTopAppBar has a Cognitive Complexity of 33 (exceeds 20 allowed). Consider refactoring.
      Open

      /**
       * Creates the team progress top app bar.
       *
       * @param teamName The team name displayed as the title of the top bar.
       * @param onBack The callback used when pressing the back arrow.

      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

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

      @Composable
      fun ChallengeAuthor(authorName: String) {
          Row(modifier = Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically) {
              Icon(Icons.Rounded.Person, contentDescription = "person_icon")
      
      
      app/src/main/java/com/github/geohunt/app/ui/components/activehunts/BountyPreview.kt on lines 71..80

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

      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

      @Composable
      fun BountyName(name: String) {
          Row(modifier = Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically) {
              Icon(Icons.Rounded.AdsClick, contentDescription = "bounty_icon")
      
      
      app/src/main/java/com/github/geohunt/app/ui/components/activehunts/ChallengePreview.kt on lines 58..67

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

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

      @Composable
      internal fun BelowImageButton(
          joinHunt: () -> Unit,
          leaveHunt: () -> Unit,
          fnClaimHuntCallback: (String) -> Unit,

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

                return if (dateTime < now) {
                    doTimeString(
                        duration = Duration.between(dateTime, now),
                        formattingStringId = passedFormattingStringId,
                        direction = Direction.LAST
        app/src/main/java/com/github/geohunt/app/i18n/DateFormatUtils.kt on lines 95..100

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

        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

                else if(now < rangeEnd) {
                    doTimeString(duration = Duration.between(now, rangeEnd), formattingStringId = whileStringId, direction = Direction.NEXT)
                }
                else {
                    doTimeString(duration = Duration.between(rangeEnd, now), formattingStringId = afterStringId, direction = Direction.LAST)
        app/src/main/java/com/github/geohunt/app/i18n/DateFormatUtils.kt on lines 117..130

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

        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 RenameBountyPopup has a Cognitive Complexity of 31 (exceeds 20 allowed). Consider refactoring.
        Open

        @Composable
        internal fun RenameBountyPopup(bounty: Bounty, onDismiss: (String?) -> Unit) {
            var name by remember(bounty) {
                mutableStateOf(bounty.name)
            }

        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

        Method TeamCreator has a Cognitive Complexity of 31 (exceeds 20 allowed). Consider refactoring.
        Open

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

        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

        Method BountiesFeed has 52 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        @SuppressLint("FlowOperatorInvokedInComposition")
        @OptIn(ExperimentalMaterialApi::class)
        @Composable
        fun BountiesFeed(
            onUserClick: (User) -> Unit,

          Method BountyTeamSelectPage has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          @OptIn(ExperimentalFoundationApi::class)
          @Composable
          fun BountyTeamSelectPage(
              bountyId: String,
              onBack: () -> Unit,

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

                    openProfileEdit?.let { openProfileEdit ->
                        FlatLongButton(
                            icon = Icons.Default.Edit,
                            text = stringResource(id = R.string.edit_profile),
                            onClick = { close(); openProfileEdit() },
            app/src/main/java/com/github/geohunt/app/ui/components/profile/SettingsDrawer.kt on lines 50..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 145.

            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

                    openSettings?.let { openSettings ->
                        FlatLongButton(
                            icon = Icons.Default.Settings,
                            text = stringResource(id = R.string.settings),
                            onClick = { close(); openSettings() },
            app/src/main/java/com/github/geohunt/app/ui/components/profile/SettingsDrawer.kt on lines 32..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 145.

            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

                companion object {
                    val Factory: ViewModelProvider.Factory = viewModelFactory {
                        initializer {
                            val application = this[ViewModelProvider.AndroidViewModelFactory.APPLICATION_KEY] as Application
                            val container = AppContainer.getInstance(application)
            app/src/main/java/com/github/geohunt/app/ui/components/bounties/viewmodel/AdminBountyViewModel.kt on lines 96..108
            app/src/main/java/com/github/geohunt/app/ui/components/claims/SubmitClaimViewModel.kt on lines 66..78

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

            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

                companion object {
                    val Factory: ViewModelProvider.Factory = viewModelFactory {
                        initializer {
                            val application = this[ViewModelProvider.AndroidViewModelFactory.APPLICATION_KEY] as Application
                            val container = AppContainer.getInstance(application)
            app/src/main/java/com/github/geohunt/app/ui/components/claims/SubmitClaimViewModel.kt on lines 66..78
            app/src/main/java/com/github/geohunt/app/ui/screens/maps/MapsViewModel.kt on lines 54..66

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

            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

                companion object {
                    val Factory: ViewModelProvider.Factory = viewModelFactory {
                        initializer {
                            val application = this[ViewModelProvider.AndroidViewModelFactory.APPLICATION_KEY] as Application
                            val container = AppContainer.getInstance(application)
            app/src/main/java/com/github/geohunt/app/ui/components/bounties/viewmodel/AdminBountyViewModel.kt on lines 96..108
            app/src/main/java/com/github/geohunt/app/ui/screens/maps/MapsViewModel.kt on lines 54..66

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

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

            /**
             * Creates the team progress top app bar.
             *
             * @param teamName The team name displayed as the title of the top bar.
             * @param onBack The callback used when pressing the back arrow.
              Severity
              Category
              Status
              Source
              Language