asteris-llc/converge

View on GitHub
resource/systemd/unit/systemd_linux_test.go

Summary

Maintainability
F
3 wks
Test Coverage

Function TestListUnits has 383 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func TestListUnits(t *testing.T) {
    t.Parallel()

    t.Run("when-dbus-errors", func(t *testing.T) {
        t.Run("list-units-returns-error", func(t *testing.T) {
Severity: Major
Found in resource/systemd/unit/systemd_linux_test.go - About 1 day to fix

    File systemd_linux_test.go has 834 lines of code (exceeds 500 allowed). 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 resource/systemd/unit/systemd_linux_test.go - About 1 day to fix

      Function TestReloadUnit has 87 lines of code (exceeds 50 allowed). 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 - About 2 hrs to fix

        Function TestRestartUnit has 87 lines of code (exceeds 50 allowed). 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 - About 2 hrs to fix

          Function TestStopUnit has 87 lines of code (exceeds 50 allowed). 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 - About 2 hrs to fix

            Function TestStartUnit has 87 lines of code (exceeds 50 allowed). 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 - About 2 hrs to fix

              Function TestQueryUnit has 61 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func TestQueryUnit(t *testing.T) {
                  t.Parallel()
                  t.Run("when-verify", func(t *testing.T) {
                      t.Parallel()
                      t.Run("when-unit-exists", func(t *testing.T) {
              Severity: Minor
              Found in resource/systemd/unit/systemd_linux_test.go - About 1 hr to fix

                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 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 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 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 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("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("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

                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("slice", func(t *testing.T) {
                            typeName := "slice"
                            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 338..360
                resource/systemd/unit/systemd_linux_test.go on lines 361..383
                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("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("snapshot", func(t *testing.T) {
                            typeName := "snapshot"
                            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 338..360
                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("mount", func(t *testing.T) {
                            typeName := "mount"
                            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 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("scope", func(t *testing.T) {
                            typeName := "scope"
                            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 338..360
                resource/systemd/unit/systemd_linux_test.go on lines 361..383
                resource/systemd/unit/systemd_linux_test.go on lines 384..406

                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

                There are no issues that match your filters.

                Category
                Status