egordorichev/LastTry

View on GitHub

Showing 120 of 205 total issues

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

    @Override
    public UiItemSlot getFirstFreeSlot(UiItemSlot.Type type) {
        switch (type) {
        case ACCESSORY:
            return this.getFirstFreeSlot(68, 73);
Severity: Minor
Found in core/src/org/egordorichev/lasttry/ui/UiInventory.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 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

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 octavedNoise has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public static float octavedNoise(float x, float y, int octaves, float roughness, float scale) {
Severity: Minor
Found in core/src/org/egordorichev/lasttry/util/SimplexNoise.java - About 35 mins to fix

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

        public static float map(float value, float inMin, float inMax, float outMin, float outMax) {
    Severity: Minor
    Found in core/src/org/egordorichev/lasttry/util/Util.java - About 35 mins to fix

      Method createInstance has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public static Item createInstance(JsonValue root, String className) throws Exception {
              try {
                  Class<?> itemClass = Class.forName(className);
      
                  Class<?>[] types = {String.class};
      Severity: Minor
      Found in core/src/org/egordorichev/lasttry/item/Item.java - About 35 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 overlay has a Cognitive Complexity of 7 (exceeds 5 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 35 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 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public static void load(String name) {
              String fileName = Files.getWorldSave(name);
              File file = new File(fileName);
      
              if (!file.exists()) {
      Severity: Minor
      Found in core/src/org/egordorichev/lasttry/world/WorldIO.java - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public void load() {
              File modDirectory = new File(Files.getModsDir());
      
              if (!modDirectory.mkdir()) {
                  try {
      Severity: Minor
      Found in core/src/org/egordorichev/lasttry/mod/ModLoader.java - About 35 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 setupComponents has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          @Override
          public void setupComponents() {
              super.setupComponents();
              this.physics = new PhysicsComponent<DamageParticle>(this) {
                  @Override
      Severity: Minor
      Found in core/src/org/egordorichev/lasttry/graphics/particle/DamageParticle.java - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
      Open

          @Override
          public void update(int dt) {
              super.update(dt);
      
              if (this.velocity.y < -1.6) {

      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 updateLight has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public void updateLight(int dt) {
              if (!LastTry.noLight) {
                  if (lightDirty) {
                      this.light.update(dt);
                      this.light.clearCache();
      Severity: Minor
      Found in core/src/org/egordorichev/lasttry/world/World.java - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public static void save(int x, int y) {
              String fileName = Files.getChunkSave(x, y);
              File file = new File(fileName);
              if (!file.exists()) {
                  try {
      Severity: Minor
      Found in core/src/org/egordorichev/lasttry/world/chunk/ChunkIO.java - About 35 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 toString has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public String toString(boolean use12hoursFormat) {
              Byte minuteByte = minute;
              String minuteString = minuteByte.toString();
              StringBuilder minuteBuilder = new StringBuilder(minuteString);
              if(minuteString.length() != 2){
      Severity: Minor
      Found in core/src/org/egordorichev/lasttry/world/WorldTime.java - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
      Open

          protected void update() {
              Rectangle rectangle = new Rectangle(this.getX(), this.getClickY(), this.getWidth(), this.getHeight());
      
              int x = (int) InputManager.getMousePosition().x;
              int y = (int) InputManager.getMousePosition().y;
      Severity: Minor
      Found in core/src/org/egordorichev/lasttry/ui/UiComponent.java - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public static Recipe load(JsonValue root) throws Exception {
              Recipe recipe = new Recipe();
      
              if (root.has("stations")) {
                  JsonValue stations = root.get("stations");
      Severity: Minor
      Found in core/src/org/egordorichev/lasttry/crafting/Recipe.java - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public void save() {
              for (int y = 0; y < Globals.getWorld().getHeight() / Chunk.SIZE; y++) {
                  for (int x = 0; x < Globals.getWorld().getWidth() / Chunk.SIZE; x++) {
                      if (this.get(x, y) != null) {
                          ChunkIO.save(x, y);

      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 too many return statements within this method.
      Open

              return true;
      Severity: Major
      Found in core/src/org/egordorichev/lasttry/inventory/InventorySlot.java - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                        return false;
        Severity: Major
        Found in core/src/org/egordorichev/lasttry/inventory/InventorySlot.java - About 30 mins to fix
          Severity
          Category
          Status
          Source
          Language