opencontrol/compliance-masonry

View on GitHub

Showing 33 of 33 total issues

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

func TestComponentSetters(t *testing.T) {
    component := Component{}
    // Test the setters.
    // Change the version.
    component.SetVersion(semver.MustParse("3.1.0"))
Severity: Minor
Found in pkg/lib/components/versions/3_1_0/component_test.go and 2 other locations - About 35 mins to fix
pkg/lib/components/versions/2_0_0/component_test.go on lines 50..59
pkg/lib/components/versions/3_0_0/component_test.go on lines 55..64

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

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

Function exportJSON has 5 return statements (exceeds 4 allowed).
Open

func exportJSON(config *Config, workspace common.Workspace, output *exportOutput, writer io.Writer) []error {
    // result
    var errors []error

    // work vars
Severity: Major
Found in pkg/cli/export/exportFormat.go - About 35 mins to fix

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

    func TestLoadComponentErrors(t *testing.T) {
        for _, example := range loadComponentsTestErrors {
            ws := NewWorkspace()
            actualErrors := ws.LoadComponents(example.dir)
            // Check that the actual error is the expected error
    Severity: Minor
    Found in pkg/lib/workspace_test.go and 1 other location - About 35 mins to fix
    pkg/lib/workspace_test.go on lines 158..167

    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 TestLoadStandardErrors(t *testing.T) {
        for _, example := range loadStandardsTestErrors {
            ws := NewWorkspace()
            actualErrors := ws.LoadStandards(example.dir)
            // Check that the actual error is the expected error
    Severity: Minor
    Found in pkg/lib/workspace_test.go and 1 other location - About 35 mins to fix
    pkg/lib/workspace_test.go on lines 120..129

    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

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

    /*
    Severity: Minor
    Found in pkg/lib/common/component.go by gofmt

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

    /*
    Severity: Minor
    Found in pkg/lib/common/references.go by gofmt

    2: cannot find package "github.com/opencontrol/compliance-masonry/pkg/cmd/masonry" in any of:
    Open

        "github.com/opencontrol/compliance-masonry/pkg/cmd/masonry"
    Severity: Minor
    Found in cmd/masonry/masonry.go by govet

    should not use dot imports
    Open

        . "github.com/onsi/ginkgo"
    Severity: Minor
    Found in pkg/tests/test_masonry.go by golint

    Your code does not pass gofmt in 1 place. Go fmt your code!
    Open

    /*
    Severity: Minor
    Found in pkg/lib/common/opencontrol.go by gofmt

    should not use dot imports
    Open

        . "github.com/onsi/gomega"
    Severity: Minor
    Found in pkg/tests/test_masonry.go by golint

    Your code does not pass gofmt in 1 place. Go fmt your code!
    Open

    /*
    Severity: Minor
    Found in pkg/lib/common/standard.go by gofmt

    TODO found
    Open

    // TODO: fix the error return to return of type error. This was used because existing code returned that type
    Severity: Minor
    Found in pkg/cli/diff/inventory.go by fixme

    TODO found
    Open

    // TODO: e.g. GetCertification
    Severity: Minor
    Found in pkg/cli/diff/inventory.go by fixme
    Severity
    Category
    Status
    Source
    Language