Kuangcp/JavaBase

View on GitHub

Showing 134 of 360 total issues

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

        for (y = tempY; contains(chess, x - 1, y + 1, color); y++) {
            count++;
            x--;
        }
Severity: Major
Found in gui/src/main/java/com/github/kuangcp/gomoku/CheckWin.java and 3 other locations - About 35 mins to fix
gui/src/main/java/com/github/kuangcp/gomoku/CheckWin.java on lines 41..44
gui/src/main/java/com/github/kuangcp/gomoku/CheckWin.java on lines 47..50
gui/src/main/java/com/github/kuangcp/gomoku/CheckWin.java on lines 62..65

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

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

        if (e.getKeyCode() == KeyEvent.VK_A) {
            hero.setDirect(2);
            if ((hero.getX() - 10) > 0)
                hero.moveLeft();

Severity: Major
Found in gui/src/main/java/com/github/kuangcp/tank/v1/MainPanelV1.java and 3 other locations - About 35 mins to fix
gui/src/main/java/com/github/kuangcp/tank/v1/MainPanelV1.java on lines 134..138
gui/src/main/java/com/github/kuangcp/tank/v1/MainPanelV1.java on lines 140..145
gui/src/main/java/com/github/kuangcp/tank/v1/MainPanelV1.java on lines 146..151

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

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

        if (e.getKeyCode() == KeyEvent.VK_D) {
            hero.setDirect(3);
            if ((hero.getX() + 15) < 405)
                hero.moveRight();
        }
Severity: Major
Found in gui/src/main/java/com/github/kuangcp/tank/v1/MainPanelV1.java and 3 other locations - About 35 mins to fix
gui/src/main/java/com/github/kuangcp/tank/v1/MainPanelV1.java on lines 128..133
gui/src/main/java/com/github/kuangcp/tank/v1/MainPanelV1.java on lines 140..145
gui/src/main/java/com/github/kuangcp/tank/v1/MainPanelV1.java on lines 146..151

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

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

        if (e.getKeyCode() == KeyEvent.VK_S) {
            hero.setDirect(1);
            if ((hero.getY() - 15) < 275)
                hero.moveDown();

Severity: Major
Found in gui/src/main/java/com/github/kuangcp/tank/v1/MainPanelV1.java and 3 other locations - About 35 mins to fix
gui/src/main/java/com/github/kuangcp/tank/v1/MainPanelV1.java on lines 128..133
gui/src/main/java/com/github/kuangcp/tank/v1/MainPanelV1.java on lines 134..138
gui/src/main/java/com/github/kuangcp/tank/v1/MainPanelV1.java on lines 140..145

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

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

        for (y = tempY; contains(chess, x + 1, y - 1, color); y--) {
            count++;
            x++;
        }
Severity: Major
Found in gui/src/main/java/com/github/kuangcp/gomoku/CheckWin.java and 3 other locations - About 35 mins to fix
gui/src/main/java/com/github/kuangcp/gomoku/CheckWin.java on lines 41..44
gui/src/main/java/com/github/kuangcp/gomoku/CheckWin.java on lines 47..50
gui/src/main/java/com/github/kuangcp/gomoku/CheckWin.java on lines 56..59

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

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

        for (int i = 0; i < 9; i++) {
            g.fill3DRect(60, 60 + 10 * i, 20, 10, false);
        }
Severity: Minor
Found in gui/src/main/java/com/github/kuangcp/tank/v1/MainPanelV1.java and 1 other location - About 35 mins to fix
gui/src/main/java/com/github/kuangcp/tank/v2/MainPanelV2.java on lines 90..92

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

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

        for (int i = 0; i < 9; i++) {
            g.fill3DRect(60, 60 + 10 * i, 20, 10, false);
        }
Severity: Minor
Found in gui/src/main/java/com/github/kuangcp/tank/v2/MainPanelV2.java and 1 other location - About 35 mins to fix
gui/src/main/java/com/github/kuangcp/tank/v1/MainPanelV1.java on lines 116..118

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

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

        for (y = tempY; contains(chess, x - 1, y - 1, color); y--) {
            count++;
            x--;
        }
Severity: Major
Found in gui/src/main/java/com/github/kuangcp/gomoku/CheckWin.java and 3 other locations - About 35 mins to fix
gui/src/main/java/com/github/kuangcp/gomoku/CheckWin.java on lines 47..50
gui/src/main/java/com/github/kuangcp/gomoku/CheckWin.java on lines 56..59
gui/src/main/java/com/github/kuangcp/gomoku/CheckWin.java on lines 62..65

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

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

        if (e.getKeyCode() == KeyEvent.VK_W) {
            hero.setDirect(0);
            if ((hero.getY() - 13) > 0)
                hero.moveUp();

Severity: Major
Found in gui/src/main/java/com/github/kuangcp/tank/v1/MainPanelV1.java and 3 other locations - About 35 mins to fix
gui/src/main/java/com/github/kuangcp/tank/v1/MainPanelV1.java on lines 128..133
gui/src/main/java/com/github/kuangcp/tank/v1/MainPanelV1.java on lines 134..138
gui/src/main/java/com/github/kuangcp/tank/v1/MainPanelV1.java on lines 146..151

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

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

        for (y = tempY; contains(chess, x + 1, y + 1, color); y++) {
            count++;
            x++;
        }
Severity: Major
Found in gui/src/main/java/com/github/kuangcp/gomoku/CheckWin.java and 3 other locations - About 35 mins to fix
gui/src/main/java/com/github/kuangcp/gomoku/CheckWin.java on lines 41..44
gui/src/main/java/com/github/kuangcp/gomoku/CheckWin.java on lines 56..59
gui/src/main/java/com/github/kuangcp/gomoku/CheckWin.java on lines 62..65

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

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

            if (sx < 440 && sx > 380 && sy < 540 && sy > 480) {
                this.alive = false;
            }
Severity: Minor
Found in gui/src/main/java/com/github/kuangcp/tank/domain/Bullet.java and 1 other location - About 35 mins to fix
gui/src/main/java/com/github/kuangcp/tank/domain/Bullet.java on lines 100..102

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

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

            if (sx < 20 || sx > 740 || sy < 20 || sy > 540) {
                this.alive = false;
            }
Severity: Minor
Found in gui/src/main/java/com/github/kuangcp/tank/domain/Bullet.java and 1 other location - About 35 mins to fix
gui/src/main/java/com/github/kuangcp/tank/domain/Bullet.java on lines 104..106

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

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

        new Tank(110, 20, 0) {
            @Override
            public void drawSelf(Graphics g) {
                g.setColor(new Color(34, 155, 234));
                super.drawSelf(g);
Severity: Major
Found in gui/src/main/java/com/github/kuangcp/tank/v1/MainPanelV1.java and 3 other locations - About 35 mins to fix
gui/src/main/java/com/github/kuangcp/tank/v1/MainPanelV1.java on lines 55..66
gui/src/main/java/com/github/kuangcp/tank/v1/MainPanelV1.java on lines 79..90
gui/src/main/java/com/github/kuangcp/tank/v1/MainPanelV1.java on lines 91..102

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

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

        new Tank(80, 20, 0) {
            @Override
            public void drawSelf(Graphics g) {
                g.setColor(new Color(93, 217, 41));
                super.drawSelf(g);
Severity: Major
Found in gui/src/main/java/com/github/kuangcp/tank/v1/MainPanelV1.java and 3 other locations - About 35 mins to fix
gui/src/main/java/com/github/kuangcp/tank/v1/MainPanelV1.java on lines 67..78
gui/src/main/java/com/github/kuangcp/tank/v1/MainPanelV1.java on lines 79..90
gui/src/main/java/com/github/kuangcp/tank/v1/MainPanelV1.java on lines 91..102

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

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

        new Tank(140, 20, 0) {
            @Override
            public void drawSelf(Graphics g) {
                g.setColor(new Color(155, 62, 202));
                super.drawSelf(g);
Severity: Major
Found in gui/src/main/java/com/github/kuangcp/tank/v1/MainPanelV1.java and 3 other locations - About 35 mins to fix
gui/src/main/java/com/github/kuangcp/tank/v1/MainPanelV1.java on lines 55..66
gui/src/main/java/com/github/kuangcp/tank/v1/MainPanelV1.java on lines 67..78
gui/src/main/java/com/github/kuangcp/tank/v1/MainPanelV1.java on lines 91..102

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

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

        new Tank(170, 20, 0) {
            @Override
            public void drawSelf(Graphics g) {
                g.setColor(new Color(240, 57, 23));
                super.drawSelf(g);
Severity: Major
Found in gui/src/main/java/com/github/kuangcp/tank/v1/MainPanelV1.java and 3 other locations - About 35 mins to fix
gui/src/main/java/com/github/kuangcp/tank/v1/MainPanelV1.java on lines 55..66
gui/src/main/java/com/github/kuangcp/tank/v1/MainPanelV1.java on lines 67..78
gui/src/main/java/com/github/kuangcp/tank/v1/MainPanelV1.java on lines 79..90

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

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

    try (BufferedWriter bw = new BufferedWriter(new FileWriter(currentPath))) {
      bw.write(Note.textArea.getText());
    } catch (Exception e) {
      log.error(e.getMessage(), e);
    }
gui/src/main/java/com/github/kuangcp/notepad/handler/FileHandler.java on lines 117..121

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

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

            while (contains(x - 1, y - 1, color) == 1) {
                x--;
                y--;
                count++;
            }
Severity: Minor
Found in gui/src/main/java/com/github/kuangcp/gomoku/AI.java and 1 other location - About 30 mins to fix
gui/src/main/java/com/github/kuangcp/gomoku/AI.java on lines 183..187

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

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

            while (contains(x - 1, y + 1, color) == 1) {
                x--;
                y++;
                count++;
            }
Severity: Minor
Found in gui/src/main/java/com/github/kuangcp/gomoku/AI.java and 1 other location - About 30 mins to fix
gui/src/main/java/com/github/kuangcp/gomoku/AI.java on lines 161..165

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

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

    try (BufferedWriter bw = new BufferedWriter(new FileWriter(path))) {
      bw.write(Note.textArea.getText());
    } catch (Exception e) {
      log.error(e.getMessage(), e);
    }
gui/src/main/java/com/github/kuangcp/notepad/handler/FileHandler.java on lines 93..97

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

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

Severity
Category
Status
Source
Language