resource/systemd/unit/resource.go
Function getFailedReason
has 55 lines of code (exceeds 50 allowed). Consider refactoring. Open
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:
Method Resource.shouldStop
has 8 return statements (exceeds 4 allowed). Open
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)
Method Resource.shouldStart
has 8 return statements (exceeds 4 allowed). Open
Open
func (r *Resource) shouldStart(u *Unit, st *resource.Status) bool {
switch u.ActiveState {
case "active":
st.AddMessage("already running")
return false
Function getFailedReason
has 7 return statements (exceeds 4 allowed). Open
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: