dotcloud/docker

View on GitHub

Showing 1,904 of 1,904 total issues

Method layerStore.loadMount has 6 return statements (exceeds 4 allowed).
Open

func (ls *layerStore) loadMount(mount string) error {
    ls.mountL.Lock()
    defer ls.mountL.Unlock()
    if _, ok := ls.mounts[mount]; ok {
        return nil
Severity: Major
Found in layer/layer_store.go - About 40 mins to fix

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

    func (m *Middleware) WrapHandler(handler func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error) func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
        return func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
            plugins := m.getAuthzPlugins()
            if len(plugins) == 0 {
                return handler(ctx, w, r, vars)
    Severity: Major
    Found in pkg/authorization/middleware.go and 3 other locations - About 40 mins to fix
    api/server/middleware/debug.go on lines 17..55
    api/server/middleware/experimental.go on lines 23..28
    api/server/middleware/version.go on lines 67..86

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

    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 NewTailReaderWithDelimiter has 6 return statements (exceeds 4 allowed).
    Open

    func NewTailReaderWithDelimiter(ctx context.Context, r SizeReaderAt, reqLines int, delimiter []byte) (*io.SectionReader, int, error) {
        if reqLines < 1 {
            return nil, 0, ErrNonPositiveLinesNumber
        }
        if len(delimiter) == 0 {
    Severity: Major
    Found in pkg/tailfile/tailfile.go - About 40 mins to fix

      Method layerStore.CreateRWLayer has 6 return statements (exceeds 4 allowed).
      Open

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

        Function GetLayerPath has 6 return statements (exceeds 4 allowed).
        Open

        func GetLayerPath(s Store, layer ChainID) (string, error) {
            ls, ok := s.(*layerStore)
            if !ok {
                return "", errors.New("unsupported layer store")
            }
        Severity: Major
        Found in layer/layer_windows.go - About 40 mins to fix

          Function storeLayer has 6 return statements (exceeds 4 allowed).
          Open

          func storeLayer(tx *fileMetadataTransaction, layer *roLayer) error {
              if err := tx.SetDiffID(layer.diffID); err != nil {
                  return err
              }
              if err := tx.SetSize(layer.size); err != nil {
          Severity: Major
          Found in layer/ro_layer.go - About 40 mins to fix

            Method Daemon.containerStop has 6 return statements (exceeds 4 allowed).
            Open

            func (daemon *Daemon) containerStop(ctx context.Context, ctr *container.Container, options containertypes.StopOptions) (retErr error) {
                // Cancelling the request should not cancel the stop.
                ctx = context.WithoutCancel(ctx)
            
                if !ctr.IsRunning() {
            Severity: Major
            Found in daemon/stop.go - About 40 mins to fix

              Function parseExpr has 6 return statements (exceeds 4 allowed).
              Open

              func parseExpr(e ast.Expr) (parsedExpr, error) {
                  var parsed parsedExpr
                  switch i := e.(type) {
                  case *ast.Ident:
                      parsed.value += i.Name
              Severity: Major
              Found in pkg/plugins/pluginrpc-gen/parser.go - About 40 mins to fix

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

                func (v VersionMiddleware) WrapHandler(handler func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error) func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
                    return func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
                        w.Header().Set("Server", fmt.Sprintf("Docker/%s (%s)", v.serverVersion, runtime.GOOS))
                        w.Header().Set("API-Version", v.defaultAPIVersion)
                        w.Header().Set("OSType", runtime.GOOS)
                Severity: Major
                Found in api/server/middleware/version.go and 3 other locations - About 40 mins to fix
                api/server/middleware/debug.go on lines 17..55
                api/server/middleware/experimental.go on lines 23..28
                pkg/authorization/middleware.go on lines 55..110

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

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

                func DebugRequestMiddleware(handler func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error) func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
                    return func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
                        log.G(ctx).Debugf("Calling %s %s", r.Method, r.RequestURI)
                
                        if r.Method != http.MethodPost {
                Severity: Major
                Found in api/server/middleware/debug.go and 3 other locations - About 40 mins to fix
                api/server/middleware/experimental.go on lines 23..28
                api/server/middleware/version.go on lines 67..86
                pkg/authorization/middleware.go on lines 55..110

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

                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

                    for i := 0; i < b.N; i++ {
                        arch, err := driver.Diff(base, "")
                        if err != nil {
                            b.Fatal(err)
                        }
                Severity: Major
                Found in daemon/graphdriver/graphtest/graphbench_unix.go and 2 other locations - About 40 mins to fix
                daemon/graphdriver/graphtest/graphbench_unix.go on lines 110..120
                daemon/graphdriver/graphtest/graphbench_unix.go on lines 209..219

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

                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

                    for i := 0; i < b.N; i++ {
                        arch, err := driver.Diff(upper, "")
                        if err != nil {
                            b.Fatal(err)
                        }
                Severity: Major
                Found in daemon/graphdriver/graphtest/graphbench_unix.go and 2 other locations - About 40 mins to fix
                daemon/graphdriver/graphtest/graphbench_unix.go on lines 74..84
                daemon/graphdriver/graphtest/graphbench_unix.go on lines 209..219

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

                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

                    for i := 0; i < b.N; i++ {
                        arch, err := driver.Diff(topLayer, "")
                        if err != nil {
                            b.Fatal(err)
                        }
                Severity: Major
                Found in daemon/graphdriver/graphtest/graphbench_unix.go and 2 other locations - About 40 mins to fix
                daemon/graphdriver/graphtest/graphbench_unix.go on lines 74..84
                daemon/graphdriver/graphtest/graphbench_unix.go on lines 110..120

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

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

                package system // import "github.com/docker/docker/pkg/system"
                
                import "syscall"
                
                // fromStatT converts a syscall.Stat_t type to a system.Stat_t type
                Severity: Major
                Found in pkg/system/stat_openbsd.go and 3 other locations - About 40 mins to fix
                pkg/system/stat_bsd.go on lines 1..17
                pkg/system/stat_darwin.go on lines 1..15
                pkg/system/stat_illumos.go on lines 1..15

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

                //go:build freebsd || netbsd
                
                package system // import "github.com/docker/docker/pkg/system"
                
                import "syscall"
                Severity: Major
                Found in pkg/system/stat_bsd.go and 3 other locations - About 40 mins to fix
                pkg/system/stat_darwin.go on lines 1..15
                pkg/system/stat_illumos.go on lines 1..15
                pkg/system/stat_openbsd.go on lines 1..15

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

                package system // import "github.com/docker/docker/pkg/system"
                
                import "syscall"
                
                // fromStatT converts a syscall.Stat_t type to a system.Stat_t type
                Severity: Major
                Found in pkg/system/stat_illumos.go and 3 other locations - About 40 mins to fix
                pkg/system/stat_bsd.go on lines 1..17
                pkg/system/stat_darwin.go on lines 1..15
                pkg/system/stat_openbsd.go on lines 1..15

                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

                    return types.PortConfig{
                        Name:          portConfig.Name,
                        Protocol:      types.PortConfigProtocol(strings.ToLower(swarmapi.PortConfig_Protocol_name[int32(portConfig.Protocol)])),
                        PublishMode:   types.PortConfigPublishMode(strings.ToLower(swarmapi.PortConfig_PublishMode_name[int32(portConfig.PublishMode)])),
                        TargetPort:    portConfig.TargetPort,
                Severity: Minor
                Found in daemon/cluster/convert/network.go and 1 other location - About 40 mins to fix
                daemon/cluster/convert/task.go on lines 76..82

                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) DiscoverDelete(dType discoverapi.DiscoveryType, data interface{}) error {
                    if dType != discoverapi.NodeDiscovery {
                        return nil
                    }
                    notif := &api.DiscoveryNotification{
                Severity: Minor
                Found in libnetwork/drivers/remote/driver.go and 1 other location - About 40 mins to fix
                libnetwork/drivers/remote/driver.go on lines 374..383

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

                package system // import "github.com/docker/docker/pkg/system"
                
                import "syscall"
                
                // fromStatT converts a syscall.Stat_t type to a system.Stat_t type
                Severity: Major
                Found in pkg/system/stat_darwin.go and 3 other locations - About 40 mins to fix
                pkg/system/stat_bsd.go on lines 1..17
                pkg/system/stat_illumos.go on lines 1..15
                pkg/system/stat_openbsd.go on lines 1..15

                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) DiscoverNew(dType discoverapi.DiscoveryType, data interface{}) error {
                    if dType != discoverapi.NodeDiscovery {
                        return nil
                    }
                    notif := &api.DiscoveryNotification{
                Severity: Minor
                Found in libnetwork/drivers/remote/driver.go and 1 other location - About 40 mins to fix
                libnetwork/drivers/remote/driver.go on lines 386..395

                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

                Severity
                Category
                Status
                Source
                Language