MiroslavJelaska/SpaceInvaders

View on GitHub

Showing 9 of 19 total issues

Method getAnimationFrame has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private static Area getAnimationFrame(int frameIndex, Point location){
        Area area = new Area();

        if(frameIndex == 0){
            area.add(new Area(new Rectangle(
Severity: Major
Found in src/vfx/Explosion.java - About 2 hrs to fix

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

        public void Detect(){
            for (InvaderProjectile invaderProjectile : game.allInvaderProjectiles){
                if(IsShapeOutsideWindow(invaderProjectile))
                    eventResolution.Push(new RemoveInvaderProjectileOutOfWindow(invaderProjectile));
                else if(areTwoShapesInCollision(game.heroShip, invaderProjectile))
    Severity: Minor
    Found in src/collision/CollisionDetection.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

    Method run has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        public void run() {
            long lastTime = System.nanoTime();
            double nsPerUpdate = Math.pow(10D, 9) / 60;
            double delta = 0;
    
    
    Severity: Minor
    Found in src/game/Game.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 run has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public void run() {
            long lastTime = System.nanoTime();
            double nsPerUpdate = Math.pow(10D, 9) / 60;
            double delta = 0;
    
    
    Severity: Minor
    Found in src/game/Game.java - About 1 hr to fix

      Method getAnimationFrame has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private static Area getAnimationFrame(int frameIndex, Point location){
              Area area = new Area();
      
              if(frameIndex == 0){
                  area.add(new Area(new Rectangle(
      Severity: Minor
      Found in src/actors/InvaderProjectile.java - About 1 hr to fix

        Method Detect has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public void Detect(){
                for (InvaderProjectile invaderProjectile : game.allInvaderProjectiles){
                    if(IsShapeOutsideWindow(invaderProjectile))
                        eventResolution.Push(new RemoveInvaderProjectileOutOfWindow(invaderProjectile));
                    else if(areTwoShapesInCollision(game.heroShip, invaderProjectile))
        Severity: Minor
        Found in src/collision/CollisionDetection.java - About 1 hr to fix

          Method GenerateShape has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private static Area GenerateShape(Point location){
                  Area area = new Area(new Rectangle(
                          location.x, location.y,
                          (int)(WIDTH*DRAWING_SCALE),(int)(HEIGHT*DRAWING_SCALE)));
          
          
          Severity: Minor
          Found in src/actors/InvaderShip.java - About 1 hr to fix

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

                private static Area getSingleShapePeace(Point location, int xPosition, int yPosition, int width, int height){
            Severity: Minor
            Found in src/actors/HeroShip.java - About 35 mins to fix

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

                  private static Area getSingleShapePeace(Point location, int xPosition, int yPosition, int width, int height){
              Severity: Minor
              Found in src/actors/InvaderShip.java - About 35 mins to fix
                Severity
                Category
                Status
                Source
                Language