dotcloud/docker

View on GitHub

Showing 1,904 of 1,904 total issues

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

        task.Status.PortStatus.Ports = append(task.Status.PortStatus.Ports, types.PortConfig{
            Name:          p.Name,
            Protocol:      types.PortConfigProtocol(strings.ToLower(swarmapi.PortConfig_Protocol_name[int32(p.Protocol)])),
            PublishMode:   types.PortConfigPublishMode(strings.ToLower(swarmapi.PortConfig_PublishMode_name[int32(p.PublishMode)])),
            TargetPort:    p.TargetPort,
Severity: Minor
Found in daemon/cluster/convert/task.go and 1 other location - About 40 mins to fix
daemon/cluster/convert/network.go on lines 130..136

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

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) storeDelete(kvObject datastore.KVObject) error {
    if d.store == nil {
        log.G(context.TODO()).Debugf("bridge store not initialized. kv object %s is not deleted from store", datastore.Key(kvObject.Key()...))
        return nil
    }
Severity: Minor
Found in libnetwork/drivers/bridge/bridge_store.go and 1 other location - About 40 mins to fix
libnetwork/drivers/windows/windows_store.go on lines 111..118

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

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) storeDelete(kvObject datastore.KVObject) error {
    if d.store == nil {
        log.G(context.TODO()).Debugf("store not initialized. kv object %s is not deleted from store", datastore.Key(kvObject.Key()...))
        return nil
    }
Severity: Minor
Found in libnetwork/drivers/windows/windows_store.go and 1 other location - About 40 mins to fix
libnetwork/drivers/bridge/bridge_store.go on lines 118..125

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

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 NewTarExporter has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

func NewTarExporter(is image.Store, lss layer.Store, rs refstore.Store, loggerImgEvent LogImageEvent, platform *ocispec.Platform) image.Exporter {
Severity: Minor
Found in image/tarexport/tarexport.go - About 35 mins to fix

    Method Manager.Push has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    func (pm *Manager) Push(ctx context.Context, name string, metaHeader http.Header, authConfig *registry.AuthConfig, outStream io.Writer) error {
    Severity: Minor
    Found in plugin/backend_linux.go - About 35 mins to fix

      Function Mount has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      func Mount(source string, target string, fstype string, flags uintptr, data string) (err error) {
      Severity: Minor
      Found in internal/unix_noeintr/fs_unix.go - About 35 mins to fix

        Method Manager.newResolver has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        func (pm *Manager) newResolver(ctx context.Context, tracker docker.StatusTracker, auth *registry.AuthConfig, headers http.Header, httpFallback bool) (remotes.Resolver, error) {
        Severity: Minor
        Found in plugin/registry.go - About 35 mins to fix

          Method manifestStore.Put has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          func (m *manifestStore) Put(ctx context.Context, manifest distribution.Manifest, desc ocispec.Descriptor, w content.Writer, ref reference.Named) error {
          Severity: Minor
          Found in distribution/manifest.go - About 35 mins to fix

            Method Manager.Push has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            func (pm *Manager) Push(ctx context.Context, name string, metaHeader http.Header, authConfig *registry.AuthConfig, out io.Writer) error {
            Severity: Minor
            Found in plugin/backend_unsupported.go - About 35 mins to fix

              Function checkTable has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              func checkTable(ctx context.Context, ips []string, port, networkName, tableName string, expectedEntries int, fn func(string, string, string, string, chan resultTuple)) (opTime time.Duration) {
              Severity: Minor
              Found in libnetwork/cmd/networkdb-test/dbclient/ndbClient.go - About 35 mins to fix

                Function addEpToResolver has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    ctx context.Context,
                    netName, epName string,
                    config *containerConfig,
                    epIface *EndpointInterface,
                    resolvers []*Resolver,
                Severity: Minor
                Found in libnetwork/network_windows.go - About 35 mins to fix

                  Function addEpToResolver has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      ctx context.Context,
                      netName, epName string,
                      config *containerConfig,
                      epIface *EndpointInterface,
                      resolvers []*Resolver,
                  Severity: Minor
                  Found in libnetwork/network_unix.go - About 35 mins to fix

                    Method NetworkDB.sendTableEvent has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    func (nDB *NetworkDB) sendTableEvent(event TableEvent_Type, nid string, tname string, key string, entry *entry) error {
                    Severity: Minor
                    Found in libnetwork/networkdb/broadcast.go - About 35 mins to fix

                      Function makeServiceCleanupFunc has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      func makeServiceCleanupFunc(c *Controller, s *service, nID, eID string, vip net.IP, ip net.IP) func() {
                      Severity: Minor
                      Found in libnetwork/service_common.go - About 35 mins to fix

                        Method ChainInfo.Link has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        func (c *ChainInfo) Link(action Action, ip1, ip2 net.IP, port int, proto string, bridgeName string) error {
                        Severity: Minor
                        Found in libnetwork/iptables/iptables.go - About 35 mins to fix

                          Method Controller.rmServiceBinding has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          func (c *Controller) rmServiceBinding(name, sid, nid, eid string, vip net.IP, ingressPorts []*PortConfig, aliases []string, ip net.IP) error {
                          Severity: Minor
                          Found in libnetwork/service_unsupported.go - About 35 mins to fix

                            Method Controller.addServiceBinding has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                            func (c *Controller) addServiceBinding(name, sid, nid, eid string, vip net.IP, ingressPorts []*PortConfig, aliases []string, ip net.IP) error {
                            Severity: Minor
                            Found in libnetwork/service_unsupported.go - About 35 mins to fix

                              Function getAddress has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                              func getAddress(base netip.Prefix, bitmask *bitmap.Bitmap, prefAddress netip.Addr, ipr netip.Prefix, serial bool) (netip.Addr, error) {
                              Severity: Minor
                              Found in libnetwork/ipams/defaultipam/allocator.go - About 35 mins to fix

                                Function addEpToResolverImpl has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                    ctx context.Context,
                                    netName, epName string,
                                    epIface *EndpointInterface,
                                    resolvers []*Resolver,
                                    hnsEndpoints []hcsshim.HNSEndpoint,
                                Severity: Minor
                                Found in libnetwork/network_windows.go - About 35 mins to fix

                                  Function fetchTable has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                  func fetchTable(ip string, port int, network, tableName string, clusterPeers, networkPeers map[string]string, remediate bool) {
                                  Severity: Minor
                                  Found in libnetwork/cmd/diagnostic/main.go - About 35 mins to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language