dotcloud/docker

View on GitHub
container/state.go

Summary

Maintainability
B
5 hrs
Test Coverage

State has 26 methods (exceeds 20 allowed). Consider refactoring.
Open

type State struct {
    // This Mutex is exported by design and is used as a global lock
    // for both the State and the Container it's embedded in.
    sync.Mutex
    // Note that `Running` and `Paused` are not mutually exclusive:
Severity: Minor
Found in container/state.go - About 3 hrs to fix

    Consider simplifying this complex logical expression.
    Open

        if s != "paused" &&
            s != "restarting" &&
            s != "removing" &&
            s != "running" &&
            s != "dead" &&
    Severity: Major
    Found in container/state.go - About 1 hr to fix

      Method State.String has 9 return statements (exceeds 4 allowed).
      Open

      func (s *State) String() string {
          if s.Running {
              if s.Paused {
                  return fmt.Sprintf("Up %s (Paused)", units.HumanDuration(time.Now().UTC().Sub(s.StartedAt)))
              }
      Severity: Major
      Found in container/state.go - About 55 mins to fix

        Method State.StateString has 7 return statements (exceeds 4 allowed).
        Open

        func (s *State) StateString() string {
            if s.Running {
                if s.Paused {
                    return "paused"
                }
        Severity: Major
        Found in container/state.go - About 45 mins to fix

          There are no issues that match your filters.

          Category
          Status