MiroslavJelaska/SpaceInvaders

View on GitHub

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

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

            if(frameIndex == 2){
                area.add(new Area(new Rectangle(
                        location.x - 9, location.y - 9,
                        18, 18
                )));
    Severity: Major
    Found in src/vfx/Explosion.java and 2 other locations - About 1 hr to fix
    src/vfx/Explosion.java on lines 71..84
    src/vfx/Explosion.java on lines 99..112

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

    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 3 locations. Consider refactoring.
    Open

            if(frameIndex == 3){
                area.add(new Area(new Rectangle(
                        location.x - 10, location.y - 10,
                        20, 20
                )));
    Severity: Major
    Found in src/vfx/Explosion.java and 2 other locations - About 1 hr to fix
    src/vfx/Explosion.java on lines 71..84
    src/vfx/Explosion.java on lines 85..98

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

    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 3 locations. Consider refactoring.
    Open

            if(frameIndex == 1){
                area.add(new Area(new Rectangle(
                        location.x - 5, location.y - 5,
                        10, 10
                )));
    Severity: Major
    Found in src/vfx/Explosion.java and 2 other locations - About 1 hr to fix
    src/vfx/Explosion.java on lines 85..98
    src/vfx/Explosion.java on lines 99..112

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

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

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

                private static Area getSingleShapePeace(Point location, int xPosition, int yPosition, int width, int height){
                    return new Area(new Rectangle(
                            (int)(xPosition*DRAWING_SCALE) + location.x, (int)(yPosition*DRAWING_SCALE) + location.y,
                            (int)(width*DRAWING_SCALE), (int)(height*DRAWING_SCALE)));
                }
            Severity: Minor
            Found in src/actors/InvaderShip.java and 1 other location - About 55 mins to fix
            src/actors/HeroShip.java on lines 106..110

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

            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

                private static Area getSingleShapePeace(Point location, int xPosition, int yPosition, int width, int height){
                    return new Area(new Rectangle(
                            (int)(xPosition*DRAWING_SCALE) + location.x, (int)(yPosition*DRAWING_SCALE) + location.y,
                            (int)(width*DRAWING_SCALE), (int)(height*DRAWING_SCALE)));
                }
            Severity: Minor
            Found in src/actors/HeroShip.java and 1 other location - About 55 mins to fix
            src/actors/InvaderShip.java on lines 115..119

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

            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 3 locations. Consider refactoring.
            Open

            package events.commands;
            
            import actors.HeroProjectile;
            import game.Game;
            import utilities.Command;
            Severity: Major
            Found in src/events/commands/RemoveHeroProjectileOutOfWindow.java and 2 other locations - About 40 mins to fix
            src/events/commands/AbsorbProjectile.java on lines 1..19
            src/events/commands/RemoveInvaderProjectileOutOfWindow.java on lines 1..19

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

            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 3 locations. Consider refactoring.
            Open

            package events.commands;
            
            import actors.HeroProjectile;
            import game.Game;
            import utilities.Command;
            Severity: Major
            Found in src/events/commands/AbsorbProjectile.java and 2 other locations - About 40 mins to fix
            src/events/commands/RemoveHeroProjectileOutOfWindow.java on lines 1..19
            src/events/commands/RemoveInvaderProjectileOutOfWindow.java on lines 1..19

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

            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 3 locations. Consider refactoring.
            Open

            package events.commands;
            
            import actors.InvaderProjectile;
            import game.Game;
            import utilities.Command;
            Severity: Major
            Found in src/events/commands/RemoveInvaderProjectileOutOfWindow.java and 2 other locations - About 40 mins to fix
            src/events/commands/AbsorbProjectile.java on lines 1..19
            src/events/commands/RemoveHeroProjectileOutOfWindow.java on lines 1..19

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

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

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

                        Point projectileLocation = new Point(
                            (int)(heroShipLocation.getX() + HeroShip.WIDTH / 2 * HeroShip.DRAWING_SCALE),
                            (int)(heroShipLocation.getY()));
                Severity: Minor
                Found in src/events/commands/HeroShipShoot.java and 1 other location - About 30 mins to fix
                src/events/commands/InvaderShipShoot.java on lines 22..24

                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

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

                        Point projectileLocation = new Point(
                            (int)(randomInvaderBounds2D.getX() + InvaderShip.WIDTH / 2 * InvaderShip.DRAWING_SCALE),
                            (int)(randomInvaderBounds2D.getY()));
                Severity: Minor
                Found in src/events/commands/InvaderShipShoot.java and 1 other location - About 30 mins to fix
                src/events/commands/HeroShipShoot.java on lines 20..22

                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

                Severity
                Category
                Status
                Source
                Language