Alvaro2112/Money_run

View on GitHub

Showing 37 of 40 total issues

Method postNewGame has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public void postNewGame(String name, int maxPlayerCount, int numCoins, double gameRadius, double gameDuration, @NonNull LocationRepresentation location) {
Severity: Minor
Found in app/src/main/java/sdp/moneyrun/menu/NewGameImplementation.java - About 45 mins to fix

    Method checkNewGameStringParameters has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        private boolean checkNewGameStringParameters(@NonNull String gameName, @NonNull String maxPlayerNumberStr, @NonNull String numCoinsStr, @NonNull String gameRadiusStr, @NonNull String gameDurationStr) {
    Severity: Minor
    Found in app/src/main/java/sdp/moneyrun/menu/NewGameImplementation.java - About 35 mins to fix

      Method joinLobbyFromJoinButton has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public static void joinLobbyFromJoinButton(@NonNull GameRepresentation gameRepresentation,
                                                     @NonNull DatabaseReference databaseReference,
                                                     @NonNull Activity activity,
                                                     @NonNull User currentUser,
                                                     String locationMode) {
      Severity: Minor
      Found in app/src/main/java/sdp/moneyrun/Helpers.java - About 35 mins to fix

        Method onButtonShowQuestionPopupWindowClick has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public void onButtonShowQuestionPopupWindowClick(View view, Boolean focusable, int layoutId, @NonNull Riddle riddle, @Nullable Coin coin) {
        Severity: Minor
        Found in app/src/main/java/sdp/moneyrun/ui/map/MapActivity.java - About 35 mins to fix

          Method placeRandomCoins has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public void placeRandomCoins(int number, double maxRadius, double minRadius) {
                  if (number < 0 || maxRadius <= 0 || minRadius <= 0)
                      throw new IllegalArgumentException("Number of coins to place is less than 0, number of coin is  " + number);
                  if (minRadius >= maxRadius)
                      throw new IllegalArgumentException("Min radius cannot be bigger or equal than max Radius ");
          Severity: Minor
          Found in app/src/main/java/sdp/moneyrun/ui/map/MapActivity.java - About 35 mins 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 setPlayers has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public void setPlayers(@Nullable List<Player> players, boolean forceLocal, @NonNull OnCompleteListener listener) {
                  if (players == null) {
                      throw new IllegalArgumentException("players should not be null.");
                  }
                  if (players.isEmpty()) {
          Severity: Minor
          Found in app/src/main/java/sdp/moneyrun/game/Game.java - About 35 mins 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

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

                  if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
                      return;
                  }
          Severity: Minor
          Found in app/src/main/java/sdp/moneyrun/ui/map/MapActivity.java and 1 other location - About 35 mins to fix
          app/src/main/java/sdp/moneyrun/ui/menu/MenuActivity.java on lines 259..261

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

          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

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

                  if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
                      return;
                  }
          Severity: Minor
          Found in app/src/main/java/sdp/moneyrun/ui/menu/MenuActivity.java and 1 other location - About 35 mins to fix
          app/src/main/java/sdp/moneyrun/ui/map/MapActivity.java on lines 165..167

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

          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

          Identical blocks of code found in 4 locations. Consider refactoring.
          Open

                  goBackToMenu.setOnClickListener(v -> {
                      Intent menuIntent = new Intent(FriendListActivity.this, MenuActivity.class);
                      menuIntent.putExtra("user", user);
                      startActivity(menuIntent);
                      finish();
          app/src/main/java/sdp/moneyrun/ui/map/OfflineMapDownloaderActivity.java on lines 74..79
          app/src/main/java/sdp/moneyrun/ui/menu/leaderboards/LeaderboardActivity.java on lines 142..147
          app/src/main/java/sdp/moneyrun/ui/menu/leaderboards/MainLeaderboardActivity.java on lines 54..59

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

          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

          Identical blocks of code found in 4 locations. Consider refactoring.
          Open

                  button.setOnClickListener(v -> {
                      Intent menuIntent = new Intent(LeaderboardActivity.this, MenuActivity.class);
                      menuIntent.putExtra("user", userFromEnd);
                      startActivity(menuIntent);
                      finish();
          app/src/main/java/sdp/moneyrun/ui/map/OfflineMapDownloaderActivity.java on lines 74..79
          app/src/main/java/sdp/moneyrun/ui/menu/friendlist/FriendListActivity.java on lines 52..57
          app/src/main/java/sdp/moneyrun/ui/menu/leaderboards/MainLeaderboardActivity.java on lines 54..59

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

          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

          Identical blocks of code found in 4 locations. Consider refactoring.
          Open

                  backToMenu.setOnClickListener(v -> {
                      Intent menuIntent = new Intent(MainLeaderboardActivity.this, MenuActivity.class);
                      menuIntent.putExtra("user", user);
                      startActivity(menuIntent);
                      finish();
          app/src/main/java/sdp/moneyrun/ui/map/OfflineMapDownloaderActivity.java on lines 74..79
          app/src/main/java/sdp/moneyrun/ui/menu/friendlist/FriendListActivity.java on lines 52..57
          app/src/main/java/sdp/moneyrun/ui/menu/leaderboards/LeaderboardActivity.java on lines 142..147

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

          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

          Identical blocks of code found in 4 locations. Consider refactoring.
          Open

                  exitButton.setOnClickListener(v -> {
                      Intent mainIntent = new Intent(OfflineMapDownloaderActivity.this, MenuActivity.class);
                      mainIntent.putExtra("user", user);
                      startActivity(mainIntent);
                      finish();
          app/src/main/java/sdp/moneyrun/ui/menu/friendlist/FriendListActivity.java on lines 52..57
          app/src/main/java/sdp/moneyrun/ui/menu/leaderboards/LeaderboardActivity.java on lines 142..147
          app/src/main/java/sdp/moneyrun/ui/menu/leaderboards/MainLeaderboardActivity.java on lines 54..59

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

          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

              @RequiresApi(api = Build.VERSION_CODES.N)
              public void addPlayer(@Nullable Player player) {
                  // can't just add a player directly to an adapter, we need to put it in a list first
                  if (player == null) {
                      throw new IllegalArgumentException("player should not be null");
          app/src/main/java/sdp/moneyrun/ui/menu/leaderboards/MainLeaderboardActivity.java on lines 140..148

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

          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

              @RequiresApi(api = Build.VERSION_CODES.N)
              public void addUser(@Nullable User user) {
                  // can't just add a user directly to an adapter, we need to put it in a list first.
                  if (user == null) {
                      throw new IllegalArgumentException("user should not be null.");
          app/src/main/java/sdp/moneyrun/ui/menu/leaderboards/LeaderboardActivity.java on lines 84..92

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

          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 equals has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              @Override
              public boolean equals(@Nullable Object o) {
                  if (this == o) return true;
                  if (o == null || getClass() != o.getClass()) return false;
                  Player player = (Player) o;
          Severity: Minor
          Found in app/src/main/java/sdp/moneyrun/player/Player.java - About 25 mins 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 minDistWithExistingCoins has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public static double minDistWithExistingCoins(@NonNull Location loc, @Nullable List<Coin> coins) {
                  if (coins == null) {
                      throw new IllegalStateException();
                  }
                  if (coins.isEmpty()) {
          Severity: Minor
          Found in app/src/main/java/sdp/moneyrun/map/CoinGenerationHelper.java - About 25 mins 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 equals has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              @Override
              public boolean equals(@Nullable Object o) {
                  if (this == o) return true;
                  if (o == null || getClass() != o.getClass()) return false;
                  GameDbData gameDbData = (GameDbData) o;
          Severity: Minor
          Found in app/src/main/java/sdp/moneyrun/database/game/GameDbData.java - About 25 mins 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

          Severity
          Category
          Status
          Source
          Language