docker/swarmkit

View on GitHub

Showing 1,820 of 1,820 total issues

Method HeartbeatRequest.Unmarshal has 79 lines of code (exceeds 50 allowed). Consider refactoring.
Open

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

    Method AssignmentsRequest.Unmarshal has 79 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

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

      Method TasksRequest.Unmarshal has 79 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

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

        Method NetworkAttachmentSpec.Unmarshal has 79 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

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

          Method ContainerSpec_PullOptions.Unmarshal has 79 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

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

            Method TLSRenewer.Start has 79 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (t *TLSRenewer) Start(ctx context.Context) <-chan CertificateUpdate {
                updates := make(chan CertificateUpdate)
            
                go func() {
                    var (
            Severity: Major
            Found in ca/renewer.go - About 2 hrs to fix

              Method ResolveAddressResponse.Unmarshal has 79 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func (m *ResolveAddressResponse) 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 JoinRequest.Unmarshal has 79 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (m *JoinRequest) 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 test.Generate has 79 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func (p *test) Generate(imports generator.PluginImports, file *generator.FileDescriptor) bool {
                      used := false
                      testingPkg := imports.NewImport("testing")
                      randPkg := imports.NewImport("math/rand")
                      timePkg := imports.NewImport("time")
                  Severity: Major
                  Found in protobuf/plugin/deepcopy/deepcopytest.go - About 2 hrs to fix

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

                    func (m *ClusterSnapshot) CopyFrom(src interface{}) {
                    
                        o := src.(*ClusterSnapshot)
                        *m = *o
                        if o.Members != nil {
                    Severity: Major
                    Found in api/snapshot.pb.go and 1 other location - About 2 hrs to fix
                    api/raft.pb.go on lines 907..924

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

                    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 *JoinResponse) CopyFrom(src interface{}) {
                    
                        o := src.(*JoinResponse)
                        *m = *o
                        if o.Members != nil {
                    Severity: Major
                    Found in api/raft.pb.go and 1 other location - About 2 hrs to fix
                    api/snapshot.pb.go on lines 325..342

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

                    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 Server.checkPortConflicts has 78 lines of code (exceeds 50 allowed). Consider refactoring.
                    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 2 hrs to fix

                      Method Agent.handleSessionMessage has a Cognitive Complexity of 31 (exceeds 20 allowed). Consider refactoring.
                      Open

                      func (a *Agent) handleSessionMessage(ctx context.Context, message *api.SessionMessage, nti *api.NodeTLSInfo) error {
                          seen := map[api.Peer]struct{}{}
                          for _, manager := range message.Managers {
                              if manager.Peer.Addr == "" {
                                  continue
                      Severity: Minor
                      Found in agent/agent.go - About 2 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

                      Method NodeCertificateStatusResponse.Unmarshal has 23 return statements (exceeds 4 allowed).
                      Open

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

                        Function printNodeSummary has a Cognitive Complexity of 31 (exceeds 20 allowed). Consider refactoring.
                        Open

                        func printNodeSummary(node *api.Node) {
                            w := tabwriter.NewWriter(os.Stdout, 8, 8, 8, ' ', 0)
                            defer func() {
                                // Ignore flushing errors - there's nothing we can do.
                                _ = w.Flush()
                        Severity: Minor
                        Found in swarmd/cmd/swarmctl/node/inspect.go - About 2 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

                        Function WatchMessageEvent has a Cognitive Complexity of 31 (exceeds 20 allowed). Consider refactoring.
                        Open

                        func WatchMessageEvent(c Event) *WatchMessage_Event {
                            switch v := c.(type) {
                            case EventCreateNode:
                                return &WatchMessage_Event{Action: WatchActionKindCreate, Object: &Object{Object: &Object_Node{Node: v.Node}}}
                            case EventUpdateNode:
                        Severity: Minor
                        Found in api/objects.pb.go - About 2 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

                        Function ConvertNodeWatch has a Cognitive Complexity of 31 (exceeds 20 allowed). Consider refactoring.
                        Open

                        func ConvertNodeWatch(action WatchActionKind, filters []*SelectBy) ([]Event, error) {
                            var (
                                m             Node
                                checkFuncs    []NodeCheckFunc
                                hasRole       bool
                        Severity: Minor
                        Found in api/objects.pb.go - About 2 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

                        Method StoreSnapshot.Size has a Cognitive Complexity of 31 (exceeds 20 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 2 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

                        Method SubscribeLogsRequest.Unmarshal has 23 return statements (exceeds 4 allowed).
                        Open

                        func (m *SubscribeLogsRequest) 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

                          Method ContainerSpec.CopyFrom has a Cognitive Complexity of 31 (exceeds 20 allowed). Consider refactoring.
                          Open

                          func (m *ContainerSpec) CopyFrom(src interface{}) {
                          
                              o := src.(*ContainerSpec)
                              *m = *o
                              if o.Labels != nil {
                          Severity: Minor
                          Found in api/specs.pb.go - About 2 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

                          Severity
                          Category
                          Status
                          Source
                          Language