docker/docker

View on GitHub

Showing 1,412 of 1,855 total issues

Method scanner.Scan has 5 return statements (exceeds 4 allowed).
Open

func (s *scanner) Scan(ctx context.Context) bool {
    if s.err != nil {
        return false
    }

Severity: Major
Found in pkg/tailfile/tailfile.go - About 35 mins to fix

    Function Zombie has 5 return statements (exceeds 4 allowed).
    Open

    func Zombie(pid int) (bool, error) {
        if pid < 1 {
            return false, nil
        }
        data, err := os.ReadFile(fmt.Sprintf("/proc/%d/stat", pid))
    Severity: Major
    Found in pkg/process/process_unix.go - About 35 mins to fix

      Method atomicFileWriter.Close has 5 return statements (exceeds 4 allowed).
      Open

      func (w *atomicFileWriter) Close() (retErr error) {
          defer func() {
              if retErr != nil || w.writeErr != nil {
                  os.Remove(w.f.Name())
              }
      Severity: Major
      Found in pkg/ioutils/fswriters.go - About 35 mins to fix

        Method layerStore.initMount has 5 return statements (exceeds 4 allowed).
        Open

        func (ls *layerStore) initMount(graphID, parent, mountLabel string, initFunc MountInit, storageOpt map[string]string) (string, error) {
            // Use "<graph-id>-init" to maintain compatibility with graph drivers
            // which are expecting this layer with this special name. If all
            // graph drivers can be updated to not rely on knowing about this layer
            // then the initID should be randomly generated.
        Severity: Major
        Found in layer/layer_store.go - About 35 mins to fix

          Function StickRuntimeDirContents has 5 return statements (exceeds 4 allowed).
          Open

          func StickRuntimeDirContents(files []string) ([]string, error) {
              runtimeDir, err := GetRuntimeDir()
              if err != nil {
                  // ignore error if runtimeDir is empty
                  return nil, nil
          Severity: Major
          Found in pkg/homedir/homedir_linux.go - About 35 mins to fix

            Function toRootless has 5 return statements (exceeds 4 allowed).
            Open

            func toRootless(spec *specs.Spec, v2Controllers []string, currentOOMScoreAdj int) error {
                if len(v2Controllers) == 0 {
                    if spec.Linux != nil {
                        // Remove cgroup settings.
                        spec.Linux.Resources = nil
            Severity: Major
            Found in pkg/rootless/specconv/specconv_linux.go - About 35 mins to fix

              Method layerStore.ChecksumForGraphID has 5 return statements (exceeds 4 allowed).
              Open

              func (ls *layerStore) ChecksumForGraphID(id, parent, newTarDataPath string) (diffID DiffID, size int64, err error) {
                  rawarchive, err := ls.driver.Diff(id, parent)
                  if err != nil {
                      return
                  }
              Severity: Major
              Found in layer/migration.go - About 35 mins to fix

                Function doUnpack has 5 return statements (exceeds 4 allowed).
                Open

                func doUnpack(decompressedArchive io.Reader, relDest, root string, options *archive.TarOptions) error {
                    optionsR, optionsW, err := os.Pipe()
                    if err != nil {
                        return err
                    }
                Severity: Major
                Found in pkg/chrootarchive/archive_unix_nolinux.go - About 35 mins to fix

                  Method Endpoint.deleteServiceInfoFromCluster has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func (ep *Endpoint) deleteServiceInfoFromCluster(sb *Sandbox, fullRemove bool, method string) error {
                      if len(ep.dnsNames) == 0 {
                          return nil
                      }
                  
                  
                  Severity: Minor
                  Found in libnetwork/agent.go - About 25 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

                  Function Join has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func Join(ctx context.Context, path, subpath string) (*SafePath, error) {
                      base, subpart, err := evaluatePath(path, subpath)
                      if err != nil {
                          return nil, err
                      }
                  Severity: Minor
                  Found in internal/safepath/join_windows.go - About 25 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

                  Method EndpointRecord.MarshalToSizedBuffer has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func (m *EndpointRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) {
                      i := len(dAtA)
                      _ = i
                      var l int
                      _ = l
                  Severity: Minor
                  Found in libnetwork/agent.pb.go - About 25 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

                  Method Sandbox.clearNetworkResources has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func (sb *Sandbox) clearNetworkResources(origEp *Endpoint) error {
                      ep := sb.GetEndpoint(origEp.id)
                      if ep == nil {
                          return fmt.Errorf("could not find the sandbox endpoint data for endpoint %s",
                              origEp.id)
                  Severity: Minor
                  Found in libnetwork/sandbox.go - About 25 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

                  Function programSA has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func programSA(localIP, remoteIP net.IP, spi *spi, k *key, dir int, add bool) (fSA *netlink.XfrmState, rSA *netlink.XfrmState, err error) {
                      var (
                          action      = "Removing"
                          xfrmProgram = ns.NlHandle().XfrmStateDel
                      )
                  Severity: Minor
                  Found in libnetwork/drivers/overlay/encryption.go - About 25 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

                  Function parseEndpointOptions has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func parseEndpointOptions(epOptions map[string]interface{}) (*endpointOption, error) {
                      if epOptions == nil {
                          return nil, nil
                      }
                  
                  
                  Severity: Minor
                  Found in libnetwork/drivers/windows/windows.go - About 25 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

                  Method driver.NetworkAllocate has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func (d *driver) NetworkAllocate(id string, option map[string]string, ipV4Data, ipV6Data []driverapi.IPAMData) (map[string]string, error) {
                      if id == "" {
                          return nil, fmt.Errorf("invalid network id for overlay network")
                      }
                  
                  
                  Severity: Minor
                  Found in libnetwork/drivers/overlay/ovmanager/ovmanager.go - About 25 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

                  Method driver.parseNetworkOptions has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func (d *driver) parseNetworkOptions(id string, genericOptions map[string]string) (*networkConfiguration, error) {
                      config := &networkConfiguration{Type: d.name}
                  
                      for label, value := range genericOptions {
                          switch label {
                  Severity: Minor
                  Found in libnetwork/drivers/windows/windows.go - About 25 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

                  Function getMountOptions has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func getMountOptions(opts *optsConfig, resolveIP func(string, string) (*net.IPAddr, error)) (mountDevice string, mountOpts string, _ error) {
                      if opts.MountDevice == "" {
                          return "", "", fmt.Errorf("missing device in volume options")
                      }
                  
                  
                  Severity: Minor
                  Found in volume/local/local_unix.go - About 25 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

                  Method Builder.dispatchDockerfileWithCancellation has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func (b *Builder) dispatchDockerfileWithCancellation(ctx context.Context, parseResult []instructions.Stage, metaArgs []instructions.ArgCommand, escapeToken rune, source builder.Source) (*dispatchState, error) {
                      dispatchRequest := dispatchRequest{}
                      buildArgs := NewBuildArgs(b.options.BuildArgs)
                      totalCommands := len(metaArgs) + len(parseResult)
                      currentCommandIndex := 1
                  Severity: Minor
                  Found in builder/dockerfile/builder.go - About 25 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

                  Function ValidateIPAM has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func ValidateIPAM(ipam *IPAM, enableIPv6 bool) error {
                      if ipam == nil {
                          return nil
                      }
                  
                  
                  Severity: Minor
                  Found in api/types/network/ipam.go - About 25 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

                  Method client.extractResourcesFromSpec has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func (c *client) extractResourcesFromSpec(spec *specs.Spec, configuration *hcsshim.ContainerConfig) {
                      if spec.Windows.Resources != nil {
                          if spec.Windows.Resources.CPU != nil {
                              if spec.Windows.Resources.CPU.Count != nil {
                                  // This check is being done here rather than in adaptContainerSettings
                  Severity: Minor
                  Found in libcontainerd/local/local_windows.go - About 25 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

                  Severity
                  Category
                  Status
                  Source
                  Language