docker/swarmkit

View on GitHub

Showing 1,820 of 1,820 total issues

Method Extension.Unmarshal has 35 return statements (exceeds 4 allowed).
Open

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

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

    func (s *Server) UpdateService(ctx context.Context, request *api.UpdateServiceRequest) (*api.UpdateServiceResponse, error) {
        if request.ServiceID == "" || request.ServiceVersion == nil {
            return nil, status.Errorf(codes.InvalidArgument, errInvalidArgument.Error())
        }
        if err := validateServiceSpec(request.Spec); err != nil {
    Severity: Minor
    Found in manager/controlapi/service.go - About 3 hrs 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

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

            case 2:
                if wireType != 2 {
                    return fmt.Errorf("proto: wrong wireType = %d for field Action", wireType)
                }
                var msglen int
    Severity: Major
    Found in api/raft.pb.go and 5 other locations - About 3 hrs to fix
    api/logbroker.pb.go on lines 3138..3171
    api/logbroker.pb.go on lines 3344..3377
    api/logbroker.pb.go on lines 3684..3717
    api/specs.pb.go on lines 6022..6055
    api/specs.pb.go on lines 6726..6759

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

    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

            case 1:
                if wireType != 2 {
                    return fmt.Errorf("proto: wrong wireType = %d for field Messages", wireType)
                }
                var msglen int
    Severity: Major
    Found in api/logbroker.pb.go and 5 other locations - About 3 hrs to fix
    api/logbroker.pb.go on lines 3138..3171
    api/logbroker.pb.go on lines 3684..3717
    api/raft.pb.go on lines 4022..4055
    api/specs.pb.go on lines 6022..6055
    api/specs.pb.go on lines 6726..6759

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

    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

            case 5:
                if wireType != 2 {
                    return fmt.Errorf("proto: wrong wireType = %d for field Attrs", wireType)
                }
                var msglen int
    Severity: Major
    Found in api/logbroker.pb.go and 5 other locations - About 3 hrs to fix
    api/logbroker.pb.go on lines 3344..3377
    api/logbroker.pb.go on lines 3684..3717
    api/raft.pb.go on lines 4022..4055
    api/specs.pb.go on lines 6022..6055
    api/specs.pb.go on lines 6726..6759

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

    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

            case 8:
                if wireType != 2 {
                    return fmt.Errorf("proto: wrong wireType = %d for field Mounts", wireType)
                }
                var msglen int
    Severity: Major
    Found in api/specs.pb.go and 5 other locations - About 3 hrs to fix
    api/logbroker.pb.go on lines 3138..3171
    api/logbroker.pb.go on lines 3344..3377
    api/logbroker.pb.go on lines 3684..3717
    api/raft.pb.go on lines 4022..4055
    api/specs.pb.go on lines 6022..6055

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

    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

            case 2:
                if wireType != 2 {
                    return fmt.Errorf("proto: wrong wireType = %d for field Messages", wireType)
                }
                var msglen int
    Severity: Major
    Found in api/logbroker.pb.go and 5 other locations - About 3 hrs to fix
    api/logbroker.pb.go on lines 3138..3171
    api/logbroker.pb.go on lines 3344..3377
    api/raft.pb.go on lines 4022..4055
    api/specs.pb.go on lines 6022..6055
    api/specs.pb.go on lines 6726..6759

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

    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

            case 11:
                if wireType != 2 {
                    return fmt.Errorf("proto: wrong wireType = %d for field ResourceReferences", wireType)
                }
                var msglen int
    Severity: Major
    Found in api/specs.pb.go and 5 other locations - About 3 hrs to fix
    api/logbroker.pb.go on lines 3138..3171
    api/logbroker.pb.go on lines 3344..3377
    api/logbroker.pb.go on lines 3684..3717
    api/raft.pb.go on lines 4022..4055
    api/specs.pb.go on lines 6726..6759

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

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

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

      Method Server.Run has 102 lines of code (exceeds 50 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: Major
      Found in ca/server.go - About 3 hrs to fix

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

        package secret
        
        import (
            "errors"
            "fmt"
        Severity: Major
        Found in swarmd/cmd/swarmctl/secret/remove.go and 1 other location - About 3 hrs to fix
        swarmd/cmd/swarmctl/config/remove.go on lines 1..38

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

        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

        package config
        
        import (
            "errors"
            "fmt"
        Severity: Major
        Found in swarmd/cmd/swarmctl/config/remove.go and 1 other location - About 3 hrs to fix
        swarmd/cmd/swarmctl/secret/remove.go on lines 1..38

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

        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

            if o.Mode != nil {
                switch o.Mode.(type) {
                case *ServiceSpec_Replicated:
                    v := ServiceSpec_Replicated{
                        Replicated: &ReplicatedService{},
        Severity: Major
        Found in api/specs.pb.go and 1 other location - About 3 hrs to fix
        api/dispatcher.pb.go on lines 1256..1283

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

        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

            if o.Item != nil {
                switch o.Item.(type) {
                case *Assignment_Task:
                    v := Assignment_Task{
                        Task: &Task{},
        Severity: Major
        Found in api/dispatcher.pb.go and 1 other location - About 3 hrs to fix
        api/specs.pb.go on lines 1650..1677

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

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

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

          Method TLSAuthorization.Unmarshal has 100 lines of code (exceeds 50 allowed). Consider refactoring.
          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 3 hrs to fix

            Function CheckTasks has 100 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func CheckTasks(ctx context.Context, s *store.MemoryStore, readTx store.ReadTx, initHandler InitHandler, startSupervisor restart.SupervisorInterface) error {
                instances := make(map[orchestrator.SlotTuple][]*api.Task)
                err := s.Batch(func(batch *store.Batch) error {
                    tasks, err := store.FindTasks(readTx, store.All)
                    if err != nil {
            Severity: Major
            Found in manager/orchestrator/taskinit/init.go - About 3 hrs to fix

              Method InternalRaftRequest.Unmarshal has 100 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

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

                Allocator has 26 methods (exceeds 20 allowed). Consider refactoring.
                Open

                func (a *Allocator) doNetworkInit(ctx context.Context) (err error) {
                    nc := &networkContext{
                        nwkAllocator:        a.nwkAllocator,
                        portAllocator:       newPortAllocator(),
                        pendingTasks:        make(map[string]*api.Task),
                Severity: Minor
                Found in manager/allocator/network.go - About 3 hrs to fix

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

                      s.store.View(func(tx store.ReadTx) {
                          switch {
                          case request.Filters != nil && len(request.Filters.Names) > 0:
                              clusters, err = store.FindClusters(tx, buildFilters(store.ByName, request.Filters.Names))
                          case request.Filters != nil && len(request.Filters.NamePrefixes) > 0:
                  Severity: Major
                  Found in manager/controlapi/cluster.go and 1 other location - About 3 hrs to fix
                  manager/controlapi/network.go on lines 262..273

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

                  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