polypoly-team/android-app

View on GitHub

Showing 15 of 43 total issues

Method addMarkerTo has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

/**
 * Adds a marker to the given map view.
 * @param mapView the map view to add the marker to
 * @param position the position of the marker
 * @param title the title of the marker

    Class RemoteDB has 23 methods (exceeds 20 allowed). Consider refactoring.
    Open

    /**
     * Implementation of IRemoteStorage as a Firebase remote DB
     */
    class RemoteDB(
        db: FirebaseDatabase?,
    Severity: Minor
    Found in app/src/main/java/com/github/polypoly/app/database/RemoteDB.kt - About 2 hrs to fix

      Method BackgroundLocationPermissionHandler has 54 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          /**
           * Handler for the background location permission.
           */
          @Composable
          fun BackgroundLocationPermissionHandler(callback: () -> Unit) {
      Severity: Major
      Found in app/src/main/java/com/github/polypoly/app/ui/game/GameActivity.kt - About 2 hrs to fix

        Method UserRank has 49 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            /**
             * A card displaying the [User]'s rank according to a [RankingCategory], along with their
             * statistics for the given ranking criteria
             *
             * @param rank The rank of the user

          Method GameActivityContent has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              /**
               * Component for the entire game activity content
               */
              @Composable
              fun GameActivityContent() {
          Severity: Minor
          Found in app/src/main/java/com/github/polypoly/app/ui/game/GameActivity.kt - About 1 hr to fix

            Method initLocationOverlay has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            /**
             * Initializes the location overlay and sets the location listener.
             * @param mapViewModel GameViewModel to use for map business logic
             * @param gameViewModel GameViewModel to use for game business logic. Null if no game is going on
             * @return the location overlay that was added

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

                  /**
                   * The rankings view, composed of a row of rankings lists for each [RankingCategory]
                   */
                  @OptIn(ExperimentalPagerApi::class)
                  @Composable

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

                /**
                 * Creates a circular loader component that spins forever
                 * @param size loader size
                 * @param sweepAngle angle covered by the rotating circular arc
                 * @param duration time length of the animation in milli seconds

                  Method GameActivityContent has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring.
                  Open

                      /**
                       * Component for the entire game activity content
                       */
                      @Composable
                      fun GameActivityContent() {
                  Severity: Minor
                  Found in app/src/main/java/com/github/polypoly/app/ui/game/GameActivity.kt - About 1 hr to fix

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

                      private fun addGameMapOverlay(
                          mapView: MapView,
                          mapViewModel: MapViewModel,
                          gameViewModel: GameViewModel?,
                          locationsOwned: List<InGameLocation>,
                  Severity: Minor
                  Found in app/src/main/java/com/github/polypoly/app/ui/map/MapUI.kt - About 1 hr to fix

                    Method BackgroundLocationPermissionHandler has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring.
                    Open

                        /**
                         * Handler for the background location permission.
                         */
                        @Composable
                        fun BackgroundLocationPermissionHandler(callback: () -> Unit) {
                    Severity: Minor
                    Found in app/src/main/java/com/github/polypoly/app/ui/game/GameActivity.kt - About 1 hr to fix

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

                        /**
                         * Start receiving location updates
                         */
                        private fun startLocationUpdates() {
                            val locationRequest = LocationRequest.Builder(Constants.LANDLORD_TAX_POLL_RATE * 1000)

                      Method WelcomeContent has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          /**
                           * main content of the welcome activity
                           */
                          @Composable
                          fun WelcomeContent() {

                        Consider simplifying this complex logical expression.
                        Open

                                if(trade.locationReceived != null
                                    && ((trade.isReceiver(player) && trade.currentPlayerReceiverAcceptance != null
                                            && trade.currentPlayerApplicantAcceptance == null) ||
                                            (trade.isApplicant(player) && trade.currentPlayerApplicantAcceptance != null
                                                    && trade.currentPlayerReceiverAcceptance == null))) {
                        Severity: Major
                        Found in app/src/main/java/com/github/polypoly/app/ui/game/GameActivity.kt - About 1 hr to fix

                          Method addMarkerTo has 8 arguments (exceeds 6 allowed). Consider refactoring.
                          Open

                              mapView: MapView,
                              location: LocationProperty,
                              zoneColor: Int,
                              mapViewModel: MapViewModel,
                              gameViewModel: GameViewModel?,
                            Severity
                            Category
                            Status
                            Source
                            Language