SDP-GeoHunt/geo-hunt

View on GitHub

Showing 82 of 168 total issues

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,

      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.

        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,

              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)
                      }

                    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