docker/swarmkit

View on GitHub

Showing 1,008 of 1,820 total issues

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

      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

                                Method statusReporter.run has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring.
                                Open

                                func (sr *statusReporter) run(ctx context.Context) {
                                    done := make(chan struct{})
                                    defer close(done)
                                
                                    sr.mu.Lock() // released during wait, below.
                                Severity: Minor
                                Found in agent/reporter.go - About 1 hr to fix

                                Cognitive Complexity

                                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                A method's cognitive complexity is based on a few simple rules:

                                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                • Code is considered more complex for each "break in the linear flow of the code"
                                • Code is considered more complex when "flow breaking structures are nested"

                                Further reading

                                Method TaskSpec.MarshalToSizedBuffer has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring.
                                Open

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

                                Cognitive Complexity

                                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                A method's cognitive complexity is based on a few simple rules:

                                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                • Code is considered more complex for each "break in the linear flow of the code"
                                • Code is considered more complex when "flow breaking structures are nested"

                                Further reading

                                Method rootRotationReconciler.runReconcilerLoop has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring.
                                Open

                                func (r *rootRotationReconciler) runReconcilerLoop(ctx context.Context, loopRootCA *api.RootCA) {
                                    defer r.wg.Done()
                                    for {
                                        r.mu.Lock()
                                        if len(r.unconvergedNodes) == 0 {
                                Severity: Minor
                                Found in ca/reconciler.go - About 1 hr to fix

                                Cognitive Complexity

                                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                A method's cognitive complexity is based on a few simple rules:

                                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                • Code is considered more complex for each "break in the linear flow of the code"
                                • Code is considered more complex when "flow breaking structures are nested"

                                Further reading

                                Method Server.Run has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring.
                                Open

                                func (s *Server) Run(ctx context.Context) error {
                                    s.mu.Lock()
                                    if s.isRunning() {
                                        s.mu.Unlock()
                                        return errors.New("CA signer is already running")
                                Severity: Minor
                                Found in ca/server.go - About 1 hr to fix

                                Cognitive Complexity

                                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                A method's cognitive complexity is based on a few simple rules:

                                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                • Code is considered more complex for each "break in the linear flow of the code"
                                • Code is considered more complex when "flow breaking structures are nested"

                                Further reading

                                Method StoreObject.Unmarshal has 17 return statements (exceeds 4 allowed).
                                Open

                                func (m *StoreObject) Unmarshal(dAtA []byte) error {
                                    var hasFields [1]uint64
                                    l := len(dAtA)
                                    iNdEx := 0
                                    for iNdEx < l {
                                Severity: Major
                                Found in protobuf/plugin/plugin.pb.go - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language