ArtifactForms/MeshLibCore

View on GitHub

Showing 407 of 407 total issues

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

package workspace.command;

import workspace.WorkspaceModel;

public class ShowHideSideBarCommand extends AbstractWorkspaceKeyCommand {
Severity: Major
Found in src/main/java/workspace/command/ShowHideSideBarCommand.java and 8 other locations - About 30 mins to fix
src/main/java/workspace/command/ShowHideEdgesCommand.java on lines 1..18
src/main/java/workspace/command/ShowHideFaceNormalsCommand.java on lines 1..18
src/main/java/workspace/command/ShowHideGridCommand.java on lines 1..18
src/main/java/workspace/command/ShowHideVertexNormalsCommand.java on lines 1..18
src/main/java/workspace/command/ShowHideXAxisCommand.java on lines 1..18
src/main/java/workspace/command/ShowHideYAxisCommand.java on lines 1..18
src/main/java/workspace/command/ShowHideZAxisCommand.java on lines 1..18
src/main/java/workspace/command/WireframeCommand.java on lines 1..18

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

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

package workspace.command;

import workspace.WorkspaceModel;

public class ShowHideEdgesCommand extends AbstractWorkspaceKeyCommand {
Severity: Major
Found in src/main/java/workspace/command/ShowHideEdgesCommand.java and 8 other locations - About 30 mins to fix
src/main/java/workspace/command/ShowHideFaceNormalsCommand.java on lines 1..18
src/main/java/workspace/command/ShowHideGridCommand.java on lines 1..18
src/main/java/workspace/command/ShowHideSideBarCommand.java on lines 1..18
src/main/java/workspace/command/ShowHideVertexNormalsCommand.java on lines 1..18
src/main/java/workspace/command/ShowHideXAxisCommand.java on lines 1..18
src/main/java/workspace/command/ShowHideYAxisCommand.java on lines 1..18
src/main/java/workspace/command/ShowHideZAxisCommand.java on lines 1..18
src/main/java/workspace/command/WireframeCommand.java on lines 1..18

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

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

package workspace.command;

import workspace.WorkspaceModel;

public class ShowHideZAxisCommand extends AbstractWorkspaceKeyCommand {
Severity: Major
Found in src/main/java/workspace/command/ShowHideZAxisCommand.java and 8 other locations - About 30 mins to fix
src/main/java/workspace/command/ShowHideEdgesCommand.java on lines 1..18
src/main/java/workspace/command/ShowHideFaceNormalsCommand.java on lines 1..18
src/main/java/workspace/command/ShowHideGridCommand.java on lines 1..18
src/main/java/workspace/command/ShowHideSideBarCommand.java on lines 1..18
src/main/java/workspace/command/ShowHideVertexNormalsCommand.java on lines 1..18
src/main/java/workspace/command/ShowHideXAxisCommand.java on lines 1..18
src/main/java/workspace/command/ShowHideYAxisCommand.java on lines 1..18
src/main/java/workspace/command/WireframeCommand.java on lines 1..18

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

        if (max == null) {
            if (other.max != null)
                return false;
        } else if (!max.equals(other.max))
            return false;
Severity: Major
Found in src/main/java/mesh/util/Bounds3.java and 3 other locations - About 30 mins to fix
src/main/java/mesh/modifier/subdivision/DooSabinModifier.java on lines 249..253
src/main/java/mesh/modifier/subdivision/DooSabinModifier.java on lines 254..258
src/main/java/mesh/util/Bounds3.java on lines 238..242

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

Avoid too many return statements within this method.
Open

    if (Float.floatToIntBits(y) != Float.floatToIntBits(other.y)) return false;
Severity: Major
Found in src/main/java/math/Vector3f.java - About 30 mins to fix

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

                if (face == null) {
                    if (other.face != null)
                        return false;
                } else if (!face.equals(other.face))
                    return false;
    Severity: Major
    Found in src/main/java/mesh/modifier/subdivision/DooSabinModifier.java and 3 other locations - About 30 mins to fix
    src/main/java/mesh/modifier/subdivision/DooSabinModifier.java on lines 254..258
    src/main/java/mesh/util/Bounds3.java on lines 233..237
    src/main/java/mesh/util/Bounds3.java on lines 238..242

    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

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

      public Vector3f addLocal(float x, float y, float z) {
        this.x += x;
        this.y += y;
        this.z += z;
        return this;
    Severity: Major
    Found in src/main/java/math/Vector3f.java and 4 other locations - About 30 mins to fix
    src/main/java/math/Vector3f.java on lines 252..257
    src/main/java/math/Vector3f.java on lines 279..284
    src/main/java/math/Vector3f.java on lines 306..311
    src/main/java/math/Vector3f.java on lines 467..472

    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

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

      public Vector3f divideLocal(float x, float y, float z) {
        this.x /= x;
        this.y /= y;
        this.z /= z;
        return this;
    Severity: Major
    Found in src/main/java/math/Vector3f.java and 4 other locations - About 30 mins to fix
    src/main/java/math/Vector3f.java on lines 225..230
    src/main/java/math/Vector3f.java on lines 252..257
    src/main/java/math/Vector3f.java on lines 279..284
    src/main/java/math/Vector3f.java on lines 467..472

    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

    Method selectSphere has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public void selectSphere(Vector3f center, float radius) {
            for (Face3D face : mesh.getFaces()) {
                for (int i = 0; i < face.indices.length; i++) {
                    Vector3f v = mesh.getVertexAt(face.indices[i]);
                    float distance = center.distance(v);
    Severity: Minor
    Found in src/main/java/mesh/selection/FaceSelection.java - About 25 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 removeRegion has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public void removeRegion(float minX, float maxX, float minY, float maxY,
                float minZ, float maxZ) {
            for (Face3D f : mesh.faces) {
                int n = f.indices.length;
                boolean remove = true;
    Severity: Minor
    Found in src/main/java/mesh/selection/FaceSelection.java - About 25 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 createSegments has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        private void createSegments() {
            for (int z = 0; z < segmentsZ; z++)
                for (int y = 0; y < segmentsY; y++)
                    for (int x = 0; x < segmentsX; x++)
                        createSegmentAt(x, y, z);
    Severity: Minor
    Found in src/main/java/mesh/creator/creative/CubicLatticeCreator.java - About 25 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 connectJoints has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        private void connectJoints() {
            for (int z = 0; z < cubes[0][0].length; z++)
                for (int y = 0; y < cubes.length; y++)
                    for (int x = 0; x < cubes[0].length; x++)
                        connectJointAt(x, y, z);
    Severity: Minor
    Found in src/main/java/mesh/creator/unsorted/CubeJointLatticeCubeCreator.java - About 25 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 encapsulate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public void encapsulate(Bounds3 b) {
            float minX = b.min.getX() < min.getX() ? b.min.getX() : min.getX();
            float minY = b.min.getY() < min.getY() ? b.min.getY() : min.getY();
            float minZ = b.min.getZ() < min.getZ() ? b.min.getZ() : min.getZ();
            float maxX = b.max.getX() > max.getX() ? b.max.getX() : max.getX();
    Severity: Minor
    Found in src/main/java/mesh/util/Bounds3.java - About 25 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 selectByVertex has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public void selectByVertex(Vector3f v) {
            for (Face3D face : mesh.faces) {
                for (int i = 0; i < face.indices.length; i++) {
                    Vector3f v0 = mesh.getVertexAt(face.indices[i]);
                    if (v0.equals(v)) {
    Severity: Minor
    Found in src/main/java/mesh/selection/FaceSelection.java - About 25 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 encapsulate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public void encapsulate(Vector3f v) {
            float minX = v.getX() < min.getX() ? v.getX() : min.getX();
            float minY = v.getY() < min.getY() ? v.getY() : min.getY();
            float minZ = v.getZ() < min.getZ() ? v.getZ() : min.getZ();
            float maxX = v.getX() > max.getX() ? v.getX() : max.getX();
    Severity: Minor
    Found in src/main/java/mesh/util/Bounds3.java - About 25 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 keyEvent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      public void keyEvent(KeyEvent e) {
        if (!isUseKeyBindings()) return;
    
        if (e.getAction() != KeyEvent.TYPE) return;
    
    
    Severity: Minor
    Found in src/main/java/workspace/Workspace.java - About 25 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 createSegments has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        private void createSegments() {
            for (int i = 0; i < colCount; i++) {
                for (int j = 0; j < rowCount; j++) {
                    Mesh3D segment = createHexSegment();
                    Bounds3 bounds = segment.calculateBounds();
    Severity: Minor
    Found in src/main/java/mesh/creator/special/HoneyCombCreator.java - About 25 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 drawCheckerGrid has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      public void drawCheckerGrid(int rows, int cols, float size) {
        context.pushStyle();
        context.noStroke();
    
        context.pushMatrix();
    Severity: Minor
    Found in src/main/java/workspace/render/Mesh3DRenderer.java - About 25 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 selectRegion has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public void selectRegion(float minX, float maxX, float minY, float maxY,
                float minZ, float maxZ) {
            for (Face3D f : mesh.faces) {
                int n = f.indices.length;
                boolean add = true;
    Severity: Minor
    Found in src/main/java/mesh/selection/FaceSelection.java - About 25 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 mapEdgesToFaces has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        private void mapEdgesToFaces() {
            for (Face3D face : source.faces) {
                for (int i = 0; i < face.indices.length; i++) {
                    int a = face.indices[i];
                    int b = face.indices[(i + 1) % face.indices.length];
    Severity: Minor
    Found in src/main/java/mesh/modifier/subdivision/DooSabinModifier.java - About 25 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