docker/swarmkit

View on GitHub

Showing 1,820 of 1,820 total issues

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

    hasNoIPOverlapServices := func(fakeT assert.TestingT, service *api.Service) bool {
        assert.NotEqual(fakeT, len(service.Endpoint.VirtualIPs), 0)
        assert.NotEqual(fakeT, len(service.Endpoint.VirtualIPs[0].Addr), 0)
        assignedVIP := service.Endpoint.VirtualIPs[0].Addr
        if assignedIPs[assignedVIP] {
Severity: Major
Found in manager/allocator/allocator_test_suite.go and 1 other location - About 2 hrs to fix
manager/allocator/allocator_test_suite.go on lines 1164..1177

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

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 ServiceSpec.MarshalToSizedBuffer has 84 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (m *ServiceSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) {
    i := len(dAtA)
    _ = i
    var l int
    _ = l
Severity: Major
Found in api/specs.pb.go - About 2 hrs to fix

    Method Scheduler.Run has 84 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (s *Scheduler) Run(pctx context.Context) error {
        ctx := log.WithModule(pctx, "scheduler")
        defer close(s.doneChan)
    
        s.pipeline.AddFilter(&VolumesFilter{vs: s.volumes})
    Severity: Major
    Found in manager/scheduler/scheduler.go - About 2 hrs to fix

      containerConfig has 22 methods (exceeds 20 allowed). Consider refactoring.
      Open

      type containerConfig struct {
          task                *api.Task
          networksAttachments map[string]*api.NetworkAttachment
      }
      Severity: Minor
      Found in swarmd/dockerexec/container.go - About 2 hrs to fix

        Method ClusterSnapshot.Unmarshal has 26 return statements (exceeds 4 allowed).
        Open

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

          Assignment has 22 methods (exceeds 20 allowed). Consider refactoring.
          Open

          type Assignment struct {
              // Types that are valid to be assigned to Item:
              //    *Assignment_Task
              //    *Assignment_Secret
              //    *Assignment_Config
          Severity: Minor
          Found in api/dispatcher.pb.go - About 2 hrs to fix

            Method Snapshot.Unmarshal has 26 return statements (exceeds 4 allowed).
            Open

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

              Method WatchRequest.Unmarshal has 26 return statements (exceeds 4 allowed).
              Open

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

                ServiceSpec has 22 methods (exceeds 20 allowed). Consider refactoring.
                Open

                type ServiceSpec struct {
                    Annotations Annotations `protobuf:"bytes,1,opt,name=annotations,proto3" json:"annotations"`
                    // Task defines the task template this service will spawn.
                    Task TaskSpec `protobuf:"bytes,2,opt,name=task,proto3" json:"task"`
                    // Types that are valid to be assigned to Mode:
                Severity: Minor
                Found in api/specs.pb.go - About 2 hrs to fix

                  Method WatchMessage_Event.Unmarshal has 26 return statements (exceeds 4 allowed).
                  Open

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

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

                    func (s *Server) GetExtension(ctx context.Context, request *api.GetExtensionRequest) (*api.GetExtensionResponse, error) {
                        if request.ExtensionID == "" {
                            return nil, status.Errorf(codes.InvalidArgument, "extension ID must be provided")
                        }
                    
                    
                    Severity: Major
                    Found in manager/controlapi/extension.go and 2 other locations - About 2 hrs to fix
                    manager/controlapi/config.go on lines 32..47
                    manager/controlapi/resource.go on lines 67..81

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

                    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 (s *Server) GetConfig(ctx context.Context, request *api.GetConfigRequest) (*api.GetConfigResponse, error) {
                        if request.ConfigID == "" {
                            return nil, status.Errorf(codes.InvalidArgument, "config ID must be provided")
                        }
                    
                    
                    Severity: Major
                    Found in manager/controlapi/config.go and 2 other locations - About 2 hrs to fix
                    manager/controlapi/extension.go on lines 55..70
                    manager/controlapi/resource.go on lines 67..81

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

                    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 (s *Server) GetResource(ctx context.Context, request *api.GetResourceRequest) (*api.GetResourceResponse, error) {
                        if request.ResourceID == "" {
                            return nil, status.Errorf(codes.InvalidArgument, "resource ID must be present")
                        }
                        var resource *api.Resource
                    Severity: Major
                    Found in manager/controlapi/resource.go and 2 other locations - About 2 hrs to fix
                    manager/controlapi/config.go on lines 32..47
                    manager/controlapi/extension.go on lines 55..70

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

                    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 (m *LogSelector) CopyFrom(src interface{}) {
                    
                        o := src.(*LogSelector)
                        *m = *o
                        if o.ServiceIDs != nil {
                    Severity: Major
                    Found in api/logbroker.pb.go and 1 other location - About 2 hrs to fix
                    api/specs.pb.go on lines 1992..2011

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

                    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 (m *ContainerSpec_DNSConfig) CopyFrom(src interface{}) {
                    
                        o := src.(*ContainerSpec_DNSConfig)
                        *m = *o
                        if o.Nameservers != nil {
                    Severity: Major
                    Found in api/specs.pb.go and 1 other location - About 2 hrs to fix
                    api/logbroker.pb.go on lines 702..721

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

                    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 LeaveRequest.Unmarshal has 83 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

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

                      Method StreamRaftMessageRequest.Unmarshal has 83 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

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

                        Method ProcessRaftMessageRequest.Unmarshal has 83 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

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

                          Method TaskReaper.tick has 82 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func (tr *TaskReaper) tick() {
                              // this signals that a tick has occurred. it exists solely for testing.
                              if tr.tickSignal != nil {
                                  // try writing to this channel, but if it's full, fall straight through
                                  // and ignore it.
                          Severity: Major
                          Found in manager/orchestrator/taskreaper/task_reaper.go - About 2 hrs to fix

                            Method PublishLogsMessage.Unmarshal has 25 return statements (exceeds 4 allowed).
                            Open

                            func (m *PublishLogsMessage) Unmarshal(dAtA []byte) error {
                                l := len(dAtA)
                                iNdEx := 0
                                for iNdEx < l {
                                    preIndex := iNdEx
                            Severity: Major
                            Found in api/logbroker.pb.go - About 2 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language