asteris-llc/converge

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

Summary

Maintainability
F
1 wk
Test Coverage

Function TestApply has 277 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func TestApply(t *testing.T) {
    t.Parallel()
    t.Run("query-unit-returns-error", func(t *testing.T) {
        t.Parallel()
        expected := errors.New("error1")
Severity: Major
Found in resource/systemd/unit/resource_test.go - About 1 day to fix

    Function TestCheck has 202 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func TestCheck(t *testing.T) {
        t.Parallel()
        t.Run("send-signal", func(t *testing.T) {
            r := &Resource{
                State:        "running",
    Severity: Major
    Found in resource/systemd/unit/resource_test.go - About 7 hrs to fix

      File resource_test.go has 688 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: Minor
      Found in resource/systemd/unit/resource_test.go - About 6 hrs to fix

        Function TestGetFailedReason has 98 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func TestGetFailedReason(t *testing.T) {
            t.Parallel()
        
            t.Run("returns-error-when-no-properties", func(t *testing.T) {
                t.Parallel()
        Severity: Major
        Found in resource/systemd/unit/resource_test.go - About 2 hrs to fix

          Function TestHandlesContext has 54 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func TestHandlesContext(t *testing.T) {
              t.Parallel()
          
              t.Run("Check", func(t *testing.T) {
                  t.Parallel()
          Severity: Minor
          Found in resource/systemd/unit/resource_test.go - About 1 hr to fix

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

                    t.Run("when-status-deactivating", func(t *testing.T) {
                        unit := &Unit{ActiveState: "deactivating"}
                        e := &ExecutorMock{}
                        r.systemdExecutor = e
                        e.On("QueryUnit", any, any).Return(unit, nil)
            Severity: Major
            Found in resource/systemd/unit/resource_test.go and 3 other locations - About 1 hr to fix
            resource/systemd/unit/resource_test.go on lines 99..108
            resource/systemd/unit/resource_test.go on lines 150..159
            resource/systemd/unit/resource_test.go on lines 190..199

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

            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-status-active", func(t *testing.T) {
                        unit := &Unit{ActiveState: "active"}
                        e := &ExecutorMock{}
                        r.systemdExecutor = e
                        e.On("QueryUnit", any, any).Return(unit, nil)
            Severity: Major
            Found in resource/systemd/unit/resource_test.go and 3 other locations - About 1 hr to fix
            resource/systemd/unit/resource_test.go on lines 99..108
            resource/systemd/unit/resource_test.go on lines 134..143
            resource/systemd/unit/resource_test.go on lines 190..199

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

            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-status-inactive", func(t *testing.T) {
                        unit := &Unit{ActiveState: "inactive"}
                        e := &ExecutorMock{}
                        r.systemdExecutor = e
                        e.On("QueryUnit", any, any).Return(unit, nil)
            Severity: Major
            Found in resource/systemd/unit/resource_test.go and 3 other locations - About 1 hr to fix
            resource/systemd/unit/resource_test.go on lines 134..143
            resource/systemd/unit/resource_test.go on lines 150..159
            resource/systemd/unit/resource_test.go on lines 190..199

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

            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-status-activating", func(t *testing.T) {
                        unit := &Unit{ActiveState: "activating"}
                        e := &ExecutorMock{}
                        r.systemdExecutor = e
                        e.On("QueryUnit", any, any).Return(unit, nil)
            Severity: Major
            Found in resource/systemd/unit/resource_test.go and 3 other locations - About 1 hr to fix
            resource/systemd/unit/resource_test.go on lines 99..108
            resource/systemd/unit/resource_test.go on lines 134..143
            resource/systemd/unit/resource_test.go on lines 150..159

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

            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-status-active", func(t *testing.T) {
                        unit := &Unit{ActiveState: "active"}
                        e := &ExecutorMock{}
                        r.systemdExecutor = e
                        e.On("QueryUnit", any, any).Return(unit, nil)
            Severity: Major
            Found in resource/systemd/unit/resource_test.go and 2 other locations - About 1 hr to fix
            resource/systemd/unit/resource_test.go on lines 90..98
            resource/systemd/unit/resource_test.go on lines 125..133

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

            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-status-activating", func(t *testing.T) {
                        unit := &Unit{ActiveState: "activating"}
                        e := &ExecutorMock{}
                        r.systemdExecutor = e
                        e.On("QueryUnit", any, any).Return(unit, nil)
            Severity: Major
            Found in resource/systemd/unit/resource_test.go and 2 other locations - About 1 hr to fix
            resource/systemd/unit/resource_test.go on lines 81..89
            resource/systemd/unit/resource_test.go on lines 90..98

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

            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-status-reloading", func(t *testing.T) {
                        unit := &Unit{ActiveState: "reloading"}
                        e := &ExecutorMock{}
                        r.systemdExecutor = e
                        e.On("QueryUnit", any, any).Return(unit, nil)
            Severity: Major
            Found in resource/systemd/unit/resource_test.go and 2 other locations - About 1 hr to fix
            resource/systemd/unit/resource_test.go on lines 81..89
            resource/systemd/unit/resource_test.go on lines 125..133

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

            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-status-reloading", func(t *testing.T) {
                        unit := &Unit{ActiveState: "reloading"}
                        e := &ExecutorMock{}
                        r.systemdExecutor = e
                        e.On("QueryUnit", any, any).Return(unit, nil)
            Severity: Major
            Found in resource/systemd/unit/resource_test.go and 2 other locations - About 1 hr to fix
            resource/systemd/unit/resource_test.go on lines 168..175
            resource/systemd/unit/resource_test.go on lines 200..207

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

            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-status-inactive", func(t *testing.T) {
                        unit := &Unit{ActiveState: "inactive"}
                        e := &ExecutorMock{}
                        r.systemdExecutor = e
                        e.On("QueryUnit", any, any).Return(unit, nil)
            Severity: Major
            Found in resource/systemd/unit/resource_test.go and 2 other locations - About 1 hr to fix
            resource/systemd/unit/resource_test.go on lines 160..167
            resource/systemd/unit/resource_test.go on lines 200..207

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

            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-status-deactivating", func(t *testing.T) {
                        unit := &Unit{ActiveState: "deactivating"}
                        e := &ExecutorMock{}
                        r.systemdExecutor = e
                        e.On("QueryUnit", any, any).Return(unit, nil)
            Severity: Major
            Found in resource/systemd/unit/resource_test.go and 2 other locations - About 1 hr to fix
            resource/systemd/unit/resource_test.go on lines 160..167
            resource/systemd/unit/resource_test.go on lines 168..175

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

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

                    t.Run("socket", func(t *testing.T) {
                        t.Parallel()
                        u := &Unit{Type: UnitTypeSocket, SocketProperties: &SocketTypeProperties{Result: "success"}}
                        actual, err := getFailedReason(u)
                        require.NoError(t, err)
            Severity: Major
            Found in resource/systemd/unit/resource_test.go and 5 other locations - About 35 mins to fix
            resource/systemd/unit/resource_test.go on lines 254..260
            resource/systemd/unit/resource_test.go on lines 268..274
            resource/systemd/unit/resource_test.go on lines 275..281
            resource/systemd/unit/resource_test.go on lines 282..288
            resource/systemd/unit/resource_test.go on lines 289..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 105.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

                    t.Run("service", func(t *testing.T) {
                        t.Parallel()
                        u := &Unit{Type: UnitTypeService, ServiceProperties: &ServiceTypeProperties{Result: "success"}}
                        actual, err := getFailedReason(u)
                        require.NoError(t, err)
            Severity: Major
            Found in resource/systemd/unit/resource_test.go and 5 other locations - About 35 mins to fix
            resource/systemd/unit/resource_test.go on lines 261..267
            resource/systemd/unit/resource_test.go on lines 268..274
            resource/systemd/unit/resource_test.go on lines 275..281
            resource/systemd/unit/resource_test.go on lines 282..288
            resource/systemd/unit/resource_test.go on lines 289..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 105.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

                    t.Run("mount", func(t *testing.T) {
                        t.Parallel()
                        u := &Unit{Type: UnitTypeMount, MountProperties: &MountTypeProperties{Result: "success"}}
                        actual, err := getFailedReason(u)
                        require.NoError(t, err)
            Severity: Major
            Found in resource/systemd/unit/resource_test.go and 5 other locations - About 35 mins to fix
            resource/systemd/unit/resource_test.go on lines 254..260
            resource/systemd/unit/resource_test.go on lines 261..267
            resource/systemd/unit/resource_test.go on lines 275..281
            resource/systemd/unit/resource_test.go on lines 282..288
            resource/systemd/unit/resource_test.go on lines 289..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 105.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

                    t.Run("timer", func(t *testing.T) {
                        t.Parallel()
                        u := &Unit{Type: UnitTypeTimer, TimerProperties: &TimerTypeProperties{Result: "success"}}
                        actual, err := getFailedReason(u)
                        require.NoError(t, err)
            Severity: Major
            Found in resource/systemd/unit/resource_test.go and 5 other locations - About 35 mins to fix
            resource/systemd/unit/resource_test.go on lines 254..260
            resource/systemd/unit/resource_test.go on lines 261..267
            resource/systemd/unit/resource_test.go on lines 268..274
            resource/systemd/unit/resource_test.go on lines 275..281
            resource/systemd/unit/resource_test.go on lines 282..288

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 105.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

                    t.Run("swap", func(t *testing.T) {
                        t.Parallel()
                        u := &Unit{Type: UnitTypeSwap, SwapProperties: &SwapTypeProperties{Result: "success"}}
                        actual, err := getFailedReason(u)
                        require.NoError(t, err)
            Severity: Major
            Found in resource/systemd/unit/resource_test.go and 5 other locations - About 35 mins to fix
            resource/systemd/unit/resource_test.go on lines 254..260
            resource/systemd/unit/resource_test.go on lines 261..267
            resource/systemd/unit/resource_test.go on lines 268..274
            resource/systemd/unit/resource_test.go on lines 275..281
            resource/systemd/unit/resource_test.go on lines 289..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 105.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

                    t.Run("automount", func(t *testing.T) {
                        t.Parallel()
                        u := &Unit{Type: UnitTypeAutoMount, AutomountProperties: &AutomountTypeProperties{Result: "success"}}
                        actual, err := getFailedReason(u)
                        require.NoError(t, err)
            Severity: Major
            Found in resource/systemd/unit/resource_test.go and 5 other locations - About 35 mins to fix
            resource/systemd/unit/resource_test.go on lines 254..260
            resource/systemd/unit/resource_test.go on lines 261..267
            resource/systemd/unit/resource_test.go on lines 268..274
            resource/systemd/unit/resource_test.go on lines 282..288
            resource/systemd/unit/resource_test.go on lines 289..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 105.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            There are no issues that match your filters.

            Category
            Status