docker/docker

View on GitHub

Showing 1,853 of 1,853 total issues

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

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

func (c *containerConfig) applyPrivileges(hc *enginecontainer.HostConfig) {
    privileges := c.spec().Privileges
    if privileges == nil {
        return
    }
Severity: Minor
Found in daemon/cluster/executor/container/container.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 reader.readLogs has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
Open

func (r *reader) readLogs() {
    defer close(r.logWatcher.Msg)

    // Make sure the ready channel is closed in the event of an early
    // return.
Severity: Minor
Found in daemon/logger/journald/read.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 Daemon.execSetPlatformOpt has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
Open

func (daemon *Daemon) execSetPlatformOpt(ctx context.Context, daemonCfg *config.Config, ec *container.ExecConfig, p *specs.Process) error {
    if len(ec.User) > 0 {
        var err error
        if daemon.UsesSnapshotter() {
            p.User, err = getUserFromContainerd(ctx, daemon.containerdClient, ec)
Severity: Minor
Found in daemon/exec_linux.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 buildPortsRelatedCreateEndpointOptions has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
Open

func buildPortsRelatedCreateEndpointOptions(c *container.Container, n *libnetwork.Network, sb *libnetwork.Sandbox) ([]libnetwork.EndpointOption, error) {
    // Port-mapping rules belong to the container & applicable only to non-internal networks.
    //
    // TODO(thaJeztah): Look if we can provide a more minimal function for getPortMapInfo, as it does a lot, and we only need the "length".
    if n.Internal() || len(getPortMapInfo(sb)) > 0 {
Severity: Minor
Found in daemon/network.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 getSystemCPUUsage has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
Open

func getSystemCPUUsage() (cpuUsage uint64, cpuNum uint32, err error) {
    f, err := os.Open("/proc/stat")
    if err != nil {
        return 0, 0, err
    }
Severity: Minor
Found in daemon/stats_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

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

func getTailReader(ctx context.Context, r loggerutils.SizeReaderAt, req int) (io.Reader, int, error) {
    size := r.Size()
    if req < 0 {
        return nil, 0, errdefs.InvalidParameter(errors.Errorf("invalid number of lines to tail: %d", req))
    }
Severity: Minor
Found in daemon/logger/local/read.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 New has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
Open

func New(info logger.Info) (logger.Logger, error) {
    containerStreamConfig, err := newStreamConfig(info)
    if err != nil {
        return nil, err
    }
Severity: Minor
Found in daemon/logger/awslogs/cloudwatchlogs.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 ChangesSize has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
Open

func ChangesSize(newDir string, changes []Change) int64 {
    var (
        size int64
        sf   = make(map[uint64]struct{})
    )
Severity: Minor
Found in pkg/archive/changes.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 BytesPipe.Write has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
Open

func (bp *BytesPipe) Write(p []byte) (int, error) {
    bp.mu.Lock()
    defer bp.mu.Unlock()

    written := 0
Severity: Minor
Found in pkg/ioutils/bytespipe.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 get_namespaces has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def get_namespaces(data, ingress=False):
    if ingress is True:
        return {"Ingress":"/var/run/docker/netns/ingress_sbox"}
    else:
        spaces =[]
Severity: Minor
Found in libnetwork/cmd/ssd/ssd.py - 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 scanner.Scan has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
Open

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

Severity: Minor
Found in pkg/tailfile/tailfile.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 check_iptables has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def check_iptables(name, plist):
    replace = (':', ',')
    ports = []
    for port in plist:
        for r in replace:
Severity: Minor
Found in libnetwork/cmd/ssd/ssd.py - 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