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 {
    sync.Mutex
    // Note that `Running` and `Paused` are not mutually exclusive:
    // When pausing a container (on Linux), the freezer cgroup is used to suspend
    // all processes in the container. Freezing the process requires the process to
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