dotcloud/docker

View on GitHub

Showing 1,468 of 1,914 total issues

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

func getConflictFreeConfiguration(configFile string, flags *pflag.FlagSet) (*Config, error) {
    b, err := os.ReadFile(configFile)
    if err != nil {
        return nil, err
    }
Severity: Major
Found in daemon/config/config.go - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        if err := os.RemoveAll(path); err != nil {
                            return 0, err
                        }
    Severity: Major
    Found in pkg/archive/diff.go - About 45 mins to fix

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

      func CompareKernelVersion(a, b VersionInfo) int {
          if a.Kernel < b.Kernel {
              return -1
          } else if a.Kernel > b.Kernel {
              return 1
      Severity: Major
      Found in pkg/parsers/kernel/kernel.go - About 45 mins to fix

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

        func Parse(filePath string, objName string) (*ParsedPkg, error) {
            fs := token.NewFileSet()
            pkg, err := parser.ParseFile(fs, filePath, nil, parser.AllErrors)
            if err != nil {
                return nil, err
        Severity: Major
        Found in pkg/plugins/pluginrpc-gen/parser.go - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if _, err := io.Copy(ts.writer, ts.bufTar); err != nil {
                                  return 0, err
                              }
          Severity: Major
          Found in pkg/tarsum/tarsum.go - About 45 mins to fix

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

            func StdCopy(dstout, dsterr io.Writer, src io.Reader) (written int64, err error) {
                var (
                    buf       = make([]byte, startingBufLen)
                    bufLen    = len(buf)
                    nr, nw    int
            Severity: Major
            Found in pkg/stdcopy/stdcopy.go - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                              for key, val in task.items():
                                  if isinstance(val, dict):
                                      for k, v in val.items():
                                          entries.append(v)
                                  else:
              Severity: Major
              Found in libnetwork/cmd/ssd/ssd.py - About 45 mins to fix

                Method Client.callWithRetry has 7 return statements (exceeds 4 allowed).
                Open

                func (c *Client) callWithRetry(serviceMethod string, data io.Reader, retry bool, reqOpts ...func(*RequestOpts)) (io.ReadCloser, error) {
                    var retries int
                    start := time.Now()
                
                    var opts RequestOpts
                Severity: Major
                Found in pkg/plugins/client.go - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if os.IsNotExist(err) {
                                              err = nil // parent was deleted
                                          }
                  Severity: Major
                  Found in pkg/archive/diff.go - About 45 mins to fix

                    Function mkdirAs has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring.
                    Open

                    func mkdirAs(path string, mode os.FileMode, owner Identity, mkAll, chownExisting bool) error {
                        path, err := filepath.Abs(path)
                        if err != nil {
                            return err
                        }
                    Severity: Minor
                    Found in pkg/idtools/idtools_unix.go - About 45 mins 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

                    Avoid deeply nested control flow statements.
                    Open

                                        if err := ts.writer.Close(); err != nil {
                                            return 0, err
                                        }
                    Severity: Major
                    Found in pkg/tarsum/tarsum.go - About 45 mins to fix

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

                      func AddNamespaceRangesUser(name string) (int, int, error) {
                          if err := addUser(name); err != nil {
                              return -1, -1, fmt.Errorf("error adding user %q: %v", name, err)
                          }
                      
                      
                      Severity: Major
                      Found in pkg/idtools/usergroupadd_linux.go - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                            if err := ts.tarW.Close(); err != nil {
                                                return 0, err
                                            }
                        Severity: Major
                        Found in pkg/tarsum/tarsum.go - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                              if aufsTempdir, err = os.MkdirTemp(dest, "dockerplnk"); err != nil {
                                                  return 0, err
                                              }
                          Severity: Major
                          Found in pkg/archive/diff.go - About 45 mins to fix

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

                            func PrepareQuotaTestImage(t *testing.T) (string, error) {
                                // imageSize is the size of the test-image. The minimum size allowed
                                // is 300MB.
                                //
                                // See https://git.kernel.org/pub/scm/fs/xfs/xfsprogs-dev.git/commit/?id=6e0ed3d19c54603f0f7d628ea04b550151d8a262
                            Severity: Major
                            Found in quota/testhelpers.go - About 45 mins to fix

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

                              func createSubordinateRanges(name string) error {
                                  // first, we should verify that ranges weren't automatically created
                                  // by the distro tooling
                                  ranges, err := parseSubuid(name)
                                  if err != nil {
                              Severity: Major
                              Found in pkg/idtools/usergroupadd_linux.go - About 45 mins to fix

                                Method puller.pullRepository has 6 return statements (exceeds 4 allowed).
                                Open

                                func (p *puller) pullRepository(ctx context.Context, ref reference.Named) (err error) {
                                    var layersDownloaded bool
                                    if !reference.IsNameOnly(ref) {
                                        layersDownloaded, err = p.pullTag(ctx, ref, p.config.Platform)
                                        if err != nil {
                                Severity: Major
                                Found in distribution/pull_v2.go - About 40 mins to fix

                                  Method Manager.Remove has 6 return statements (exceeds 4 allowed).
                                  Open

                                  func (pm *Manager) Remove(name string, config *backend.PluginRmConfig) error {
                                      p, err := pm.config.Store.GetV2Plugin(name)
                                      pm.mu.RLock()
                                      c := pm.cMap[p]
                                      pm.mu.RUnlock()
                                  Severity: Major
                                  Found in plugin/backend_linux.go - About 40 mins to fix

                                    Function checkValidParent has 6 return statements (exceeds 4 allowed).
                                    Open

                                    func checkValidParent(img, parent *image.Image) bool {
                                        if len(img.History) == 0 && len(parent.History) == 0 {
                                            return true // having history is not mandatory
                                        }
                                        if len(img.History)-len(parent.History) != 1 {
                                    Severity: Major
                                    Found in image/tarexport/load.go - About 40 mins to fix

                                      Consider simplifying this complex logical expression.
                                      Open

                                          if p.OS == "" && p.Architecture == "" && p.Variant == "" && p.OSVersion == "" && p.OSFeatures == nil && p.Features == nil {
                                      Severity: Major
                                      Found in distribution/pull_v2.go - About 40 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language