konikvranik/jtoggl

View on GitHub

Showing 50 of 50 total issues

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

    @Override
    public ProjectUser clone() {
        ProjectUser pu = new ProjectUser();
        pu.id = id;
        pu.hourlyRate = hourlyRate;
Severity: Major
Found in src/main/java/ch/simas/jtoggl/domain/ProjectUser.java and 2 other locations - About 1 hr to fix
src/main/java/ch/simas/jtoggl/domain/ProjectClient.java on lines 138..149
src/main/java/ch/simas/jtoggl/domain/Task.java on lines 152..163

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

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

    @Override
    public Task clone() {
        Task tk = new Task();
        tk.id = id;
        tk.name = name;
Severity: Major
Found in src/main/java/ch/simas/jtoggl/domain/Task.java and 2 other locations - About 1 hr to fix
src/main/java/ch/simas/jtoggl/domain/ProjectClient.java on lines 138..149
src/main/java/ch/simas/jtoggl/domain/ProjectUser.java on lines 142..154

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

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

    @BeforeClass
    public static void beforeClass() throws Exception {

        String togglUsername = System.getenv("TOGGL_USERNAME");
        if (togglUsername == null) {
Severity: Minor
Found in src/test/java/ch/simas/jtoggl/JTogglTest.java - About 1 hr 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 3 locations. Consider refactoring.
Open

    @Override
    public ProjectClient clone() {
        ProjectClient cl = new ProjectClient();
        cl.id = id;
        cl.name = name;
Severity: Major
Found in src/main/java/ch/simas/jtoggl/domain/ProjectClient.java and 2 other locations - About 1 hr to fix
src/main/java/ch/simas/jtoggl/domain/ProjectUser.java on lines 142..154
src/main/java/ch/simas/jtoggl/domain/Task.java on lines 152..163

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

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 startStopTimeEntry has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @Test(dependsOnMethods = "createProject")
    public void startStopTimeEntry() throws Exception {
        TimeEntry current = jToggl.getCurrentTimeEntry();
        Assert.assertNull(current);

Severity: Minor
Found in src/test/java/ch/simas/jtoggl/JTogglTest.java - About 1 hr to fix

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

        if (clientObject instanceof WithProject) {
            WithProject wp = (WithProject) clientObject;
            if (((WithProject) clientObject).getProjectId() == null && ((WithProject) clientObject).getProject() != null) {
                wp.setProjectId(wp.getProject().getId());
            }
Severity: Major
Found in src/main/java/ch/simas/jtoggl/JToggl.java and 2 other locations - About 1 hr to fix
src/main/java/ch/simas/jtoggl/JToggl.java on lines 305..313
src/main/java/ch/simas/jtoggl/JToggl.java on lines 321..327

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

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 (clientObject instanceof WithWorkspace) {
            WithWorkspace ww = (WithWorkspace) clientObject;
            if (((WithWorkspace) clientObject).getWorkspaceId() == null && ((WithWorkspace) clientObject).getWorkspace() != null) {
                ww.setWorkspaceId(ww.getWorkspace().getId());
            }
Severity: Major
Found in src/main/java/ch/simas/jtoggl/JToggl.java and 2 other locations - About 1 hr to fix
src/main/java/ch/simas/jtoggl/JToggl.java on lines 314..320
src/main/java/ch/simas/jtoggl/JToggl.java on lines 321..327

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

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 (clientObject instanceof WithUser) {
            WithUser wu = (WithUser) clientObject;
            if (((WithUser) clientObject).getUserId() == null && ((WithUser) clientObject).getUser() != null) {
                wu.setUserId(wu.getUser().getId());
            }
Severity: Major
Found in src/main/java/ch/simas/jtoggl/JToggl.java and 2 other locations - About 1 hr to fix
src/main/java/ch/simas/jtoggl/JToggl.java on lines 305..313
src/main/java/ch/simas/jtoggl/JToggl.java on lines 314..320

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

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

        return "Task{" + "id=" + id + ", name=" + name + ", estimatedSeconds=" + estimatedSeconds + ", active="
                + active + ", workspace=" + workspace + ", project=" + project + ", user=" + user + '}';
Severity: Minor
Found in src/main/java/ch/simas/jtoggl/domain/Task.java and 1 other location - About 50 mins to fix
src/main/java/ch/simas/jtoggl/domain/User.java on lines 178..181

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

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

        return "User{" + "id=" + id + ", jqueryTimeOfDayFormat=" + jqueryTimeOfDayFormat + ", apiToken=" +
                apiToken + ", timeEntryRetentionDays=" + timeEntryRetentionDays + ", jqueryDateFormat=" +
                jqueryDateFormat + ", dateFormat=" + dateFormat + ", defaultWorkspaceId=" +
                defaultWorkspaceId + ", fullname=" + fullname + ", language=" + language + ", beginningOfWeek=" +
Severity: Minor
Found in src/main/java/ch/simas/jtoggl/domain/User.java and 1 other location - About 50 mins to fix
src/main/java/ch/simas/jtoggl/domain/Task.java on lines 126..127

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

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

    @Override
    public int hashCode() {
        int hash = 3;
        hash = 97 * hash + (this.id != null ? this.id.hashCode() : 0);
        return hash;
Severity: Major
Found in src/main/java/ch/simas/jtoggl/domain/Tag.java and 7 other locations - About 40 mins to fix
src/main/java/ch/simas/jtoggl/domain/Project.java on lines 122..127
src/main/java/ch/simas/jtoggl/domain/ProjectClient.java on lines 123..128
src/main/java/ch/simas/jtoggl/domain/ProjectUser.java on lines 117..122
src/main/java/ch/simas/jtoggl/domain/Task.java on lines 145..150
src/main/java/ch/simas/jtoggl/domain/TimeEntry.java on lines 217..222
src/main/java/ch/simas/jtoggl/domain/User.java on lines 200..205
src/main/java/ch/simas/jtoggl/domain/Workspace.java on lines 89..94

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

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

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 41 * hash + (this.id != null ? this.id.hashCode() : 0);
        return hash;
Severity: Major
Found in src/main/java/ch/simas/jtoggl/domain/ProjectUser.java and 7 other locations - About 40 mins to fix
src/main/java/ch/simas/jtoggl/domain/Project.java on lines 122..127
src/main/java/ch/simas/jtoggl/domain/ProjectClient.java on lines 123..128
src/main/java/ch/simas/jtoggl/domain/Tag.java on lines 103..108
src/main/java/ch/simas/jtoggl/domain/Task.java on lines 145..150
src/main/java/ch/simas/jtoggl/domain/TimeEntry.java on lines 217..222
src/main/java/ch/simas/jtoggl/domain/User.java on lines 200..205
src/main/java/ch/simas/jtoggl/domain/Workspace.java on lines 89..94

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

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

    @Override
    public int hashCode() {
        int hash = 3;
        hash = 83 * hash + (this.id != null ? this.id.hashCode() : 0);
        return hash;
Severity: Major
Found in src/main/java/ch/simas/jtoggl/domain/Workspace.java and 7 other locations - About 40 mins to fix
src/main/java/ch/simas/jtoggl/domain/Project.java on lines 122..127
src/main/java/ch/simas/jtoggl/domain/ProjectClient.java on lines 123..128
src/main/java/ch/simas/jtoggl/domain/ProjectUser.java on lines 117..122
src/main/java/ch/simas/jtoggl/domain/Tag.java on lines 103..108
src/main/java/ch/simas/jtoggl/domain/Task.java on lines 145..150
src/main/java/ch/simas/jtoggl/domain/TimeEntry.java on lines 217..222
src/main/java/ch/simas/jtoggl/domain/User.java on lines 200..205

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

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

    @Override
    public int hashCode() {
        int hash = 3;
        hash = 79 * hash + (this.id != null ? this.id.hashCode() : 0);
        return hash;
Severity: Major
Found in src/main/java/ch/simas/jtoggl/domain/TimeEntry.java and 7 other locations - About 40 mins to fix
src/main/java/ch/simas/jtoggl/domain/Project.java on lines 122..127
src/main/java/ch/simas/jtoggl/domain/ProjectClient.java on lines 123..128
src/main/java/ch/simas/jtoggl/domain/ProjectUser.java on lines 117..122
src/main/java/ch/simas/jtoggl/domain/Tag.java on lines 103..108
src/main/java/ch/simas/jtoggl/domain/Task.java on lines 145..150
src/main/java/ch/simas/jtoggl/domain/User.java on lines 200..205
src/main/java/ch/simas/jtoggl/domain/Workspace.java on lines 89..94

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

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

    @Override
    public int hashCode() {
        int hash = 5;
        hash = 97 * hash + (this.id != null ? this.id.hashCode() : 0);
        return hash;
Severity: Major
Found in src/main/java/ch/simas/jtoggl/domain/User.java and 7 other locations - About 40 mins to fix
src/main/java/ch/simas/jtoggl/domain/Project.java on lines 122..127
src/main/java/ch/simas/jtoggl/domain/ProjectClient.java on lines 123..128
src/main/java/ch/simas/jtoggl/domain/ProjectUser.java on lines 117..122
src/main/java/ch/simas/jtoggl/domain/Tag.java on lines 103..108
src/main/java/ch/simas/jtoggl/domain/Task.java on lines 145..150
src/main/java/ch/simas/jtoggl/domain/TimeEntry.java on lines 217..222
src/main/java/ch/simas/jtoggl/domain/Workspace.java on lines 89..94

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

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

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 71 * hash + (this.id != null ? this.id.hashCode() : 0);
        return hash;
Severity: Major
Found in src/main/java/ch/simas/jtoggl/domain/ProjectClient.java and 7 other locations - About 40 mins to fix
src/main/java/ch/simas/jtoggl/domain/Project.java on lines 122..127
src/main/java/ch/simas/jtoggl/domain/ProjectUser.java on lines 117..122
src/main/java/ch/simas/jtoggl/domain/Tag.java on lines 103..108
src/main/java/ch/simas/jtoggl/domain/Task.java on lines 145..150
src/main/java/ch/simas/jtoggl/domain/TimeEntry.java on lines 217..222
src/main/java/ch/simas/jtoggl/domain/User.java on lines 200..205
src/main/java/ch/simas/jtoggl/domain/Workspace.java on lines 89..94

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

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

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 31 * hash + (this.id != null ? this.id.hashCode() : 0);
        return hash;
Severity: Major
Found in src/main/java/ch/simas/jtoggl/domain/Task.java and 7 other locations - About 40 mins to fix
src/main/java/ch/simas/jtoggl/domain/Project.java on lines 122..127
src/main/java/ch/simas/jtoggl/domain/ProjectClient.java on lines 123..128
src/main/java/ch/simas/jtoggl/domain/ProjectUser.java on lines 117..122
src/main/java/ch/simas/jtoggl/domain/Tag.java on lines 103..108
src/main/java/ch/simas/jtoggl/domain/TimeEntry.java on lines 217..222
src/main/java/ch/simas/jtoggl/domain/User.java on lines 200..205
src/main/java/ch/simas/jtoggl/domain/Workspace.java on lines 89..94

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

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

    @Override
    public int hashCode() {
        int hash = 3;
        hash = 71 * hash + (this.id != null ? this.id.hashCode() : 0);
        return hash;
Severity: Major
Found in src/main/java/ch/simas/jtoggl/domain/Project.java and 7 other locations - About 40 mins to fix
src/main/java/ch/simas/jtoggl/domain/ProjectClient.java on lines 123..128
src/main/java/ch/simas/jtoggl/domain/ProjectUser.java on lines 117..122
src/main/java/ch/simas/jtoggl/domain/Tag.java on lines 103..108
src/main/java/ch/simas/jtoggl/domain/Task.java on lines 145..150
src/main/java/ch/simas/jtoggl/domain/TimeEntry.java on lines 217..222
src/main/java/ch/simas/jtoggl/domain/User.java on lines 200..205
src/main/java/ch/simas/jtoggl/domain/Workspace.java on lines 89..94

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

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

    @Test(dependsOnMethods = {"createClient"})
    public void createProject() {
        List<Project> projects = jToggl.getProjects();
        if (projects != null) {
            for (Project project : projects) {
Severity: Minor
Found in src/test/java/ch/simas/jtoggl/JTogglTest.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 createClient has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    @Test(dependsOnMethods = {"getWorkspaces"})
    public void createClient() {
        ProjectClient cl = new ProjectClient();
        cl.setName("JUnit Client");
        cl.setWorkspace(workspace);
Severity: Minor
Found in src/test/java/ch/simas/jtoggl/JTogglTest.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

Severity
Category
Status
Source
Language