dotcloud/docker

View on GitHub

Showing 1,904 of 1,904 total issues

Method tarexporter.legacyLoadImage has 82 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (l *tarexporter) legacyLoadImage(oldID, sourceDir string, loadedMap map[string]image.ID, progressOutput progress.Output) error {
    if _, loaded := loadedMap[oldID]; loaded {
        return nil
    }
    configPath, err := safePath(sourceDir, filepath.Join(oldID, legacyConfigFileName))
Severity: Major
Found in image/tarexport/load.go - About 2 hrs to fix

    Method EndpointRecord.MarshalToSizedBuffer has 82 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (m *EndpointRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) {
        i := len(dAtA)
        _ = i
        var l int
        _ = l
    Severity: Major
    Found in libnetwork/agent.pb.go - About 2 hrs to fix

      Method driver.Join has 82 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (d *driver) Join(ctx context.Context, nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, options map[string]interface{}) error {
          ctx, span := otel.Tracer("").Start(ctx, "libnetwork.drivers.macvlan.Join", trace.WithAttributes(
              attribute.String("nid", nid),
              attribute.String("eid", eid),
              attribute.String("sboxKey", sboxKey)))
      Severity: Major
      Found in libnetwork/drivers/macvlan/macvlan_joinleave.go - About 2 hrs to fix

        Method systemRouter.getDiskUsage has 82 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (s *systemRouter) getDiskUsage(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
            if err := httputils.ParseForm(r); err != nil {
                return err
            }
        
        
        Severity: Major
        Found in api/server/router/system/system_routes.go - About 2 hrs to fix

          Method executor.Configure has 82 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (e *executor) Configure(ctx context.Context, node *api.Node) error {
              var ingressNA *api.NetworkAttachment
              attachments := make(map[string]string)
          
              for _, na := range node.Attachments {
          Severity: Major
          Found in daemon/cluster/executor/container/executor.go - About 2 hrs to fix

            Method ImageService.ImageDelete has 82 lines of code (exceeds 50 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: Major
            Found in daemon/images/image_delete.go - About 2 hrs to fix

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

                  if dir&reverse > 0 {
                      rSA = &netlink.XfrmState{
                          Src:   remoteIP,
                          Dst:   localIP,
                          Proto: netlink.XFRM_PROTO_ESP,
              Severity: Major
              Found in libnetwork/drivers/overlay/encryption.go and 1 other location - About 2 hrs to fix
              libnetwork/drivers/overlay/encryption.go on lines 344..368

              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 206.

              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 *Daemon) CheckServiceTasksInStateWithError(ctx context.Context, service string, state swarm.TaskState, errorMessage string) func(*testing.T) (interface{}, string) {
                  return func(c *testing.T) (interface{}, string) {
                      tasks := d.GetServiceTasks(ctx, c, service)
                      var count int
                      for _, task := range tasks {
              Severity: Major
              Found in integration-cli/daemon/daemon_swarm.go and 1 other location - About 2 hrs to fix
              integration-cli/daemon/daemon_swarm.go on lines 18..31

              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 206.

              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

                  if dir&forward > 0 {
                      fSA = &netlink.XfrmState{
                          Src:   localIP,
                          Dst:   remoteIP,
                          Proto: netlink.XFRM_PROTO_ESP,
              Severity: Major
              Found in libnetwork/drivers/overlay/encryption.go and 1 other location - About 2 hrs to fix
              libnetwork/drivers/overlay/encryption.go on lines 318..342

              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 206.

              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 *Daemon) CheckServiceTasksInState(ctx context.Context, service string, state swarm.TaskState, message string) func(*testing.T) (interface{}, string) {
                  return func(c *testing.T) (interface{}, string) {
                      tasks := d.GetServiceTasks(ctx, c, service)
                      var count int
                      for _, task := range tasks {
              Severity: Major
              Found in integration-cli/daemon/daemon_swarm.go and 1 other location - About 2 hrs to fix
              integration-cli/daemon/daemon_swarm.go on lines 35..48

              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 206.

              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 services.go has 511 lines of code (exceeds 500 allowed). Consider refactoring.
              Open

              package cluster // import "github.com/docker/docker/daemon/cluster"
              
              import (
                  "context"
                  "encoding/base64"
              Severity: Minor
              Found in daemon/cluster/services.go - About 2 hrs to fix

                File swarm.go has 511 lines of code (exceeds 500 allowed). Consider refactoring.
                Open

                package cluster // import "github.com/docker/docker/daemon/cluster"
                
                import (
                    "context"
                    "fmt"
                Severity: Minor
                Found in daemon/cluster/swarm.go - About 2 hrs to fix

                  Function pullEndpoints has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func pullEndpoints(ctx context.Context, registryService RegistryResolver, ref reference.Named,
                      f func(context.Context, registry.RepositoryInfo, registry.APIEndpoint) error,
                  ) (*registry.RepositoryInfo, error) {
                      // Resolve the Repository name from fqn to RepositoryInfo
                      repoInfo, err := registryService.ResolveRepository(ref)
                  Severity: Minor
                  Found in distribution/pull.go - About 2 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 LayerDownloadManager.makeDownloadFuncFromDownload has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func (ldm *LayerDownloadManager) makeDownloadFuncFromDownload(descriptor DownloadDescriptor, sourceDownload *downloadTransfer, parentDownload *downloadTransfer) doFunc {
                      return func(progressChan chan<- progress.Progress, start <-chan struct{}, inactive chan<- struct{}) transfer {
                          d := &downloadTransfer{
                              transfer:   newTransfer(),
                              layerStore: ldm.layerStore,
                  Severity: Minor
                  Found in distribution/xfer/download.go - About 2 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 NetworkPushPull.Unmarshal has 25 return statements (exceeds 4 allowed).
                  Open

                  func (m *NetworkPushPull) Unmarshal(dAtA []byte) error {
                      l := len(dAtA)
                      iNdEx := 0
                      for iNdEx < l {
                          preIndex := iNdEx
                  Severity: Major
                  Found in libnetwork/networkdb/networkdb.pb.go - About 2 hrs to fix

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

                    func (d *driver) CreateEndpoint(ctx context.Context, nid, eid string, ifInfo driverapi.InterfaceInfo, epOptions map[string]interface{}) error {
                        ctx, span := otel.Tracer("").Start(ctx, fmt.Sprintf("libnetwork.drivers.windows_%s.CreateEndpoint", d.name), trace.WithAttributes(
                            attribute.String("nid", nid),
                            attribute.String("eid", eid)))
                        defer span.End()
                    Severity: Minor
                    Found in libnetwork/drivers/windows/windows.go - About 2 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 VolumeStore.restore has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring.
                    Open

                    func (s *VolumeStore) restore() {
                        var ls []volumeMetadata
                        s.db.View(func(tx *bolt.Tx) error {
                            ls = listMeta(tx)
                            return nil
                    Severity: Minor
                    Found in volume/service/restore.go - About 2 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

                    Function withCgroups has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring.
                    Open

                    func withCgroups(daemon *Daemon, daemonCfg *dconfig.Config, c *container.Container) coci.SpecOpts {
                        return func(ctx context.Context, _ coci.Client, _ *containers.Container, s *coci.Spec) error {
                            var cgroupsPath string
                            scopePrefix := "docker"
                            parent := "/docker"
                    Severity: Minor
                    Found in daemon/oci_linux.go - About 2 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

                    Function withCommonOptions has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring.
                    Open

                    func withCommonOptions(daemon *Daemon, daemonCfg *dconfig.Config, c *container.Container) coci.SpecOpts {
                        return func(ctx context.Context, _ coci.Client, _ *containers.Container, s *coci.Spec) error {
                            if c.BaseFS == "" {
                                return errors.New("populateCommonSpec: BaseFS of container " + c.ID + " is unexpectedly empty")
                            }
                    Severity: Minor
                    Found in daemon/oci_linux.go - About 2 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 logStream.collectBatch has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring.
                    Open

                    func (l *logStream) collectBatch(created chan bool) {
                        // Wait for the logstream/group to be created
                        <-created
                        flushInterval := l.forceFlushInterval
                        if flushInterval <= 0 {
                    Severity: Minor
                    Found in daemon/logger/awslogs/cloudwatchlogs.go - About 2 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