dotcloud/docker

View on GitHub

Showing 1,904 of 1,904 total issues

Function newAWSLogsClient has 68 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func newAWSLogsClient(info logger.Info, configOpts ...func(*config.LoadOptions) error) (*cloudwatchlogs.Client, error) {
    ctx := context.TODO()
    var region, endpoint *string
    if os.Getenv(regionEnvKey) != "" {
        region = aws.String(os.Getenv(regionEnvKey))
Severity: Minor
Found in daemon/logger/awslogs/cloudwatchlogs.go - About 1 hr to fix

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

    func delDummyLink(linkName string) error {
        // delete the vlan subinterface
        dummyLink, err := ns.NlHandle().LinkByName(linkName)
        if err != nil {
            return fmt.Errorf("failed to find link %s on the Docker host : %v", linkName, err)
    Severity: Major
    Found in libnetwork/drivers/ipvlan/ipvlan_setup.go and 1 other location - About 1 hr to fix
    libnetwork/drivers/macvlan/macvlan_setup.go on lines 185..202

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

    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

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

    func delDummyLink(linkName string) error {
        // delete the vlan subinterface
        dummyLink, err := ns.NlHandle().LinkByName(linkName)
        if err != nil {
            return fmt.Errorf("failed to find link %s on the Docker host : %v", linkName, err)
    Severity: Major
    Found in libnetwork/drivers/macvlan/macvlan_setup.go and 1 other location - About 1 hr to fix
    libnetwork/drivers/ipvlan/ipvlan_setup.go on lines 205..222

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

    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 (sr *swarmRouter) getNode(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
        node, err := sr.backend.GetNode(vars["id"])
        if err != nil {
            log.G(ctx).WithContext(ctx).WithFields(log.Fields{
                "error":   err,
    Severity: Major
    Found in api/server/router/swarm/cluster_routes.go and 1 other location - About 1 hr to fix
    api/server/router/swarm/cluster_routes.go on lines 405..416

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

    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 (sr *swarmRouter) getTask(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
        task, err := sr.backend.GetTask(vars["id"])
        if err != nil {
            log.G(ctx).WithContext(ctx).WithFields(log.Fields{
                "error":   err,
    Severity: Major
    Found in api/server/router/swarm/cluster_routes.go and 1 other location - About 1 hr to fix
    api/server/router/swarm/cluster_routes.go on lines 334..345

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

    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 (c *Cluster) GetNode(input string) (types.Node, error) {
        var node *swarmapi.Node
    
        if err := c.lockedManagerAction(func(ctx context.Context, state nodeState) error {
            n, err := getNode(ctx, state.controlClient, input)
    Severity: Major
    Found in daemon/cluster/nodes.go and 1 other location - About 1 hr to fix
    daemon/cluster/networks.go on lines 88..102

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

    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 (container *Container) CreateConfigSymlinks() error {
        for _, configRef := range container.ConfigReferences {
            if configRef.File == nil {
                continue
            }
    Severity: Major
    Found in container/container_windows.go and 1 other location - About 1 hr to fix
    container/container_windows.go on lines 40..58

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

    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 (container *Container) CreateSecretSymlinks() error {
        for _, r := range container.SecretReferences {
            if r.File == nil {
                continue
            }
    Severity: Major
    Found in container/container_windows.go and 1 other location - About 1 hr to fix
    container/container_windows.go on lines 90..108

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

    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 (c *Cluster) GetNetwork(input string) (network.Inspect, error) {
        var nw *swarmapi.Network
    
        if err := c.lockedManagerAction(func(ctx context.Context, state nodeState) error {
            n, err := getNetwork(ctx, state.controlClient, input)
    Severity: Major
    Found in daemon/cluster/networks.go and 1 other location - About 1 hr to fix
    daemon/cluster/nodes.go on lines 51..66

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

    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

    Function attemptBindHostPorts has 67 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func attemptBindHostPorts(
        cfg []portBindingReq,
        proto string,
        hostPortStart, hostPortEnd uint16,
        proxyPath string,
    Severity: Minor
    Found in libnetwork/drivers/bridge/port_mapping_linux.go - About 1 hr to fix

      Method linuxParser.validateMountConfigImpl has 67 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (p *linuxParser) validateMountConfigImpl(mnt *mount.Mount, validateBindSourceExists bool) error {
          if len(mnt.Target) == 0 {
              return &errMountConfig{mnt, errMissingField("Target")}
          }
      
      
      Severity: Minor
      Found in volume/mounts/linux_parser.go - About 1 hr to fix

        Method controller.Start has 67 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (r *controller) Start(ctx context.Context) error {
            if err := r.checkClosed(); err != nil {
                return err
            }
        
        
        Severity: Minor
        Found in daemon/cluster/executor/container/controller.go - About 1 hr to fix

          Function FilterNetworks has 67 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func FilterNetworks(nws []network.Inspect, filter filters.Args) ([]network.Inspect, error) {
              // if filter is empty, return original network list
              if filter.Len() == 0 {
                  return nws, nil
              }
          Severity: Minor
          Found in daemon/network/filter.go - About 1 hr to fix

            Method layerStore.RegisterByGraphID has 67 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (ls *layerStore) RegisterByGraphID(graphID string, parent ChainID, diffID DiffID, tarDataFile string, size int64) (Layer, error) {
                // err is used to hold the error which will always trigger
                // cleanup of creates sources but may not be an error returned
                // to the caller (already exists).
                var err error
            Severity: Minor
            Found in layer/migration.go - About 1 hr to fix

              Method puller.pullSchema2Layers has 18 return statements (exceeds 4 allowed).
              Open

              func (p *puller) pullSchema2Layers(ctx context.Context, target distribution.Descriptor, layers []distribution.Descriptor, platform *ocispec.Platform) (id digest.Digest, err error) {
                  if _, err := p.config.ImageStore.Get(ctx, target.Digest); err == nil {
                      // If the image already exists locally, no need to pull
                      // anything.
                      return target.Digest, nil
              Severity: Major
              Found in distribution/pull_v2.go - About 1 hr to fix

                Method Endpoint.sbJoin has 18 return statements (exceeds 4 allowed).
                Open

                func (ep *Endpoint) sbJoin(ctx context.Context, sb *Sandbox, options ...EndpointOption) (retErr error) {
                    ctx, span := otel.Tracer("").Start(ctx, "libnetwork.sbJoin")
                    defer span.End()
                
                    n, err := ep.getNetworkFromStore()
                Severity: Major
                Found in libnetwork/endpoint.go - About 1 hr to fix

                  Method GossipMessage.Unmarshal has 18 return statements (exceeds 4 allowed).
                  Open

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

                    Method driver.Join has 18 return statements (exceeds 4 allowed).
                    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.ipvlan.Join", trace.WithAttributes(
                            attribute.String("nid", nid),
                            attribute.String("eid", eid),
                            attribute.String("sboxKey", sboxKey)))
                    Severity: Major
                    Found in libnetwork/drivers/ipvlan/ipvlan_joinleave.go - About 1 hr to fix

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

                      func (c *Cluster) GetConfig(input string) (types.Config, error) {
                          var config *swarmapi.Config
                      
                          if err := c.lockedManagerAction(func(ctx context.Context, state nodeState) error {
                              s, err := getConfig(ctx, state.controlClient, input)
                      Severity: Major
                      Found in daemon/cluster/configs.go and 2 other locations - About 1 hr to fix
                      daemon/cluster/secrets.go on lines 14..28
                      daemon/cluster/volumes.go on lines 15..29

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

                      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 3 locations. Consider refactoring.
                      Open

                      func (c *Cluster) GetSecret(input string) (types.Secret, error) {
                          var secret *swarmapi.Secret
                      
                          if err := c.lockedManagerAction(func(ctx context.Context, state nodeState) error {
                              s, err := getSecret(ctx, state.controlClient, input)
                      Severity: Major
                      Found in daemon/cluster/secrets.go and 2 other locations - About 1 hr to fix
                      daemon/cluster/configs.go on lines 14..28
                      daemon/cluster/volumes.go on lines 15..29

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

                      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

                      Severity
                      Category
                      Status
                      Source
                      Language