egordorichev/LastTry

View on GitHub

Showing 120 of 205 total issues

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

    public void render() {
        boolean displayedStats = false;

        int halfWidth = Gdx.graphics.getWidth() / 2;
        int halfHeight = Gdx.graphics.getHeight() / 2;
Severity: Minor
Found in core/src/org/egordorichev/lasttry/entity/EntityManager.java - About 1 hr to fix

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

        public static Optional<GenericContainer.Pair<Integer>> generateEligibleEnemySpawnPoint(
                CircleAreaComponent enemySpawnArea) {
    
            GenericContainer.Pair<Integer> minAndMaxDists = retrieveMinMaxDistances(enemySpawnArea);
    
    

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

          private static void overlay(Pixmap pixmap, Color color) {
              ByteBuffer bb = pixmap.getPixels();
      
              final float rTint = color.r;
              final float bTint = color.b;
      Severity: Minor
      Found in core/src/org/egordorichev/lasttry/player/skin/PlayerRenderer.java - About 1 hr to fix

        Method create has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public static byte create(boolean b1, boolean b2, boolean b3, boolean b4,
                boolean b5, boolean b6, boolean b7, boolean b8) {
        Severity: Major
        Found in core/src/org/egordorichev/lasttry/util/ByteHelper.java - About 1 hr to fix

          Method save has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              public static void save() {
                  File dir = new File(Files.getPlayersDir());
          
                  if (!dir.exists()) {
                      dir.mkdir();
          Severity: Minor
          Found in core/src/org/egordorichev/lasttry/player/PlayerIO.java - About 55 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 update has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              @Override
              public void update(int dt) {
                  super.update(dt);
          
                  if (!this.isActive()) {
          Severity: Minor
          Found in core/src/org/egordorichev/lasttry/player/Player.java - About 55 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 load has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              public static void load(String playerName) {
                  String fileName = Files.getPlayerSave(playerName);
                  File file = new File(fileName);
          
                  if (!file.exists()) {
          Severity: Minor
          Found in core/src/org/egordorichev/lasttry/player/PlayerIO.java - About 55 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 render has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              @Override
              public void render(float delta) {
                  Graphics.batch.setColor(1, 1, 1, this.alpha);
                  Graphics.batch.draw(this.splash, (Gdx.graphics.getWidth() - this.splash.getWidth()) / 2,
                          (Gdx.graphics.getHeight() - this.splash.getHeight()) / 2);
          Severity: Minor
          Found in core/src/org/egordorichev/lasttry/state/SplashState.java - About 55 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 update has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              public void update() {
                  if (this.frames.size() == 0 || this.stopped) {
                      return;
                  }
          
          
          Severity: Minor
          Found in core/src/org/egordorichev/lasttry/graphics/Animation.java - About 55 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 render has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              @Override
              public void render() {
                  if (this.hidden) {
                      return;
                  }
          Severity: Minor
          Found in core/src/org/egordorichev/lasttry/ui/UiItemSlot.java - About 55 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 drawWithShadow has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public static void drawWithShadow(BitmapFont font, String text, float x, float y, float r, float g, float b) {
          Severity: Major
          Found in core/src/org/egordorichev/lasttry/util/Util.java - About 50 mins to fix

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

                public void render(float x, float y, float width, float height, boolean horizontalFlip,
                                   boolean verticalFlip) {
            Severity: Minor
            Found in core/src/org/egordorichev/lasttry/graphics/Animation.java - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if (count == 1) {
                                          slots[activeSlot].setItemHolder(new ItemHolder(null, 0));
                                      } else {
                                          holder.setCount(count - 1);
                                      }
              Severity: Major
              Found in core/src/org/egordorichev/lasttry/ui/UiInventory.java - About 45 mins to fix

                Method canBeUsed has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    @Override
                    public boolean canBeUsed(short x, short y) {
                        if (!super.canBeUsed(x, y)) {
                            return false;
                        }
                Severity: Minor
                Found in core/src/org/egordorichev/lasttry/item/block/MultiTileBlock.java - About 45 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

                Avoid deeply nested control flow statements.
                Open

                                        if (dist <= sampleRadius - 0.125f) {
                                            strength = (float) Math.pow(10000, 1.75f / dist);
                                        }

                  Avoid deeply nested control flow statements.
                  Open

                                          if (wall != null) {
                                              wall.renderWall(x, y);
                                          }

                    Method noise has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public static double noise(double xin, double yin) {
                            double n0, n1, n2; // Noise contributions from the three corners
                            // Skew the input space to determine which simplex cell we're in
                            final double F2 = 0.5 * (Math.sqrt(3.0) - 1.0);
                            double s = (xin + yin) * F2; // Hairy factor for 2D
                    Severity: Minor
                    Found in core/src/org/egordorichev/lasttry/util/SimplexNoise.java - About 45 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 delete has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public static void delete(File file) {
                            if (file.exists()) {
                                if (file.isDirectory()) {
                                    for (File child : file.listFiles()) {
                                        delete(child);
                    Severity: Minor
                    Found in core/src/org/egordorichev/lasttry/util/Util.java - About 45 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

                    Avoid deeply nested control flow statements.
                    Open

                                            if (this.velocity.y != -0.4f) {
                                                this.onGroundHit.call();
                                            }

                      Method runCommand has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public boolean runCommand(String handle, String[] args) {
                              if (!hasCommand(handle)) {
                                  Globals.chat.print("Unknown command");
                                  return false;
                              }
                      Severity: Minor
                      Found in core/src/org/egordorichev/lasttry/ui/chat/command/CommandHandler.java - About 45 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