ArtifactForms/MeshLibCore

View on GitHub
src/main/java/workspace/GraphicsPImpl.java

Summary

Maintainability
F
3 days
Test Coverage

GraphicsPImpl has 50 methods (exceeds 20 allowed). Consider refactoring.
Open

public class GraphicsPImpl implements Graphics {

  private boolean wireframeMode;

  private Color color;
Severity: Minor
Found in src/main/java/workspace/GraphicsPImpl.java - About 7 hrs to fix

    File GraphicsPImpl.java has 394 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    package workspace;
    
    import java.util.List;
    
    import engine.processing.LightGizmoRenderer;
    Severity: Minor
    Found in src/main/java/workspace/GraphicsPImpl.java - About 5 hrs to fix

      Method setMaterial has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        @Override
        public void setMaterial(Material material) {
          if (material == null) {
            System.err.println("Warning: Null material passed to setMaterial().");
            return;
      Severity: Minor
      Found in src/main/java/workspace/GraphicsPImpl.java - About 1 hr to fix

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

          public void drawLine(float x1, float y1, float z1, float x2, float y2, float z2) {
        Severity: Minor
        Found in src/main/java/workspace/GraphicsPImpl.java - About 45 mins to fix

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

            @Override
            public void setMaterial(Material material) {
              if (material == null) {
                System.err.println("Warning: Null material passed to setMaterial().");
                return;
          Severity: Minor
          Found in src/main/java/workspace/GraphicsPImpl.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 drawRoundRect has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            public void drawRoundRect(float x, float y, float width, float height, float radii) {
          Severity: Minor
          Found in src/main/java/workspace/GraphicsPImpl.java - About 35 mins to fix

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

              public void fillRoundRect(float x, float y, float width, float height, float radii) {
            Severity: Minor
            Found in src/main/java/workspace/GraphicsPImpl.java - About 35 mins to fix

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

                private void drawMeshFaces(Mesh3D mesh) {
                  //    g.beginShape(PApplet.TRIANGLES);
                  //    for (Face3D f : mesh.getFaces()) {
                  //      for (int index : f.indices) {
                  //        Vector3f v = mesh.vertices.get(index);
              Severity: Minor
              Found in src/main/java/workspace/GraphicsPImpl.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

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

                  g.applyMatrix(
                      values[0],
                      values[1],
                      values[2],
                      values[3],
              Severity: Major
              Found in src/main/java/workspace/GraphicsPImpl.java and 1 other location - About 1 hr to fix
              src/main/java/workspace/GraphicsPImpl.java on lines 99..115

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

              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

                  g.applyMatrix(
                      matrix[0],
                      matrix[1],
                      matrix[2],
                      matrix[3],
              Severity: Major
              Found in src/main/java/workspace/GraphicsPImpl.java and 1 other location - About 1 hr to fix
              src/main/java/workspace/GraphicsPImpl.java on lines 511..527

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

              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

                    if (f.indices.length == 3) {
                      g.beginShape(PApplet.TRIANGLES);
                    } else if (f.indices.length == 4) {
                      g.beginShape(PApplet.QUADS);
                    } else {
              Severity: Minor
              Found in src/main/java/workspace/GraphicsPImpl.java and 1 other location - About 50 mins to fix
              src/main/java/workspace/render/Mesh3DRenderer.java on lines 173..179

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

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

                @Override
                public void drawRoundRect(float x, float y, float width, float height, float radii) {
                  g.pushStyle();
                  g.noFill();
                  stroke();
              Severity: Minor
              Found in src/main/java/workspace/GraphicsPImpl.java and 1 other location - About 45 mins to fix
              src/main/java/workspace/GraphicsPImpl.java on lines 242..250

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

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

                @Override
                public void fillRoundRect(float x, float y, float width, float height, float radii) {
                  g.pushStyle();
                  g.noStroke();
                  fill();
              Severity: Minor
              Found in src/main/java/workspace/GraphicsPImpl.java and 1 other location - About 45 mins to fix
              src/main/java/workspace/GraphicsPImpl.java on lines 232..240

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

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

                @Override
                public void fillOval(float x, float y, float width, float height) {
                  g.pushStyle();
                  g.noStroke();
                  fill();
              Severity: Major
              Found in src/main/java/workspace/GraphicsPImpl.java and 3 other locations - About 45 mins to fix
              src/main/java/workspace/GraphicsPImpl.java on lines 212..220
              src/main/java/workspace/GraphicsPImpl.java on lines 222..230
              src/main/java/workspace/GraphicsPImpl.java on lines 270..278

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

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

                @Override
                public void drawRect(float x, float y, float width, float height) {
                  g.pushStyle();
                  g.noFill();
                  stroke();
              Severity: Major
              Found in src/main/java/workspace/GraphicsPImpl.java and 3 other locations - About 45 mins to fix
              src/main/java/workspace/GraphicsPImpl.java on lines 222..230
              src/main/java/workspace/GraphicsPImpl.java on lines 270..278
              src/main/java/workspace/GraphicsPImpl.java on lines 280..288

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

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

                @Override
                public void fillRect(float x, float y, float width, float height) {
                  g.pushStyle();
                  g.noStroke();
                  fill();
              Severity: Major
              Found in src/main/java/workspace/GraphicsPImpl.java and 3 other locations - About 45 mins to fix
              src/main/java/workspace/GraphicsPImpl.java on lines 212..220
              src/main/java/workspace/GraphicsPImpl.java on lines 270..278
              src/main/java/workspace/GraphicsPImpl.java on lines 280..288

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

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

                @Override
                public void drawOval(float x, float y, float width, float height) {
                  g.pushStyle();
                  g.noFill();
                  stroke();
              Severity: Major
              Found in src/main/java/workspace/GraphicsPImpl.java and 3 other locations - About 45 mins to fix
              src/main/java/workspace/GraphicsPImpl.java on lines 212..220
              src/main/java/workspace/GraphicsPImpl.java on lines 222..230
              src/main/java/workspace/GraphicsPImpl.java on lines 280..288

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

              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 (specular == null || specular.length < 3) {
                    specular = new float[] {1.0f, 1.0f, 1.0f}; // Default specular
                    System.err.println(
                        "Warning: Material specular property is null or incomplete. Using default.");
                  }
              Severity: Minor
              Found in src/main/java/workspace/GraphicsPImpl.java and 2 other locations - About 40 mins to fix
              src/main/java/workspace/GraphicsPImpl.java on lines 435..439
              src/main/java/workspace/GraphicsPImpl.java on lines 440..444

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

              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 (diffuse == null || diffuse.length < 3) {
                    diffuse = new float[] {1.0f, 1.0f, 1.0f}; // Default diffuse
                    System.err.println(
                        "Warning: Material diffuse property is null or incomplete. Using default.");
                  }
              Severity: Minor
              Found in src/main/java/workspace/GraphicsPImpl.java and 2 other locations - About 40 mins to fix
              src/main/java/workspace/GraphicsPImpl.java on lines 435..439
              src/main/java/workspace/GraphicsPImpl.java on lines 445..449

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

              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 (ambient == null || ambient.length < 3) {
                    ambient = new float[] {0.2f, 0.2f, 0.2f}; // Default ambient
                    System.err.println(
                        "Warning: Material ambient property is null or incomplete. Using default.");
                  }
              Severity: Minor
              Found in src/main/java/workspace/GraphicsPImpl.java and 2 other locations - About 40 mins to fix
              src/main/java/workspace/GraphicsPImpl.java on lines 440..444
              src/main/java/workspace/GraphicsPImpl.java on lines 445..449

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

              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

              There are no issues that match your filters.

              Category
              Status