asteris-llc/converge

View on GitHub

Showing 292 of 572 total issues

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

    t.Run("when-want-stopped", func(t *testing.T) {
        t.Parallel()
        t.Run("stop-returns-error", func(t *testing.T) {
            r := &Resource{State: "stopped"}
            u := &Unit{ActiveState: "active"}
Severity: Major
Found in resource/systemd/unit/resource_test.go and 1 other location - About 2 days to fix
resource/systemd/unit/resource_test.go on lines 400..493

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

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-want-running", func(t *testing.T) {
        t.Parallel()
        t.Run("start-returns-error", func(t *testing.T) {
            r := &Resource{State: "running"}
            u := &Unit{ActiveState: "inactive"}
Severity: Major
Found in resource/systemd/unit/resource_test.go and 1 other location - About 2 days to fix
resource/systemd/unit/resource_test.go on lines 495..588

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

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 TestStopUnit(t *testing.T) {
    t.Parallel()
    t.Run("call-stop-unit", func(t *testing.T) {
        t.Parallel()
        u := randomUnit(UnitTypeService)
Severity: Major
Found in resource/systemd/unit/systemd_linux_test.go and 3 other locations - About 2 days to fix
resource/systemd/unit/systemd_linux_test.go on lines 500..588
resource/systemd/unit/systemd_linux_test.go on lines 682..770
resource/systemd/unit/systemd_linux_test.go on lines 773..861

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

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 TestRestartUnit(t *testing.T) {
    t.Parallel()
    t.Run("call-restart-unit", func(t *testing.T) {
        t.Parallel()
        u := randomUnit(UnitTypeService)
Severity: Major
Found in resource/systemd/unit/systemd_linux_test.go and 3 other locations - About 2 days to fix
resource/systemd/unit/systemd_linux_test.go on lines 500..588
resource/systemd/unit/systemd_linux_test.go on lines 591..679
resource/systemd/unit/systemd_linux_test.go on lines 773..861

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

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 TestReloadUnit(t *testing.T) {
    t.Parallel()
    t.Run("call-reload-unit", func(t *testing.T) {
        t.Parallel()
        u := randomUnit(UnitTypeService)
Severity: Major
Found in resource/systemd/unit/systemd_linux_test.go and 3 other locations - About 2 days to fix
resource/systemd/unit/systemd_linux_test.go on lines 500..588
resource/systemd/unit/systemd_linux_test.go on lines 591..679
resource/systemd/unit/systemd_linux_test.go on lines 682..770

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

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 TestStartUnit(t *testing.T) {
    t.Parallel()
    t.Run("call-start-unit", func(t *testing.T) {
        t.Parallel()
        u := randomUnit(UnitTypeService)
Severity: Major
Found in resource/systemd/unit/systemd_linux_test.go and 3 other locations - About 2 days to fix
resource/systemd/unit/systemd_linux_test.go on lines 591..679
resource/systemd/unit/systemd_linux_test.go on lines 682..770
resource/systemd/unit/systemd_linux_test.go on lines 773..861

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

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

// Copyright © 2016 Asteris, LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Severity: Major
Found in cmd/plan.go and 1 other location - About 2 days to fix
cmd/apply.go on lines 1..177

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

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

// Copyright © 2016 Asteris, LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Severity: Major
Found in cmd/apply.go and 1 other location - About 2 days to fix
cmd/plan.go on lines 1..177

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

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("Current", func(t *testing.T) {
        t.Run("uid", func(t *testing.T) {
            o := (&owner.OwnershipDiff{UIDs: &[2]int{1, 2}}).SetProxy(m)
            assert.Equal(t, "user: user-2 (2)", o.Current())
        })
Severity: Major
Found in resource/file/owner/ownership_test.go and 1 other location - About 1 day to fix
resource/file/owner/ownership_test.go on lines 40..63

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

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("Original", func(t *testing.T) {
        t.Run("uid", func(t *testing.T) {
            o := (&owner.OwnershipDiff{UIDs: &[2]int{1, 2}}).SetProxy(m)
            assert.Equal(t, "user: user-1 (1)", o.Original())
        })
Severity: Major
Found in resource/file/owner/ownership_test.go and 1 other location - About 1 day to fix
resource/file/owner/ownership_test.go on lines 64..87

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

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("when-false-true-true", func(t *testing.T) {
            t.Run("first-branch", func(t *testing.T) {
                branch := "root/switch2/case1"
                for _, res := range resources {
                    id := graph.ID(branch, res)
Severity: Major
Found in graph/node/conditional/conditional_test.go and 2 other locations - About 5 hrs to fix
graph/node/conditional/conditional_test.go on lines 227..261
graph/node/conditional/conditional_test.go on lines 297..331

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

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("when-false-false-true", func(t *testing.T) {
            t.Run("first-branch", func(t *testing.T) {
                branch := "root/switch3/case1"
                for _, res := range resources {
                    id := graph.ID(branch, res)
Severity: Major
Found in graph/node/conditional/conditional_test.go and 2 other locations - About 5 hrs to fix
graph/node/conditional/conditional_test.go on lines 227..261
graph/node/conditional/conditional_test.go on lines 262..296

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

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("when-true-true-true", func(t *testing.T) {
            t.Run("first-branch", func(t *testing.T) {
                branch := "root/switch1/case1"
                for _, res := range resources {
                    id := graph.ID(branch, res)
Severity: Major
Found in graph/node/conditional/conditional_test.go and 2 other locations - About 5 hrs to fix
graph/node/conditional/conditional_test.go on lines 262..296
graph/node/conditional/conditional_test.go on lines 297..331

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

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

        t.Run("device", func(t *testing.T) {
            typeName := "device"
            typeProps := map[string]interface{}{}
            m := &DbusMock{}
            m.On("ListUnits").Return([]dbus.UnitStatus{dbus.UnitStatus{Name: ("name." + typeName)}}, nil)
Severity: Major
Found in resource/systemd/unit/systemd_linux_test.go and 10 other locations - About 5 hrs to fix
resource/systemd/unit/systemd_linux_test.go on lines 177..199
resource/systemd/unit/systemd_linux_test.go on lines 223..245
resource/systemd/unit/systemd_linux_test.go on lines 246..268
resource/systemd/unit/systemd_linux_test.go on lines 269..291
resource/systemd/unit/systemd_linux_test.go on lines 292..314
resource/systemd/unit/systemd_linux_test.go on lines 315..337
resource/systemd/unit/systemd_linux_test.go on lines 338..360
resource/systemd/unit/systemd_linux_test.go on lines 361..383
resource/systemd/unit/systemd_linux_test.go on lines 384..406
resource/systemd/unit/systemd_linux_test.go on lines 407..429

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

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

        t.Run("path", func(t *testing.T) {
            typeName := "path"
            typeProps := map[string]interface{}{}
            m := &DbusMock{}
            m.On("ListUnits").Return([]dbus.UnitStatus{dbus.UnitStatus{Name: ("name." + typeName)}}, nil)
Severity: Major
Found in resource/systemd/unit/systemd_linux_test.go and 10 other locations - About 5 hrs to fix
resource/systemd/unit/systemd_linux_test.go on lines 177..199
resource/systemd/unit/systemd_linux_test.go on lines 200..222
resource/systemd/unit/systemd_linux_test.go on lines 223..245
resource/systemd/unit/systemd_linux_test.go on lines 246..268
resource/systemd/unit/systemd_linux_test.go on lines 269..291
resource/systemd/unit/systemd_linux_test.go on lines 292..314
resource/systemd/unit/systemd_linux_test.go on lines 338..360
resource/systemd/unit/systemd_linux_test.go on lines 361..383
resource/systemd/unit/systemd_linux_test.go on lines 384..406
resource/systemd/unit/systemd_linux_test.go on lines 407..429

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

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

        t.Run("timer", func(t *testing.T) {
            typeName := "timer"
            typeProps := map[string]interface{}{}
            m := &DbusMock{}
            m.On("ListUnits").Return([]dbus.UnitStatus{dbus.UnitStatus{Name: ("name." + typeName)}}, nil)
Severity: Major
Found in resource/systemd/unit/systemd_linux_test.go and 10 other locations - About 5 hrs to fix
resource/systemd/unit/systemd_linux_test.go on lines 177..199
resource/systemd/unit/systemd_linux_test.go on lines 200..222
resource/systemd/unit/systemd_linux_test.go on lines 223..245
resource/systemd/unit/systemd_linux_test.go on lines 246..268
resource/systemd/unit/systemd_linux_test.go on lines 269..291
resource/systemd/unit/systemd_linux_test.go on lines 292..314
resource/systemd/unit/systemd_linux_test.go on lines 315..337
resource/systemd/unit/systemd_linux_test.go on lines 361..383
resource/systemd/unit/systemd_linux_test.go on lines 384..406
resource/systemd/unit/systemd_linux_test.go on lines 407..429

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

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

        t.Run("swap", func(t *testing.T) {
            typeName := "swap"
            typeProps := map[string]interface{}{}
            m := &DbusMock{}
            m.On("ListUnits").Return([]dbus.UnitStatus{dbus.UnitStatus{Name: ("name." + typeName)}}, nil)
Severity: Major
Found in resource/systemd/unit/systemd_linux_test.go and 10 other locations - About 5 hrs to fix
resource/systemd/unit/systemd_linux_test.go on lines 177..199
resource/systemd/unit/systemd_linux_test.go on lines 200..222
resource/systemd/unit/systemd_linux_test.go on lines 223..245
resource/systemd/unit/systemd_linux_test.go on lines 246..268
resource/systemd/unit/systemd_linux_test.go on lines 292..314
resource/systemd/unit/systemd_linux_test.go on lines 315..337
resource/systemd/unit/systemd_linux_test.go on lines 338..360
resource/systemd/unit/systemd_linux_test.go on lines 361..383
resource/systemd/unit/systemd_linux_test.go on lines 384..406
resource/systemd/unit/systemd_linux_test.go on lines 407..429

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

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

        t.Run("automount", func(t *testing.T) {
            typeName := "automount"
            typeProps := map[string]interface{}{}
            m := &DbusMock{}
            m.On("ListUnits").Return([]dbus.UnitStatus{dbus.UnitStatus{Name: ("name." + typeName)}}, nil)
Severity: Major
Found in resource/systemd/unit/systemd_linux_test.go and 10 other locations - About 5 hrs to fix
resource/systemd/unit/systemd_linux_test.go on lines 177..199
resource/systemd/unit/systemd_linux_test.go on lines 200..222
resource/systemd/unit/systemd_linux_test.go on lines 223..245
resource/systemd/unit/systemd_linux_test.go on lines 269..291
resource/systemd/unit/systemd_linux_test.go on lines 292..314
resource/systemd/unit/systemd_linux_test.go on lines 315..337
resource/systemd/unit/systemd_linux_test.go on lines 338..360
resource/systemd/unit/systemd_linux_test.go on lines 361..383
resource/systemd/unit/systemd_linux_test.go on lines 384..406
resource/systemd/unit/systemd_linux_test.go on lines 407..429

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

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

        t.Run("socket", func(t *testing.T) {
            typeName := "socket"
            typeProps := map[string]interface{}{}
            m := &DbusMock{}
            m.On("ListUnits").Return([]dbus.UnitStatus{dbus.UnitStatus{Name: ("name." + typeName)}}, nil)
Severity: Major
Found in resource/systemd/unit/systemd_linux_test.go and 10 other locations - About 5 hrs to fix
resource/systemd/unit/systemd_linux_test.go on lines 200..222
resource/systemd/unit/systemd_linux_test.go on lines 223..245
resource/systemd/unit/systemd_linux_test.go on lines 246..268
resource/systemd/unit/systemd_linux_test.go on lines 269..291
resource/systemd/unit/systemd_linux_test.go on lines 292..314
resource/systemd/unit/systemd_linux_test.go on lines 315..337
resource/systemd/unit/systemd_linux_test.go on lines 338..360
resource/systemd/unit/systemd_linux_test.go on lines 361..383
resource/systemd/unit/systemd_linux_test.go on lines 384..406
resource/systemd/unit/systemd_linux_test.go on lines 407..429

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

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

        t.Run("target", func(t *testing.T) {
            typeName := "target"
            typeProps := map[string]interface{}{}
            m := &DbusMock{}
            m.On("ListUnits").Return([]dbus.UnitStatus{dbus.UnitStatus{Name: ("name." + typeName)}}, nil)
Severity: Major
Found in resource/systemd/unit/systemd_linux_test.go and 10 other locations - About 5 hrs to fix
resource/systemd/unit/systemd_linux_test.go on lines 177..199
resource/systemd/unit/systemd_linux_test.go on lines 200..222
resource/systemd/unit/systemd_linux_test.go on lines 223..245
resource/systemd/unit/systemd_linux_test.go on lines 246..268
resource/systemd/unit/systemd_linux_test.go on lines 269..291
resource/systemd/unit/systemd_linux_test.go on lines 315..337
resource/systemd/unit/systemd_linux_test.go on lines 338..360
resource/systemd/unit/systemd_linux_test.go on lines 361..383
resource/systemd/unit/systemd_linux_test.go on lines 384..406
resource/systemd/unit/systemd_linux_test.go on lines 407..429

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

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