wisedog/ladybug

View on GitHub

Showing 112 of 112 total issues

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

    if err := c.Db.Where("id = ?", sectionID).Delete(models.Section{}); err.Error != nil {
        log.Error("Section", "type", "database", "msg ", err.Error.Error())
        return RenderJSONWithStatus(w, Resp{Msg: err.Error.Error()}, http.StatusInternalServerError)
    }
Severity: Minor
Found in controllers/sections.go and 1 other location - About 35 mins to fix
controllers/sections.go on lines 211..214

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

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

func TestSectionNormal(t *testing.T) {

    section := Section{Title: "Functional Requirements", ProjectID: 1}
    errorMap, err := section.Validate()

Severity: Minor
Found in models/section_test.go and 1 other location - About 35 mins to fix
models/section_test.go on lines 26..39

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

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 err := c.Db.Where("parents_id in (?)", targetIDs).Delete(models.Section{}); err.Error != nil {
        log.Error("Section", "type", "database", "msg ", err.Error.Error())
        return RenderJSONWithStatus(w, Resp{Msg: err.Error.Error()}, http.StatusInternalServerError)
    }
Severity: Minor
Found in controllers/sections.go and 1 other location - About 35 mins to fix
controllers/sections.go on lines 216..219

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

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    if err := c.Db.Preload("Creator").Preload("Executor").Where("id= ?", id).Find(&testplan); err.Error != nil {
        log.Error("TestPlan", "type", "database", "msg", err.Error)
        return errors.HttpError{Status: http.StatusInternalServerError, Desc: "An error while select operation in TestPlans.PlanView"}
    }
Severity: Minor
Found in controllers/milestones.go and 1 other location - About 30 mins to fix
controllers/testplans.go on lines 153..156

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 102.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    if err := c.Db.Preload("Creator").Preload("Executor").Where("id= ?", id).Find(&testplan); err.Error != nil {
        log.Error("TestPlan", "type", "database", "msg", err.Error)
        return errors.HttpError{Status: http.StatusInternalServerError, Desc: "An error while select operation in TestPlans.PlanView"}
    }
Severity: Minor
Found in controllers/testplans.go and 1 other location - About 30 mins to fix
controllers/milestones.go on lines 130..133

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 102.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Your code does not pass gofmt in 6 places. Go fmt your code!
Open

package controllers
Severity: Minor
Found in controllers/testplans.go by gofmt

Your code does not pass gofmt in 3 places. Go fmt your code!
Open

package controllers
Severity: Minor
Found in controllers/milestones.go by gofmt

Your code does not pass gofmt in 3 places. Go fmt your code!
Open

package controllers
Severity: Minor
Found in controllers/builds.go by gofmt

Your code does not pass gofmt in 2 places. Go fmt your code!
Open

package controllers
Severity: Minor
Found in controllers/testexecs.go by gofmt

don't use underscores in Go names; type user_project should be userProject
Open

    type user_project struct {
Severity: Minor
Found in controllers/hello.go by golint

if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)
Open

    } else {
Severity: Minor
Found in controllers/sections.go by golint

if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)
Open

        } else {
Severity: Minor
Found in controllers/requirements.go by golint

struct field IdByTool should be IDByTool
Open

    IdByTool       string // for example, jenkins builds id is string
Severity: Minor
Found in models/build.go by golint

struct field ItemUrl should be ItemURL
Open

    ItemUrl         string
Severity: Minor
Found in models/build.go by golint

struct field ReporterId should be ReporterID
Open

    ReporterId  int // TODO add foreign key
Severity: Minor
Found in models/issue.go by golint

exported type Review should have comment or be unexported
Open

type Review struct {
Severity: Minor
Found in models/review.go by golint

exported type JSTreeTestSuiteWrapperWithChildren should have comment or be unexported
Open

type JSTreeTestSuiteWrapperWithChildren struct {
Severity: Minor
Found in models/wrapper.go by golint

comment on exported type JSTreeTestCaseWrapper should be of the form "JSTreeTestCaseWrapper ..." (with optional leading article)
Open

// Wrapper type for print out JSON format used in JSTree
Severity: Minor
Found in models/wrapper.go by golint

if block ends with a return statement, so drop this else and outdent its block
Open

        } else {
Severity: Minor
Found in controllers/util.go by golint

exported const CookieKey should have comment (or a comment on this block) or be unexported
Open

    CookieKey = "ladybug"
Severity: Minor
Found in main.go by golint
Severity
Category
Status
Source
Language