asteris-llc/converge

View on GitHub

Showing 572 of 572 total issues

File systemd_properties.go has 2973 lines of code (exceeds 500 allowed). Consider refactoring.
Open

// Copyright © 2017 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_properties.go - About 1 wk to fix

    Function newSocketTypePropertiesFromMap has a Cognitive Complexity of 167 (exceeds 20 allowed). Consider refactoring.
    Open

    func newSocketTypePropertiesFromMap(m map[string]interface{}) *SocketTypeProperties {
        s := &SocketTypeProperties{}
    
        if val, ok := m["Accept"]; ok {
            s.Accept = val.(bool)
    Severity: Minor
    Found in resource/systemd/unit/systemd_properties.go - About 3 days to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

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

    Function newServiceTypePropertiesFromMap has a Cognitive Complexity of 156 (exceeds 20 allowed). Consider refactoring.
    Open

    func newServiceTypePropertiesFromMap(m map[string]interface{}) *ServiceTypeProperties {
        s := &ServiceTypeProperties{}
    
        if val, ok := m["AmbientCapabilities"]; ok {
            s.AmbientCapabilities = val.(uint64)
    Severity: Minor
    Found in resource/systemd/unit/systemd_properties.go - About 2 days to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function TestContainerCheck has 556 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func TestContainerCheck(t *testing.T) {
        t.Parallel()
        defer logging.HideLogs(t)()
    
        t.Run("container not found", func(t *testing.T) {
    Severity: Major
    Found in resource/docker/container/container_test.go - About 2 days to fix

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

      File user_test.go has 1224 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/user/user_test.go - About 2 days to fix

        Function newSocketTypePropertiesFromMap has 503 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func newSocketTypePropertiesFromMap(m map[string]interface{}) *SocketTypeProperties {
            s := &SocketTypeProperties{}
        
            if val, ok := m["Accept"]; ok {
                s.Accept = val.(bool)
        Severity: Major
        Found in resource/systemd/unit/systemd_properties.go - About 2 days to fix

          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

          // 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

          Function newMountTypePropertiesFromMap has a Cognitive Complexity of 129 (exceeds 20 allowed). Consider refactoring.
          Open

          func newMountTypePropertiesFromMap(m map[string]interface{}) *MountTypeProperties {
              s := &MountTypeProperties{}
          
              if val, ok := m["AmbientCapabilities"]; ok {
                  s.AmbientCapabilities = val.(uint64)
          Severity: Minor
          Found in resource/systemd/unit/systemd_properties.go - About 2 days to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function newServiceTypePropertiesFromMap has 470 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func newServiceTypePropertiesFromMap(m map[string]interface{}) *ServiceTypeProperties {
              s := &ServiceTypeProperties{}
          
              if val, ok := m["AmbientCapabilities"]; ok {
                  s.AmbientCapabilities = val.(uint64)
          Severity: Major
          Found in resource/systemd/unit/systemd_properties.go - About 2 days to fix

            Function newSwapTypePropertiesFromMap has a Cognitive Complexity of 125 (exceeds 20 allowed). Consider refactoring.
            Open

            func newSwapTypePropertiesFromMap(m map[string]interface{}) *SwapTypeProperties {
                s := &SwapTypeProperties{}
            
                if val, ok := m["AmbientCapabilities"]; ok {
                    s.AmbientCapabilities = val.(uint64)
            Severity: Minor
            Found in resource/systemd/unit/systemd_properties.go - About 2 days to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function TestCheck has a Cognitive Complexity of 124 (exceeds 20 allowed). Consider refactoring.
            Open

            func TestCheck(t *testing.T) {
                t.Parallel()
            
                t.Run("state=present", func(t *testing.T) {
                    g := group.NewGroup(new(group.System))
            Severity: Minor
            Found in resource/group/group_test.go - About 2 days to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            File unarchive_test.go has 1127 lines of code (exceeds 500 allowed). Consider refactoring.
            Open

            // Copyright © 2017 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/unarchive/unarchive_test.go - About 2 days to fix

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

              func TestApply(t *testing.T) {
                  t.Parallel()
              
                  t.Run("state=present", func(t *testing.T) {
                      t.Run("gid not provided", func(t *testing.T) {
              Severity: Major
              Found in resource/group/group_test.go - About 2 days to fix
                Severity
                Category
                Status
                Source
                Language