docker/swarmkit

View on GitHub

Showing 1,820 of 1,820 total issues

Method ResourceReference.Unmarshal has 18 return statements (exceeds 4 allowed).
Open

func (m *ResourceReference) 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 TLSAuthorization.Unmarshal has 18 return statements (exceeds 4 allowed).
    Open

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

      Method Server.ListTasks has 18 return statements (exceeds 4 allowed).
      Open

      func (s *Server) ListTasks(ctx context.Context, request *api.ListTasksRequest) (*api.ListTasksResponse, error) {
          var (
              tasks []*api.Task
              err   error
          )
      Severity: Major
      Found in manager/controlapi/task.go - About 1 hr to fix

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

        func (w *worker) Assign(ctx context.Context, assignments []*api.AssignmentChange) error {
            w.mu.Lock()
            defer w.mu.Unlock()
        
            if w.closed {
        Severity: Major
        Found in agent/worker.go and 1 other location - About 1 hr to fix
        agent/worker.go on lines 168..196

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

        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 WatchTaskUpdate(t *testing.T, watch chan events.Event) *api.Task {
            for {
                select {
                case event := <-watch:
                    if task, ok := event.(api.EventUpdateTask); ok {
        Severity: Major
        Found in manager/orchestrator/testutils/testutils.go and 1 other location - About 1 hr to fix
        manager/orchestrator/testutils/testutils.go on lines 32..46

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

        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 (w *worker) Update(ctx context.Context, assignments []*api.AssignmentChange) error {
            w.mu.Lock()
            defer w.mu.Unlock()
        
            if w.closed {
        Severity: Major
        Found in agent/worker.go and 1 other location - About 1 hr to fix
        agent/worker.go on lines 129..159

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

        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 WatchTaskCreate(t *testing.T, watch chan events.Event) *api.Task {
            for {
                select {
                case event := <-watch:
                    if task, ok := event.(api.EventCreateTask); ok {
        Severity: Major
        Found in manager/orchestrator/testutils/testutils.go and 1 other location - About 1 hr to fix
        manager/orchestrator/testutils/testutils.go on lines 49..63

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

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

        func parseContainer(flags *pflag.FlagSet, spec *api.ServiceSpec) error {
            if flags.Changed("image") {
                image, err := flags.GetString("image")
                if err != nil {
                    return err
        Severity: Minor
        Found in swarmd/cmd/swarmctl/service/flagparser/container.go - About 1 hr to fix

          Method HealthCheckResponse.Unmarshal has 66 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

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

            Method Network.MarshalToSizedBuffer has 66 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (m *Network) MarshalToSizedBuffer(dAtA []byte) (int, error) {
                i := len(dAtA)
                _ = i
                var l int
                _ = l
            Severity: Minor
            Found in api/objects.pb.go - About 1 hr to fix

              Method StoreSnapshot.Size has 66 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func (m *StoreSnapshot) Size() (n int) {
                  if m == nil {
                      return 0
                  }
                  var l int
              Severity: Minor
              Found in api/snapshot.pb.go - About 1 hr to fix

                Method StoreAction.CopyFrom has 66 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (m *StoreAction) CopyFrom(src interface{}) {
                
                    o := src.(*StoreAction)
                    *m = *o
                    if o.Target != nil {
                Severity: Minor
                Found in api/raft.pb.go - About 1 hr to fix

                  Method ReplicatedService.Unmarshal has 66 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

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

                    Method Object.CopyFrom has 66 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func (m *Object) CopyFrom(src interface{}) {
                    
                        o := src.(*Object)
                        *m = *o
                        if o.Object != nil {
                    Severity: Minor
                    Found in api/watch.pb.go - About 1 hr to fix

                      Method ResolveAddressRequest.Unmarshal has 66 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

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

                        Method Updater.updateTask has 66 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func (u *Updater) updateTask(ctx context.Context, slot orchestrator.Slot, updated *api.Task, order api.UpdateConfig_UpdateOrder) error {
                            // Kick off the watch before even creating the updated task. This is in order to avoid missing any event.
                            taskUpdates, cancel := state.Watch(u.watchQueue, api.EventUpdateTask{
                                Task:   &api.Task{ID: updated.ID},
                                Checks: []api.TaskCheckFunc{api.TaskCheckID},
                        Severity: Minor
                        Found in manager/orchestrator/update/updater.go - About 1 hr to fix

                          Method Orchestrator.reconcileServices has 66 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func (g *Orchestrator) reconcileServices(ctx context.Context, serviceIDs []string) {
                              nodeTasks := make(map[string]map[string][]*api.Task)
                          
                              g.store.View(func(tx store.ReadTx) {
                                  for _, serviceID := range serviceIDs {
                          Severity: Minor
                          Found in manager/orchestrator/global/global.go - About 1 hr to fix

                            Method testSuite.TestServicePortAllocationIsRepeatable has 66 lines of code (exceeds 50 allowed). Consider refactoring.
                            Open

                            func (suite *testSuite) TestServicePortAllocationIsRepeatable() {
                                alloc := func() []*api.PortConfig {
                                    s := store.NewMemoryStore(nil)
                                    suite.NotNil(s)
                                    defer s.Close()
                            Severity: Minor
                            Found in manager/allocator/allocator_test_suite.go - About 1 hr to fix

                              Method Server.UpdateRootCA has 65 lines of code (exceeds 50 allowed). Consider refactoring.
                              Open

                              func (s *Server) UpdateRootCA(ctx context.Context, cluster *api.Cluster, reconciler *rootRotationReconciler) error {
                                  s.mu.Lock()
                                  s.joinTokens = cluster.RootCA.JoinTokens.Copy()
                                  s.mu.Unlock()
                                  rCA := cluster.RootCA.Copy()
                              Severity: Minor
                              Found in ca/server.go - About 1 hr to fix

                                Method testSuite.TestDeallocateServiceAllocate has 65 lines of code (exceeds 50 allowed). Consider refactoring.
                                Open

                                func (suite *testSuite) TestDeallocateServiceAllocate() {
                                    s := store.NewMemoryStore(nil)
                                    suite.NotNil(s)
                                    defer s.Close()
                                
                                
                                Severity: Minor
                                Found in manager/allocator/allocator_test_suite.go - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language