asteris-llc/converge

View on GitHub
resource/lvm/vg/vg.go

Summary

Maintainability
B
4 hrs
Test Coverage

Method resourceVG.Check has a Cognitive Complexity of 35 (exceeds 20 allowed). Consider refactoring.
Open

func (r *resourceVG) Check(context.Context, resource.Renderer) (resource.TaskStatus, error) {
    status := &resource.Status{}

    if err := r.lvm.Check(); err != nil {
        return nil, errors.Wrap(err, "lvm.volumegroup")
Severity: Minor
Found in resource/lvm/vg/vg.go - About 2 hrs 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 NewResourceVG has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

func NewResourceVG(lvm lowlevel.LVM, name string, devs []string, remove bool, forceRemove bool) resource.Task {
Severity: Minor
Found in resource/lvm/vg/vg.go - About 35 mins to fix

    Method resourceVG.Apply has 5 return statements (exceeds 4 allowed).
    Open

    func (r *resourceVG) Apply(context.Context) (status resource.TaskStatus, err error) {
        if r.exists {
            for _, d := range r.devicesToAdd {
                if err := r.lvm.ExtendVolumeGroup(r.name, d); err != nil {
                    return nil, errors.Wrapf(err, "extending volume group")
    Severity: Major
    Found in resource/lvm/vg/vg.go - About 35 mins to fix

      Method resourceVG.Check has 5 return statements (exceeds 4 allowed).
      Open

      func (r *resourceVG) Check(context.Context, resource.Renderer) (resource.TaskStatus, error) {
          status := &resource.Status{}
      
          if err := r.lvm.Check(); err != nil {
              return nil, errors.Wrap(err, "lvm.volumegroup")
      Severity: Major
      Found in resource/lvm/vg/vg.go - About 35 mins to fix

        There are no issues that match your filters.

        Category
        Status