dotcloud/docker

View on GitHub

Showing 1,904 of 1,904 total issues

Method driver.createNetwork has 60 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (d *driver) createNetwork(config *configuration) (bool, error) {
    foundExisting := false
    networkList := d.getNetworks()
    for _, nw := range networkList {
        if config.Parent == nw.config.Parent {
Severity: Minor
Found in libnetwork/drivers/macvlan/macvlan_network.go - About 1 hr to fix

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

    func (d *driver) Join(_ context.Context, nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, options map[string]interface{}) (retErr error) {
        join := &api.JoinRequest{
            NetworkID:  nid,
            EndpointID: eid,
            SandboxKey: sboxKey,
    Severity: Minor
    Found in libnetwork/drivers/remote/driver.go - About 1 hr to fix

      Method Resolver.forwardExtDNS has 60 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (r *Resolver) forwardExtDNS(ctx context.Context, proto string, remoteAddr net.Addr, query *dns.Msg) *dns.Msg {
          ctx, span := otel.Tracer("").Start(ctx, "resolver.forwardExtDNS")
          defer span.End()
      
          proxyDNS := r.proxyDNS.Load()
      Severity: Minor
      Found in libnetwork/resolver.go - About 1 hr to fix

        Method controller.Logs has 60 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

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

          Method Info.ExtraAttributes has 60 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (info *Info) ExtraAttributes(keyMod func(string) string) (map[string]string, error) {
              extra := make(map[string]string)
              labels, ok := info.Config["labels"]
              if ok && len(labels) > 0 {
                  for _, l := range strings.Split(labels, ",") {
          Severity: Minor
          Found in daemon/logger/loginfo.go - About 1 hr to fix

            Function ensureHTTPServerImage has 60 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func ensureHTTPServerImage(t testing.TB) {
                t.Helper()
                var doIt bool
                ensureHTTPServerOnce.Do(func() {
                    doIt = true
            Severity: Minor
            Found in testutil/fakestorage/fixtures.go - About 1 hr to fix

              Method layerStore.CreateRWLayer has 60 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func (ls *layerStore) CreateRWLayer(name string, parent ChainID, opts *CreateRWLayerOpts) (_ RWLayer, err error) {
                  var (
                      storageOpt map[string]string
                      initFunc   MountInit
                      mountLabel string
              Severity: Minor
              Found in layer/layer_store.go - About 1 hr to fix

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

                        case ipcMode.IsContainer():
                            ic, err := daemon.getIPCContainer(ipcMode.Container())
                            if err != nil {
                                return errors.Wrap(err, "failed to join IPC namespace")
                            }
                Severity: Major
                Found in daemon/oci_linux.go and 1 other location - About 1 hr to fix
                daemon/oci_linux.go on lines 344..361

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

                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

                    go func() {
                        log.G(context.TODO()).Debugf("metrics API listening on %s", l.Addr())
                        srv := &http.Server{
                            Handler:           mux,
                            ReadHeaderTimeout: 5 * time.Minute, // "G112: Potential Slowloris Attack (gosec)"; not a real concern for our use, so setting a long timeout.
                Severity: Major
                Found in daemon/metrics_unix.go and 1 other location - About 1 hr to fix
                cmd/dockerd/metrics.go on lines 27..36

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

                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

                    go func() {
                        log.G(context.TODO()).Infof("metrics API listening on %s", l.Addr())
                        srv := &http.Server{
                            Handler:           mux,
                            ReadHeaderTimeout: 5 * time.Minute, // "G112: Potential Slowloris Attack (gosec)"; not a real concern for our use, so setting a long timeout.
                Severity: Major
                Found in cmd/dockerd/metrics.go and 1 other location - About 1 hr to fix
                daemon/metrics_unix.go on lines 34..43

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

                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

                        case pidMode.IsContainer():
                            pc, err := daemon.getPIDContainer(pidMode.Container())
                            if err != nil {
                                return errors.Wrap(err, "failed to join PID namespace")
                            }
                Severity: Major
                Found in daemon/oci_linux.go and 1 other location - About 1 hr to fix
                daemon/oci_linux.go on lines 308..325

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

                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

                        if ok := parentExists(n.config.Parent); ok {
                            // only delete the link if it is named the net_id
                            if n.config.Parent == getDummyName(nid) {
                                err := delDummyLink(n.config.Parent)
                                if err != nil {
                Severity: Major
                Found in libnetwork/drivers/ipvlan/ipvlan_network.go and 1 other location - About 1 hr to fix
                libnetwork/drivers/macvlan/macvlan_network.go on lines 156..172

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

                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

                    if n.config.CreatedSlaveLink && parentExists(n.config.Parent) && d.parentHasSingleUser(n) {
                        // only delete the link if it is named the net_id
                        if n.config.Parent == getDummyName(nid) {
                            err := delDummyLink(n.config.Parent)
                            if err != nil {
                Severity: Major
                Found in libnetwork/drivers/macvlan/macvlan_network.go and 1 other location - About 1 hr to fix
                libnetwork/drivers/ipvlan/ipvlan_network.go on lines 135..151

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

                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 puller.pullSchema1 has 59 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (p *puller) pullSchema1(ctx context.Context, ref reference.Reference, unverifiedManifest *schema1.SignedManifest, platform *ocispec.Platform) (id digest.Digest, manifestDigest digest.Digest, err error) {
                    if platform != nil {
                        // Early bath if the requested OS doesn't match that of the configuration.
                        // This avoids doing the download, only to potentially fail later.
                        if err := image.CheckOS(platform.OS); err != nil {
                Severity: Minor
                Found in distribution/pull_v2.go - About 1 hr to fix

                  Function toRootless has 59 lines of code (exceeds 50 allowed). Consider refactoring.
                  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: Minor
                  Found in internal/rootless/specconv/specconv_linux.go - About 1 hr to fix

                    Function fetchTable has 59 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func fetchTable(ip string, port int, network, tableName string, clusterPeers, networkPeers map[string]string, remediate bool) {
                        log.G(context.TODO()).Infof("Fetch %s table and check owners", tableName)
                        resp, err := http.Get(fmt.Sprintf(dumpTable, ip, port, network, tableName))
                        if err != nil {
                            log.G(context.TODO()).WithError(err).Fatalf("Failed fetching endpoint table")
                    Severity: Minor
                    Found in libnetwork/cmd/diagnostic/main.go - About 1 hr to fix

                      Function JobComplete has 59 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func JobComplete(ctx context.Context, client client.CommonAPIClient, service swarmtypes.Service) func(log poll.LogT) poll.Result {
                          filter := filters.NewArgs(filters.Arg("service", service.ID))
                      
                          var jobIteration swarmtypes.Version
                          if service.JobStatus != nil {
                      Severity: Minor
                      Found in integration/internal/swarm/states.go - About 1 hr to fix

                        Method driver.parseNetworkOptions has 59 lines of code (exceeds 50 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 1 hr to fix

                          Function WithDevices has 59 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func WithDevices(daemon *Daemon, c *container.Container) coci.SpecOpts {
                              return func(ctx context.Context, _ coci.Client, _ *containers.Container, s *coci.Spec) error {
                                  // Build lists of devices allowed and created within the container.
                                  var devs []specs.LinuxDevice
                                  devPermissions := s.Linux.Resources.Devices
                          Severity: Minor
                          Found in daemon/oci_linux.go - About 1 hr to fix

                            Function TaskFromGRPC has 59 lines of code (exceeds 50 allowed). Consider refactoring.
                            Open

                            func TaskFromGRPC(t swarmapi.Task) (types.Task, error) {
                                containerStatus := t.Status.GetContainer()
                                taskSpec, err := taskSpecFromGRPC(t.Spec)
                                if err != nil {
                                    return types.Task{}, err
                            Severity: Minor
                            Found in daemon/cluster/convert/task.go - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language