SDP-GeoHunt/geo-hunt

View on GitHub

Showing 82 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

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

            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
               *

                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

                      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

                      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)

                        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

                                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>?>,

                                    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