docker/docker

View on GitHub

Showing 1,853 of 1,853 total issues

Method Daemon.fillPlatformInfo has a Cognitive Complexity of 63 (exceeds 20 allowed). Consider refactoring.
Open

func (daemon *Daemon) fillPlatformInfo(ctx context.Context, v *system.Info, sysInfo *sysinfo.SysInfo, cfg *configStore) error {
    v.CgroupDriver = cgroupDriver(&cfg.Config)
    v.CgroupVersion = "1"
    if sysInfo.CgroupUnified {
        v.CgroupVersion = "2"
Severity: Minor
Found in daemon/info_unix.go - About 7 hrs 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 ImageService.ImagesPrune has a Cognitive Complexity of 63 (exceeds 20 allowed). Consider refactoring.
Open

func (i *ImageService) ImagesPrune(ctx context.Context, pruneFilters filters.Args) (*types.ImagesPruneReport, error) {
    if !atomic.CompareAndSwapInt32(&i.pruneRunning, 0, 1) {
        return nil, errPruneRunning
    }
    defer atomic.StoreInt32(&i.pruneRunning, 0)
Severity: Minor
Found in daemon/images/image_prune.go - About 7 hrs 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.Join has a Cognitive Complexity of 62 (exceeds 20 allowed). Consider refactoring.
Open

func (d *driver) Join(nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, options map[string]interface{}) error {
    n, err := d.getNetwork(nid)
    if err != nil {
        return err
    }
Severity: Minor
Found in libnetwork/drivers/ipvlan/ipvlan_joinleave.go - About 7 hrs 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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

func (d *driver) DeleteNetwork(nid string) error {
    n := d.network(nid)
    if n == nil {
        return fmt.Errorf("network id %s not found", nid)
    }
Severity: Major
Found in libnetwork/drivers/macvlan/macvlan_network.go and 1 other location - About 7 hrs to fix
libnetwork/drivers/ipvlan/ipvlan_network.go on lines 119..164

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 503.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

func (d *driver) DeleteNetwork(nid string) error {
    n := d.network(nid)
    if n == nil {
        return fmt.Errorf("network id %s not found", nid)
    }
Severity: Major
Found in libnetwork/drivers/ipvlan/ipvlan_network.go and 1 other location - About 7 hrs to fix
libnetwork/drivers/macvlan/macvlan_network.go on lines 109..154

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 503.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

File entry.pb.go has 714 lines of code (exceeds 500 allowed). Consider refactoring.
Open

// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: entry.proto

package logdriver

Severity: Minor
Found in api/types/plugins/logdriver/entry.pb.go - About 7 hrs to fix

    Method IPTable.ProgramChain has a Cognitive Complexity of 61 (exceeds 20 allowed). Consider refactoring.
    Open

    func (iptable IPTable) ProgramChain(c *ChainInfo, bridgeName string, hairpinMode, enable bool) error {
        if c.Name == "" {
            return errors.New("could not program chain, missing chain name")
        }
    
    
    Severity: Minor
    Found in libnetwork/iptables/iptables.go - About 7 hrs 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 ImageService.ImageDelete has a Cognitive Complexity of 61 (exceeds 20 allowed). Consider refactoring.
    Open

    func (i *ImageService) ImageDelete(ctx context.Context, imageRef string, force, prune bool) ([]imagetypes.DeleteResponse, error) {
        start := time.Now()
        records := []imagetypes.DeleteResponse{}
    
        img, err := i.GetImage(ctx, imageRef, backend.GetImageOpts{})
    Severity: Minor
    Found in daemon/images/image_delete.go - About 7 hrs 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

    File windows.go has 708 lines of code (exceeds 500 allowed). Consider refactoring.
    Open

    //go:build windows
    
    // Shim for the Host Network Service (HNS) to manage networking for
    // Windows Server containers and Hyper-V containers. This module
    // is a basic libnetwork driver that passes all the calls to HNS
    Severity: Minor
    Found in libnetwork/drivers/windows/windows.go - About 7 hrs to fix

      Method Daemon.openContainerFS has a Cognitive Complexity of 60 (exceeds 20 allowed). Consider refactoring.
      Open

      func (daemon *Daemon) openContainerFS(container *container.Container) (_ *containerFSView, err error) {
          ctx := context.TODO()
      
          if err := daemon.Mount(container); err != nil {
              return nil, err
      Severity: Minor
      Found in daemon/containerfs_linux.go - About 6 hrs 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

      Similar blocks of code found in 5 locations. Consider refactoring.
      Open

      func skipAgent(dAtA []byte) (n int, err error) {
          l := len(dAtA)
          iNdEx := 0
          depth := 0
          for iNdEx < l {
      Severity: Major
      Found in libnetwork/agent.pb.go and 4 other locations - About 6 hrs to fix
      api/types/plugins/logdriver/entry.pb.go on lines 672..749
      api/types/swarm/runtime/plugin.pb.go on lines 725..802
      libnetwork/drivers/overlay/overlay.pb.go on lines 389..466
      libnetwork/networkdb/networkdb.pb.go on lines 3008..3085

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 483.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 5 locations. Consider refactoring.
      Open

      func skipOverlay(dAtA []byte) (n int, err error) {
          l := len(dAtA)
          iNdEx := 0
          depth := 0
          for iNdEx < l {
      Severity: Major
      Found in libnetwork/drivers/overlay/overlay.pb.go and 4 other locations - About 6 hrs to fix
      api/types/plugins/logdriver/entry.pb.go on lines 672..749
      api/types/swarm/runtime/plugin.pb.go on lines 725..802
      libnetwork/agent.pb.go on lines 1085..1162
      libnetwork/networkdb/networkdb.pb.go on lines 3008..3085

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 483.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 5 locations. Consider refactoring.
      Open

      func skipPlugin(dAtA []byte) (n int, err error) {
          l := len(dAtA)
          iNdEx := 0
          depth := 0
          for iNdEx < l {
      Severity: Major
      Found in api/types/swarm/runtime/plugin.pb.go and 4 other locations - About 6 hrs to fix
      api/types/plugins/logdriver/entry.pb.go on lines 672..749
      libnetwork/agent.pb.go on lines 1085..1162
      libnetwork/drivers/overlay/overlay.pb.go on lines 389..466
      libnetwork/networkdb/networkdb.pb.go on lines 3008..3085

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 483.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 5 locations. Consider refactoring.
      Open

      func skipNetworkdb(dAtA []byte) (n int, err error) {
          l := len(dAtA)
          iNdEx := 0
          depth := 0
          for iNdEx < l {
      Severity: Major
      Found in libnetwork/networkdb/networkdb.pb.go and 4 other locations - About 6 hrs to fix
      api/types/plugins/logdriver/entry.pb.go on lines 672..749
      api/types/swarm/runtime/plugin.pb.go on lines 725..802
      libnetwork/agent.pb.go on lines 1085..1162
      libnetwork/drivers/overlay/overlay.pb.go on lines 389..466

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 483.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 5 locations. Consider refactoring.
      Open

      func skipEntry(dAtA []byte) (n int, err error) {
          l := len(dAtA)
          iNdEx := 0
          depth := 0
          for iNdEx < l {
      Severity: Major
      Found in api/types/plugins/logdriver/entry.pb.go and 4 other locations - About 6 hrs to fix
      api/types/swarm/runtime/plugin.pb.go on lines 725..802
      libnetwork/agent.pb.go on lines 1085..1162
      libnetwork/drivers/overlay/overlay.pb.go on lines 389..466
      libnetwork/networkdb/networkdb.pb.go on lines 3008..3085

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 483.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Method PluginSpec.Unmarshal has 197 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (m *PluginSpec) Unmarshal(dAtA []byte) error {
          l := len(dAtA)
          iNdEx := 0
          for iNdEx < l {
              preIndex := iNdEx
      Severity: Major
      Found in api/types/swarm/runtime/plugin.pb.go - About 6 hrs to fix

        Method CompoundMessage.Unmarshal has a Cognitive Complexity of 59 (exceeds 20 allowed). Consider refactoring.
        Open

        func (m *CompoundMessage) Unmarshal(dAtA []byte) error {
            l := len(dAtA)
            iNdEx := 0
            for iNdEx < l {
                preIndex := iNdEx
        Severity: Minor
        Found in libnetwork/networkdb/networkdb.pb.go - About 6 hrs 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 CompoundMessage_SimpleMessage.Unmarshal has a Cognitive Complexity of 59 (exceeds 20 allowed). Consider refactoring.
        Open

        func (m *CompoundMessage_SimpleMessage) Unmarshal(dAtA []byte) error {
            l := len(dAtA)
            iNdEx := 0
            for iNdEx < l {
                preIndex := iNdEx
        Severity: Minor
        Found in libnetwork/networkdb/networkdb.pb.go - About 6 hrs 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 ImageService.Images has 190 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (i *ImageService) Images(ctx context.Context, opts imagetypes.ListOptions) ([]*imagetypes.Summary, error) {
            if err := opts.Filters.Validate(acceptedImageFilterTags); err != nil {
                return nil, err
            }
        
        
        Severity: Major
        Found in daemon/images/image_list.go - About 6 hrs to fix

          Method Cluster.UpdateService has a Cognitive Complexity of 58 (exceeds 20 allowed). Consider refactoring.
          Open

          func (c *Cluster) UpdateService(serviceIDOrName string, version uint64, spec swarm.ServiceSpec, flags types.ServiceUpdateOptions, queryRegistry bool) (*swarm.ServiceUpdateResponse, error) {
              var resp *swarm.ServiceUpdateResponse
          
              err := c.lockedManagerAction(func(ctx context.Context, state nodeState) error {
                  err := c.populateNetworkID(ctx, state.controlClient, &spec)
          Severity: Minor
          Found in daemon/cluster/services.go - About 6 hrs 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