asteris-llc/converge

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

Summary

Maintainability
A
3 hrs
Test Coverage

Function getFailedReason has 55 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func getFailedReason(u *Unit) (string, error) {
    err := errors.New("unable to determine cause of failure: no properties available")
    var reason string
    switch u.Type {
    case UnitTypeService:
Severity: Minor
Found in resource/systemd/unit/resource.go - About 1 hr to fix

    Method Resource.shouldStop has 8 return statements (exceeds 4 allowed).
    Open

    func (r *Resource) shouldStop(u *Unit, st *resource.Status) bool {
        switch u.ActiveState {
        case "active":
            st.AddDifference("state", "active", "inactive", "")
            st.RaiseLevel(resource.StatusWillChange)
    Severity: Major
    Found in resource/systemd/unit/resource.go - About 50 mins to fix

      Method Resource.shouldStart has 8 return statements (exceeds 4 allowed).
      Open

      func (r *Resource) shouldStart(u *Unit, st *resource.Status) bool {
          switch u.ActiveState {
          case "active":
              st.AddMessage("already running")
              return false
      Severity: Major
      Found in resource/systemd/unit/resource.go - About 50 mins to fix

        Function getFailedReason has 7 return statements (exceeds 4 allowed).
        Open

        func getFailedReason(u *Unit) (string, error) {
            err := errors.New("unable to determine cause of failure: no properties available")
            var reason string
            switch u.Type {
            case UnitTypeService:
        Severity: Major
        Found in resource/systemd/unit/resource.go - About 45 mins to fix

          There are no issues that match your filters.

          Category
          Status