docker/swarmkit

View on GitHub

Showing 1,820 of 1,820 total issues

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

func (m *NodeCertificateStatusResponse) CopyFrom(src interface{}) {

    o := src.(*NodeCertificateStatusResponse)
    *m = *o
    if o.Status != nil {
Severity: Major
Found in api/ca.pb.go and 3 other locations - About 1 hr to fix
api/logbroker.pb.go on lines 793..805
api/logbroker.pb.go on lines 848..860
api/watch.pb.go on lines 1203..1215

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

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

func (m *SubscribeLogsRequest) CopyFrom(src interface{}) {

    o := src.(*SubscribeLogsRequest)
    *m = *o
    if o.Selector != nil {
Severity: Major
Found in api/logbroker.pb.go and 3 other locations - About 1 hr to fix
api/ca.pb.go on lines 466..478
api/logbroker.pb.go on lines 848..860
api/watch.pb.go on lines 1203..1215

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

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 HealthCheckResponse.Unmarshal has 12 return statements (exceeds 4 allowed).
Open

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

    Function ConvertTaskWatch has 12 return statements (exceeds 4 allowed).
    Open

    func ConvertTaskWatch(action WatchActionKind, filters []*SelectBy) ([]Event, error) {
        var (
            m               Task
            checkFuncs      []TaskCheckFunc
            hasDesiredState bool
    Severity: Major
    Found in api/objects.pb.go - About 1 hr to fix

      Method ReplicatedService.Unmarshal has 12 return statements (exceeds 4 allowed).
      Open

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

        Method ResolveAddressRequest.Unmarshal has 12 return statements (exceeds 4 allowed).
        Open

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

          Method Dispatcher.processUpdates has 12 return statements (exceeds 4 allowed).
          Open

          func (d *Dispatcher) processUpdates(ctx context.Context) {
              var (
                  taskUpdates        map[string]*api.TaskStatus
                  nodeUpdates        map[string]nodeUpdate
                  unpublishedVolumes map[string][]string
          Severity: Major
          Found in manager/dispatcher/dispatcher.go - About 1 hr to fix

            Method Dispatcher.Session has 12 return statements (exceeds 4 allowed).
            Open

            func (d *Dispatcher) Session(r *api.SessionRequest, stream api.Dispatcher_SessionServer) error {
                d.rpcRW.RLock()
                defer d.rpcRW.RUnlock()
            
                dctx, err := d.isRunningLocked()
            Severity: Major
            Found in manager/dispatcher/dispatcher.go - About 1 hr to fix

              Method Server.checkPortConflicts has 12 return statements (exceeds 4 allowed).
              Open

              func (s *Server) checkPortConflicts(spec *api.ServiceSpec, serviceID string) error {
                  if spec.Endpoint == nil {
                      return nil
                  }
              
              
              Severity: Major
              Found in manager/controlapi/service.go - About 1 hr to fix

                Method Server.RemoveNode has 12 return statements (exceeds 4 allowed).
                Open

                func (s *Server) RemoveNode(ctx context.Context, request *api.RemoveNodeRequest) (*api.RemoveNodeResponse, error) {
                    if request.NodeID == "" {
                        return nil, status.Errorf(codes.InvalidArgument, errInvalidArgument.Error())
                    }
                
                
                Severity: Major
                Found in manager/controlapi/node.go - About 1 hr to fix

                  Method Node.Join has 12 return statements (exceeds 4 allowed).
                  Open

                  func (n *Node) Join(ctx context.Context, req *api.JoinRequest) (*api.JoinResponse, error) {
                      nodeInfo, err := ca.RemoteNode(ctx)
                      if err != nil {
                          return nil, err
                      }
                  Severity: Major
                  Found in manager/state/raft/raft.go - About 1 hr to fix

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

                    func filterClusters(candidates []*api.Cluster, filters ...func(*api.Cluster) bool) []*api.Cluster {
                        result := []*api.Cluster{}
                    
                        for _, c := range candidates {
                            match := true
                    Severity: Major
                    Found in manager/controlapi/cluster.go and 5 other locations - About 1 hr to fix
                    manager/controlapi/network.go on lines 236..253
                    manager/controlapi/node.go on lines 59..76
                    manager/controlapi/service.go on lines 960..977
                    manager/controlapi/task.go on lines 55..72
                    manager/controlapi/volume.go on lines 204..220

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

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

                    func filterServices(candidates []*api.Service, filters ...func(*api.Service) bool) []*api.Service {
                        result := []*api.Service{}
                    
                        for _, c := range candidates {
                            match := true
                    Severity: Major
                    Found in manager/controlapi/service.go and 5 other locations - About 1 hr to fix
                    manager/controlapi/cluster.go on lines 186..203
                    manager/controlapi/network.go on lines 236..253
                    manager/controlapi/node.go on lines 59..76
                    manager/controlapi/task.go on lines 55..72
                    manager/controlapi/volume.go on lines 204..220

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

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

                    func filterNodes(candidates []*api.Node, filters ...func(*api.Node) bool) []*api.Node {
                        result := []*api.Node{}
                    
                        for _, c := range candidates {
                            match := true
                    Severity: Major
                    Found in manager/controlapi/node.go and 5 other locations - About 1 hr to fix
                    manager/controlapi/cluster.go on lines 186..203
                    manager/controlapi/network.go on lines 236..253
                    manager/controlapi/service.go on lines 960..977
                    manager/controlapi/task.go on lines 55..72
                    manager/controlapi/volume.go on lines 204..220

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

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

                    func filterTasks(candidates []*api.Task, filters ...func(*api.Task) bool) []*api.Task {
                        result := []*api.Task{}
                    
                        for _, c := range candidates {
                            match := true
                    Severity: Major
                    Found in manager/controlapi/task.go and 5 other locations - About 1 hr to fix
                    manager/controlapi/cluster.go on lines 186..203
                    manager/controlapi/network.go on lines 236..253
                    manager/controlapi/node.go on lines 59..76
                    manager/controlapi/service.go on lines 960..977
                    manager/controlapi/volume.go on lines 204..220

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

                    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

                            case 10:
                                if wireType != 0 {
                                    return fmt.Errorf("proto: wrong wireType = %d for field DesiredState", wireType)
                                }
                                var v TaskState
                    Severity: Major
                    Found in api/watch.pb.go and 2 other locations - About 1 hr to fix
                    api/watch.pb.go on lines 4071..4090
                    api/watch.pb.go on lines 4091..4110

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

                    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

                            case 11:
                                if wireType != 0 {
                                    return fmt.Errorf("proto: wrong wireType = %d for field Role", wireType)
                                }
                                var v NodeRole
                    Severity: Major
                    Found in api/watch.pb.go and 2 other locations - About 1 hr to fix
                    api/watch.pb.go on lines 4051..4070
                    api/watch.pb.go on lines 4091..4110

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

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

                    func filterNetworks(candidates []*api.Network, filters ...func(*api.Network) bool) []*api.Network {
                        result := []*api.Network{}
                    
                        for _, c := range candidates {
                            match := true
                    Severity: Major
                    Found in manager/controlapi/network.go and 5 other locations - About 1 hr to fix
                    manager/controlapi/cluster.go on lines 186..203
                    manager/controlapi/node.go on lines 59..76
                    manager/controlapi/service.go on lines 960..977
                    manager/controlapi/task.go on lines 55..72
                    manager/controlapi/volume.go on lines 204..220

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

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

                    func filterVolumes(candidates []*api.Volume, filters ...func(*api.Volume) bool) []*api.Volume {
                        result := []*api.Volume{}
                        for _, c := range candidates {
                            match := true
                            for _, f := range filters {
                    Severity: Major
                    Found in manager/controlapi/volume.go and 5 other locations - About 1 hr to fix
                    manager/controlapi/cluster.go on lines 186..203
                    manager/controlapi/network.go on lines 236..253
                    manager/controlapi/node.go on lines 59..76
                    manager/controlapi/service.go on lines 960..977
                    manager/controlapi/task.go on lines 55..72

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

                    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

                            case 12:
                                if wireType != 0 {
                                    return fmt.Errorf("proto: wrong wireType = %d for field Membership", wireType)
                                }
                                var v NodeSpec_Membership
                    Severity: Major
                    Found in api/watch.pb.go and 2 other locations - About 1 hr to fix
                    api/watch.pb.go on lines 4051..4070
                    api/watch.pb.go on lines 4071..4090

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

                    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