egordorichev/LastTry

View on GitHub

Showing 120 of 205 total issues

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

    public Creature create() {
        Enemy creature = new Enemy(this.id, this.ai);

        int hp = this.hp[0];
        int defense = this.damage[0];
Severity: Minor
Found in core/src/org/egordorichev/lasttry/entity/CreatureInfo.java - About 1 hr to fix

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

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

                @Override
                public void run(WorldGenerator generator) {
                    logger.info("Generating heightmap");
                    int width = generator.getWorldWidth();
                    int height = generator.getWorldHeight();

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

              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 (wall != null) {
                                          wall.renderWall(x, y);
                                      }

                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

                  Avoid deeply nested control flow statements.
                  Open

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

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

                        private void loadMod(File file) {
                            try (JarFile jarFile = new JarFile(file)) {
                                URL[] urls = new URL[] { new URL("jar:file:" + file.getAbsolutePath() + "!/") };
                    
                                URLClassLoader urlClassLoader = URLClassLoader.newInstance(urls);
                    Severity: Minor
                    Found in core/src/org/egordorichev/lasttry/mod/ModLoader.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 update has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        @Override
                        public void update(CreatureWithAI creature, int dt, int currentAi) {
                            if (currentAi == 0) {
                                if (creature.physics.getVelocity().y == 0) {
                                    creature.physics.jump();
                    Severity: Minor
                    Found in core/src/org/egordorichev/lasttry/entity/ai/ais/SlimeAI.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