asteris-llc/converge

View on GitHub

Showing 292 of 615 total issues

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

            t.Run("sha1", func(t *testing.T) {
                hashType = string(fetch.HashSHA1)
                prep.HashType = &hashType
                hash = hex.EncodeToString(sha1.New().Sum(nil))
                prep.Hash = &hash
Severity: Major
Found in resource/file/fetch/preparer_test.go and 2 other locations - About 1 hr to fix
resource/file/fetch/preparer_test.go on lines 77..85
resource/file/fetch/preparer_test.go on lines 87..95

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

            t.Run("sha256", func(t *testing.T) {
                hashType = string(fetch.HashSHA256)
                prep.HashType = &hashType
                hash = hex.EncodeToString(sha256.New().Sum(nil))
                prep.Hash = &hash
Severity: Major
Found in resource/file/fetch/preparer_test.go and 2 other locations - About 1 hr to fix
resource/file/fetch/preparer_test.go on lines 67..75
resource/file/fetch/preparer_test.go on lines 87..95

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

    t.Run("when should be removed", func(t *testing.T) {
        p := &pkg.Package{State: pkg.StateAbsent}
        p.PkgMgr = &rpm.YumManager{newRunner("", nil)}
        status, err := p.Apply(context.Background())
        require.NoError(t, err)
Severity: Minor
Found in resource/package/package_test.go and 1 other location - About 1 hr to fix
resource/package/package_test.go on lines 91..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 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 2 locations. Consider refactoring.
Open

    t.Run("when present/present", func(t *testing.T) {
        p := &pkg.Package{State: pkg.StatePresent}
        p.PkgMgr = &rpm.YumManager{newRunner("", nil)}
        status, err := p.Apply(context.Background())
        require.NoError(t, err)
Severity: Minor
Found in resource/package/package_test.go and 1 other location - About 1 hr to fix
resource/package/package_test.go on lines 105..111

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

func (_m *GrapherGraphServer) RecvMsg(m interface{}) error {
    ret := _m.Called(m)

    var r0 error
    if rf, ok := ret.Get(0).(func(interface{}) error); ok {
Severity: Minor
Found in rpc/pb/mocks/Grapher_GraphServer.go and 1 other location - About 55 mins to fix
rpc/pb/mocks/Grapher_GraphServer.go on lines 74..85

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

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 (_m *GrapherGraphServer) SendMsg(m interface{}) error {
    ret := _m.Called(m)

    var r0 error
    if rf, ok := ret.Get(0).(func(interface{}) error); ok {
Severity: Minor
Found in rpc/pb/mocks/Grapher_GraphServer.go and 1 other location - About 55 mins to fix
rpc/pb/mocks/Grapher_GraphServer.go on lines 32..43

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

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

    case u.GroupName != "":
        grp, err := user.LookupGroup(u.GroupName)
        if err != nil {
            status.RaiseLevel(resource.StatusCantChange)
            return nil, fmt.Errorf("group %s does not exist", u.GroupName)
Severity: Minor
Found in resource/user/user.go and 1 other location - About 55 mins to fix
resource/user/user.go on lines 296..304

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

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

    case u.GID != "":
        grp, err := user.LookupGroupId(u.GID)
        if err != nil {
            status.RaiseLevel(resource.StatusCantChange)
            return nil, fmt.Errorf("group gid %s does not exist", u.GID)
Severity: Minor
Found in resource/user/user.go and 1 other location - About 55 mins to fix
resource/user/user.go on lines 287..295

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

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("when removed", func(t *testing.T) {
        expected := ""
        out := fmt.Sprintf("foo,%s,0.1.2.3", apt.PkgRemoved)
        runner := newRunner(out, nil)
        a := &apt.Manager{Sys: runner}
Severity: Major
Found in resource/package/apt/package_manager_test.go and 3 other locations - About 55 mins to fix
resource/package/apt/package_manager_test.go on lines 32..40
resource/package/apt/package_manager_test.go on lines 50..58
resource/package/apt/package_manager_test.go on lines 70..78

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

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("when held", func(t *testing.T) {
        expected := "foo-0.1.2.3"
        out := fmt.Sprintf("foo,%s,0.1.2.3", apt.PkgHold)
        runner := newRunner(out, nil)
        a := &apt.Manager{Sys: runner}
Severity: Major
Found in resource/package/apt/package_manager_test.go and 3 other locations - About 55 mins to fix
resource/package/apt/package_manager_test.go on lines 32..40
resource/package/apt/package_manager_test.go on lines 60..68
resource/package/apt/package_manager_test.go on lines 70..78

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

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("when installed", func(t *testing.T) {
        expected := "foo-0.1.2.3"
        out := fmt.Sprintf("foo,%s,0.1.2.3", apt.PkgInstalled)
        runner := newRunner(out, nil)
        a := &apt.Manager{Sys: runner}
Severity: Major
Found in resource/package/apt/package_manager_test.go and 3 other locations - About 55 mins to fix
resource/package/apt/package_manager_test.go on lines 50..58
resource/package/apt/package_manager_test.go on lines 60..68
resource/package/apt/package_manager_test.go on lines 70..78

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

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("when uninstalled", func(t *testing.T) {
        expected := ""
        out := fmt.Sprintf("foo,%s,0.1.2.3", apt.PkgUninstalled)
        runner := newRunner(out, nil)
        a := &apt.Manager{Sys: runner}
Severity: Major
Found in resource/package/apt/package_manager_test.go and 3 other locations - About 55 mins to fix
resource/package/apt/package_manager_test.go on lines 32..40
resource/package/apt/package_manager_test.go on lines 50..58
resource/package/apt/package_manager_test.go on lines 60..68

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

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 runtime.GOOS == "linux" {
                        assert.EqualError(t, err, "cannot add or modify group")
                        assert.Equal(t, resource.StatusCantChange, status.StatusCode())
                        assert.Equal(t, fmt.Sprintf("group add/modify: group %s and gid %s belong to different groups", g.Name, g.GID), status.Messages()[0])
                        assert.True(t, status.HasChanges())
Severity: Major
Found in resource/group/group_test.go and 2 other locations - About 55 mins to fix
resource/group/group_test.go on lines 257..264
resource/group/group_test.go on lines 412..419

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

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 runtime.GOOS == "linux" {
                        assert.EqualError(t, err, "cannot add or modify group")
                        assert.Equal(t, resource.StatusCantChange, status.StatusCode())
                        assert.Equal(t, fmt.Sprintf("group add/modify: group %s with gid %s already exists", g.Name, g.GID), status.Messages()[0])
                        assert.True(t, status.HasChanges())
Severity: Major
Found in resource/group/group_test.go and 2 other locations - About 55 mins to fix
resource/group/group_test.go on lines 241..248
resource/group/group_test.go on lines 412..419

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

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

func (m *DbusMock) StartUnit(name string, mode string, ch chan<- string) (int, error) {
    args := m.Called(name, mode, ch)
    if m.startResp != "" && ch != nil {
        go func() {
            ch <- m.startResp
Severity: Major
Found in resource/systemd/unit/linux_mocks_test.go and 3 other locations - About 55 mins to fix
resource/systemd/unit/linux_mocks_test.go on lines 76..84
resource/systemd/unit/linux_mocks_test.go on lines 86..94
resource/systemd/unit/linux_mocks_test.go on lines 96..104

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

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

func (m *DbusMock) StopUnit(name string, mode string, ch chan<- string) (int, error) {
    args := m.Called(name, mode, ch)
    if m.stopResp != "" && ch != nil {
        go func() {
            ch <- m.stopResp
Severity: Major
Found in resource/systemd/unit/linux_mocks_test.go and 3 other locations - About 55 mins to fix
resource/systemd/unit/linux_mocks_test.go on lines 66..74
resource/systemd/unit/linux_mocks_test.go on lines 86..94
resource/systemd/unit/linux_mocks_test.go on lines 96..104

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

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

func (m *DbusMock) ReloadUnit(name string, mode string, ch chan<- string) (int, error) {
    args := m.Called(name, mode, ch)
    if m.reloadResp != "" && ch != nil {
        go func() {
            ch <- m.reloadResp
Severity: Major
Found in resource/systemd/unit/linux_mocks_test.go and 3 other locations - About 55 mins to fix
resource/systemd/unit/linux_mocks_test.go on lines 66..74
resource/systemd/unit/linux_mocks_test.go on lines 76..84
resource/systemd/unit/linux_mocks_test.go on lines 86..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 125.

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 runtime.GOOS == "linux" {
                    assert.EqualError(t, err, "cannot delete group")
                    assert.Equal(t, resource.StatusCantChange, status.StatusCode())
                    assert.Equal(t, fmt.Sprintf("group delete: group %s and gid %s belong to different groups", g.Name, g.GID), status.Messages()[0])
                    assert.True(t, status.HasChanges())
Severity: Major
Found in resource/group/group_test.go and 2 other locations - About 55 mins to fix
resource/group/group_test.go on lines 241..248
resource/group/group_test.go on lines 257..264

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

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

func (m *DbusMock) RestartUnit(name string, mode string, ch chan<- string) (int, error) {
    args := m.Called(name, mode, ch)
    if m.restartResp != "" && ch != nil {
        go func() {
            ch <- m.restartResp
Severity: Major
Found in resource/systemd/unit/linux_mocks_test.go and 3 other locations - About 55 mins to fix
resource/systemd/unit/linux_mocks_test.go on lines 66..74
resource/systemd/unit/linux_mocks_test.go on lines 76..84
resource/systemd/unit/linux_mocks_test.go on lines 96..104

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

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