asteris-llc/converge

View on GitHub
parse/node_test.go

Summary

Maintainability
C
1 day
Test Coverage

Function TestNodeValidateName has 93 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func TestNodeValidateName(t *testing.T) {
    t.Parallel()
    t.Run("when valid", func(t *testing.T) {
        t.Parallel()
        t.Run("alpha", func(t *testing.T) {
Severity: Major
Found in parse/node_test.go - About 2 hrs to fix

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

            t.Run("dots", func(t *testing.T) {
                t.Parallel()
                _, err := fromString(`test "a." { value = 7 }`)
                assert.NoError(t, err)
                _, err = fromString(`test "a.a" { value = 7 }`)
    Severity: Major
    Found in parse/node_test.go and 3 other locations - About 1 hr to fix
    parse/node_test.go on lines 131..141
    parse/node_test.go on lines 153..163
    parse/node_test.go on lines 164..174

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

    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

            t.Run("heterogenous", func(t *testing.T) {
                t.Parallel()
                _, err := fromString(`test "a_" { value = 7 }`)
                assert.NoError(t, err)
                _, err = fromString(`test "a_-" { value = 7 }`)
    Severity: Major
    Found in parse/node_test.go and 3 other locations - About 1 hr to fix
    parse/node_test.go on lines 131..141
    parse/node_test.go on lines 142..152
    parse/node_test.go on lines 153..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 128.

    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

            t.Run("dashes", func(t *testing.T) {
                t.Parallel()
                _, err := fromString(`test "a-" { value = 7 }`)
                assert.NoError(t, err)
                _, err = fromString(`test "-a-" { value = 7 }`)
    Severity: Major
    Found in parse/node_test.go and 3 other locations - About 1 hr to fix
    parse/node_test.go on lines 142..152
    parse/node_test.go on lines 153..163
    parse/node_test.go on lines 164..174

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

    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

            t.Run("underscores", func(t *testing.T) {
                t.Parallel()
                _, err := fromString(`test "a_" { value = 7 }`)
                assert.NoError(t, err)
                _, err = fromString(`test "a_a" { value = 7 }`)
    Severity: Major
    Found in parse/node_test.go and 3 other locations - About 1 hr to fix
    parse/node_test.go on lines 131..141
    parse/node_test.go on lines 142..152
    parse/node_test.go on lines 164..174

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

    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

    func TestNodeGetStringSliceBad(t *testing.T) {
        t.Parallel()
    
        node, err := fromString(`module x y { a = 1 }`)
        require.NoError(t, err)
    Severity: Minor
    Found in parse/node_test.go and 2 other locations - About 35 mins to fix
    parse/node_test.go on lines 305..320
    parse/node_test.go on lines 350..365

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

    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

    func TestNodeGetStringSliceBadItem(t *testing.T) {
        t.Parallel()
    
        node, err := fromString(`module x y { a = [ 1 ] }`)
        require.NoError(t, err)
    Severity: Minor
    Found in parse/node_test.go and 2 other locations - About 35 mins to fix
    parse/node_test.go on lines 305..320
    parse/node_test.go on lines 333..348

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

    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

    func TestNodeGetStringBad(t *testing.T) {
        t.Parallel()
    
        node, err := fromString(`module x y { a = 1 }`)
        require.NoError(t, err)
    Severity: Minor
    Found in parse/node_test.go and 2 other locations - About 35 mins to fix
    parse/node_test.go on lines 333..348
    parse/node_test.go on lines 350..365

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

    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

            t.Run("alpha", func(t *testing.T) {
                t.Parallel()
                _, err := fromString(`test "abc" { value = 7 }`)
                assert.NoError(t, err)
                _, err = fromString(`test "もしもし" { }`)
    Severity: Minor
    Found in parse/node_test.go and 1 other location - About 35 mins to fix
    parse/node_test.go on lines 122..130

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

    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

            t.Run("numbers", func(t *testing.T) {
                t.Parallel()
                _, err := fromString(`test "abc123" { value = 7 }`)
                assert.NoError(t, err)
                _, err = fromString(`test "abc123xyz" { value = 7 }`)
    Severity: Minor
    Found in parse/node_test.go and 1 other location - About 35 mins to fix
    parse/node_test.go on lines 113..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 106.

    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

    There are no issues that match your filters.

    Category
    Status