niwa99/Tower-Defense

View on GitHub

Showing 39 of 88 total issues

Method generateButtonsOnMap has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
Open

    private void generateButtonsOnMap() {

        List<Button> mapButtons = new ArrayList<>();
        View.OnClickListener listener = view -> {
            Optional<Button> button = mapButtons.stream().filter(e -> view.getTransitionName().equals(e.getTransitionName())).findFirst();
Severity: Minor
Found in app/src/main/java/de/dhbw/game/Game.java - About 1 day 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

File Game.java has 512 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package de.dhbw.game;

import android.app.AlertDialog;
import android.content.Intent;
import android.view.View;
Severity: Major
Found in app/src/main/java/de/dhbw/game/Game.java - About 1 day to fix

    Method create has 156 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        @Override
        public void create(GameActivity gameActivity) {
            Wave wave1 = new Wave(waveSpeed);
            wave1.addWaveCompositions(w1_Plane);
            wave1.generate(gameActivity);
    Severity: Major
    Found in app/src/main/java/de/dhbw/game/match/HardMatch.java - About 6 hrs to fix

      Game has 45 methods (exceeds 20 allowed). Consider refactoring.
      Open

      public class Game {
      
          private GameActivity gameActivity;
      
          private MapStructure mapStructure;
      Severity: Minor
      Found in app/src/main/java/de/dhbw/game/Game.java - About 6 hrs to fix

        Method calculatePath has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
        Open

            public static int calculatePath(float xCoord, float yCoord) {
        
                int pathImage = DRAWABLE_PATH_HORIZONTAL;
                int pathNumber = getPathNumber(xCoord, yCoord);
                if (pathNumber != 0 && pathNumber != 20) {
        Severity: Minor
        Found in app/src/main/java/de/dhbw/map/structure/MapStructure.java - About 5 hrs 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 create has 125 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            @Override
            public void create(GameActivity gameActivity) {
        
                Wave wave1 = new Wave(waveSpeed);
                wave1.addWaveCompositions(w1_Tank);
        Severity: Major
        Found in app/src/main/java/de/dhbw/game/match/MediumMatch.java - About 5 hrs to fix

          ATower has 31 methods (exceeds 20 allowed). Consider refactoring.
          Open

          public abstract class ATower extends ATimerUsage {
          
              private UUID id;
              private TowerType towerType;
              private int level;
          Severity: Minor
          Found in app/src/main/java/de/dhbw/map/objects/tower/ATower.java - About 3 hrs to fix

            AEnemy has 31 methods (exceeds 20 allowed). Consider refactoring.
            Open

            public abstract class AEnemy {
                private String label;
                private UUID uuid;
                private boolean isPaused = false;
                private int value;
            Severity: Minor
            Found in app/src/main/java/de/dhbw/map/objects/enemy/AEnemy.java - About 3 hrs to fix

              Method create has 94 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  @Override
                  public void create(GameActivity gameActivity) {
              
                      Wave wave1 = new Wave(waveSpeed);
                      wave1.addWaveCompositions(w1_Car);
              Severity: Major
              Found in app/src/main/java/de/dhbw/game/match/EasyMatch.java - About 3 hrs to fix

                Method generateButtonsOnMap has 93 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private void generateButtonsOnMap() {
                
                        List<Button> mapButtons = new ArrayList<>();
                        View.OnClickListener listener = view -> {
                            Optional<Button> button = mapButtons.stream().filter(e -> view.getTransitionName().equals(e.getTransitionName())).findFirst();
                Severity: Major
                Found in app/src/main/java/de/dhbw/game/Game.java - About 3 hrs to fix

                  MatchField has 27 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  public class MatchField {
                  
                      private final GameActivity gameActivity;
                      private List<AEnemy> enemies;
                      private List<ATower> towers;
                  Severity: Minor
                  Found in app/src/main/java/de/dhbw/map/matchfield/MatchField.java - About 3 hrs to fix

                    GameActivity has 26 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    public class GameActivity extends AppCompatActivity implements IStatusBar {
                    
                        private static final boolean AUTO_HIDE = true;
                        private static final int AUTO_HIDE_DELAY_MILLIS = 3000;
                        private static final int UI_ANIMATION_DELAY = 300;
                    Severity: Minor
                    Found in app/src/main/java/de/dhbw/activities/GameActivity.java - About 3 hrs to fix

                      File MatchField.java has 270 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      package de.dhbw.map.matchfield;
                      
                      import android.view.View;
                      import android.widget.ImageView;
                      
                      
                      Severity: Minor
                      Found in app/src/main/java/de/dhbw/map/matchfield/MatchField.java - About 2 hrs to fix

                        Method createPath has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private FieldDescription[][] createPath() {
                                // There is only one fixed Path with the Coordinates generated as following
                                FieldDescription[][] fieldDescription = new FieldDescription[AMOUNT_COLUMNS][AMOUNT_ROWS];
                                boolean spawn = true;
                                for (int i = 0; i < 11; i++) {
                        Severity: Minor
                        Found in app/src/main/java/de/dhbw/map/structure/MapStructure.java - About 2 hrs 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

                        File HardMatch.java has 256 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        package de.dhbw.game.match;
                        
                        import de.dhbw.activities.GameActivity;
                        import de.dhbw.game.Difficulty;
                        import de.dhbw.game.EnemyType;
                        Severity: Minor
                        Found in app/src/main/java/de/dhbw/game/match/HardMatch.java - About 2 hrs to fix

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

                              public static int calculatePath(float xCoord, float yCoord) {
                          
                                  int pathImage = DRAWABLE_PATH_HORIZONTAL;
                                  int pathNumber = getPathNumber(xCoord, yCoord);
                                  if (pathNumber != 0 && pathNumber != 20) {
                          Severity: Minor
                          Found in app/src/main/java/de/dhbw/map/structure/MapStructure.java - About 1 hr to fix

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

                                public void startMusicPlayer(Activity activity){
                                    this.isStarted=true;
                                    if(timer!=null){
                                        timer.cancel();
                                        timerTask.cancel();
                            Severity: Minor
                            Found in app/src/main/java/de/dhbw/game/MusicPlayer.java - About 1 hr to fix

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

                                  public boolean move(MapStructure map) {
                                      if (actualField == null) {
                                          actualField = getEnemyField(map);
                                          progress++;
                                          moveToPosition(actualField.getSpawnPoint());
                              Severity: Minor
                              Found in app/src/main/java/de/dhbw/map/objects/enemy/AEnemy.java - About 1 hr to fix

                                Method slowEnemy has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public void slowEnemy(AEnemy enemy){
                                        if(matchFieldTimer.isCanceled()){
                                            return;
                                        }
                                        enemy.getTimerTask().cancel();
                                Severity: Minor
                                Found in app/src/main/java/de/dhbw/map/matchfield/MatchField.java - 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 hitEnemy has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    @Override
                                    protected void hitEnemy() {
                                        super.hitEnemy();
                                
                                        enemies.remove(targetEnemy);
                                Severity: Minor
                                Found in app/src/main/java/de/dhbw/map/objects/bullet/PlasmaBall.java - 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

                                Severity
                                Category
                                Status
                                Source
                                Language