SDP-GeoHunt/geo-hunt

View on GitHub

Showing 168 of 168 total issues

Method TeamProgressScreen has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

/**
 * Creates the team progress screen.
 */
@Composable
fun TeamProgressScreen(

    Method ChallengeView has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    /**
     * @brief Composable function that displays a specific challenge including details
     * such as previous claims and the author to the user.
     *
     * @param viewModel The view model

      Method SettingsDrawer has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      @Composable
      fun SettingsDrawer(
          openProfileEdit: OptionalCallback,
          openLeaderboard: OptionalCallback,
          onLogout: OptionalCallback,

        Similar blocks of code found in 2 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/utils/viewmodels/WithPhotoViewModel.kt on lines 58..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 129.

        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

            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/CreateBountyViewModel.kt on lines 71..82

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

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

        /**
         * A team entry in the team selector
         *
         * @param name The team's name
         * @param users the list of users, if any

          Method BountyTeamSelectPage has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring.
          Open

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

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

          @OptIn(ExperimentalMaterialApi::class)
          @Composable
          fun MainScreen(viewModel: MainViewModel, logout: () -> Unit) {
              val navController = rememberNavController()
              val scaffoldState = rememberScaffoldState()

            Method RenameBountyPopup has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

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

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

                  fun hunt(challenge: Challenge) {
                      challengeCache[challenge]!!._isBusy.value = true
              
                      coroutineScope.launch {
                          activeHuntsRepository.joinHunt(challenge)
              app/src/main/java/com/github/geohunt/app/ui/screens/home/HomeFeedViewModel.kt on lines 116..122

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

              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

                  fun leaveHunt(challenge: Challenge) {
                      challengeCache[challenge]!!._isBusy.value = true
                      coroutineScope.launch {
                          activeHuntsRepository.leaveHunt(challenge)
                          challengeCache[challenge]!!._isBusy.value = false
              app/src/main/java/com/github/geohunt/app/ui/screens/home/HomeFeedViewModel.kt on lines 107..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 119.

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

              /**
               * @brief Show a card containing the challenge description that is expandable
               *
               * @param challengeDescription the description of the challenge to be displayed
               */

                Method UserView has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                @Composable
                private fun UserView(
                    retrieveUser: (String) -> StateFlow<User?>,
                    claim: Claim
                ) {

                  Method ChallengeView has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring.
                  Open

                  /**
                   * @brief Composable function that displays a specific challenge including details
                   * such as previous claims and the author to the user.
                   *
                   * @param viewModel The view model

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

                  /**
                   * Creates the bottom navigation bar of the application.
                   *
                   * @param navController The navigation controller.
                   * @param onCreate Callback used by the create button.

                    Method ProfileVisibilityChooser has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    @Composable
                    fun ProfileVisibilityChooser(viewModel: PrivacySettingsViewModel) {
                        val isDisabled = viewModel.isDisabled.collectAsState()
                        val visibility = viewModel.profileVisibility.collectAsState()
                        val callback: (ProfileVisibility) -> Unit = { viewModel.setProfileVisibility(it) }

                      Method HomeBountyCard has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      @OptIn(ExperimentalFoundationApi::class)
                      @Composable
                      fun HomeBountyCard(
                          author: Flow<User?>,
                          onUserClick: (User) -> Unit,

                        Method AppSettingsPage has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        @Composable
                        fun AppSettingsPage(
                            onBack: () -> Unit,
                            viewModel: AppSettingsViewModel
                        ) {

                          Method doTimeString has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              @Composable
                              private fun doTimeString(duration: Duration, formattingStringId: Int, direction: Direction) : String {
                                  val fmt = RelativeDateTimeFormatter.getInstance()
                          
                                  val raw = when {
                          Severity: Minor
                          Found in app/src/main/java/com/github/geohunt/app/i18n/DateFormatUtils.kt - About 1 hr to fix

                            Method LeaderboardListItem has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            /**
                             * Draws a leaderboard list item.
                             *
                             * @param position The position of the user in the leaderboard.
                             * @param entry The leaderboard entry in the ranking.
                              Severity
                              Category
                              Status
                              Source
                              Language