docker/swarmkit

View on GitHub

Showing 1,008 of 1,820 total issues

Function Do has a Cognitive Complexity of 67 (exceeds 20 allowed). Consider refactoring.
Open

func Do(ctx context.Context, task *api.Task, ctlr Controller) (*api.TaskStatus, error) {
    status := task.Status.Copy()

    // stay in the current state.
    noop := func(errs ...error) (*api.TaskStatus, error) {
Severity: Minor
Found in agent/exec/controller.go - About 1 day 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 dumpWAL has a Cognitive Complexity of 67 (exceeds 20 allowed). Consider refactoring.
Open

func dumpWAL(swarmdir, unlockKey string, start, end uint64, redact bool) error {
    walData, _, err := loadData(swarmdir, unlockKey)
    if err != nil {
        return err
    }
Severity: Minor
Found in swarmd/cmd/swarm-rafttool/dump.go - About 1 day 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.ListNodes has a Cognitive Complexity of 66 (exceeds 20 allowed). Consider refactoring.
Open

func (s *Server) ListNodes(ctx context.Context, request *api.ListNodesRequest) (*api.ListNodesResponse, error) {
    var (
        nodes []*api.Node
        err   error
    )
Severity: Minor
Found in manager/controlapi/node.go - About 7 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

File storeobject.go has 743 lines of code (exceeds 500 allowed). Consider refactoring.
Open

package storeobject

import (
    "strings"

Severity: Minor
Found in protobuf/plugin/storeobject/storeobject.go - About 7 hrs to fix

    Function printServiceSummary has a Cognitive Complexity of 65 (exceeds 20 allowed). Consider refactoring.
    Open

    func printServiceSummary(service *api.Service, running int) {
        w := tabwriter.NewWriter(os.Stdout, 8, 8, 8, ' ', 0)
        defer w.Flush()
    
        task := service.Spec.Task
    Severity: Minor
    Found in swarmd/cmd/swarmctl/service/inspect.go - About 7 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 ReplicatedJob.Unmarshal has a Cognitive Complexity of 65 (exceeds 20 allowed). Consider refactoring.
    Open

    func (m *ReplicatedJob) Unmarshal(dAtA []byte) error {
        l := len(dAtA)
        iNdEx := 0
        for iNdEx < l {
            preIndex := iNdEx
    Severity: Minor
    Found in api/specs.pb.go - About 7 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 SessionMessage.Unmarshal has 217 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

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

      Method Cluster.Unmarshal has 90 return statements (exceeds 4 allowed).
      Open

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

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

        func (tm *taskManager) run(ctx context.Context) {
            ctx, cancelAll := context.WithCancel(ctx)
            defer cancelAll() // cancel all child operations on exit.
        
            ctx = log.WithModule(ctx, "taskmanager")
        Severity: Minor
        Found in agent/task.go - About 7 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 Resource.Unmarshal has 213 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

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

          Method StoreObject.Unmarshal has a Cognitive Complexity of 63 (exceeds 20 allowed). Consider refactoring.
          Open

          func (m *StoreObject) Unmarshal(dAtA []byte) error {
              var hasFields [1]uint64
              l := len(dAtA)
              iNdEx := 0
              for iNdEx < l {
          Severity: Minor
          Found in protobuf/plugin/plugin.pb.go - About 7 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 ProcessRaftMessageRequest.Unmarshal has a Cognitive Complexity of 62 (exceeds 20 allowed). Consider refactoring.
          Open

          func (m *ProcessRaftMessageRequest) Unmarshal(dAtA []byte) error {
              l := len(dAtA)
              iNdEx := 0
              for iNdEx < l {
                  preIndex := iNdEx
          Severity: Minor
          Found in api/raft.pb.go - About 7 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 LeaveRequest.Unmarshal has a Cognitive Complexity of 62 (exceeds 20 allowed). Consider refactoring.
          Open

          func (m *LeaveRequest) Unmarshal(dAtA []byte) error {
              l := len(dAtA)
              iNdEx := 0
              for iNdEx < l {
                  preIndex := iNdEx
          Severity: Minor
          Found in api/raft.pb.go - About 7 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 StreamRaftMessageRequest.Unmarshal has a Cognitive Complexity of 62 (exceeds 20 allowed). Consider refactoring.
          Open

          func (m *StreamRaftMessageRequest) Unmarshal(dAtA []byte) error {
              l := len(dAtA)
              iNdEx := 0
              for iNdEx < l {
                  preIndex := iNdEx
          Severity: Minor
          Found in api/raft.pb.go - About 7 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 TaskReaper.tick has a Cognitive Complexity of 62 (exceeds 20 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: Minor
          Found in manager/orchestrator/taskreaper/task_reaper.go - About 7 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 LogMessage.Unmarshal has 203 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

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

            Function EventFromStoreAction has a Cognitive Complexity of 61 (exceeds 20 allowed). Consider refactoring.
            Open

            func EventFromStoreAction(sa StoreAction, oldObject StoreObject) (Event, error) {
                switch v := sa.Target.(type) {
                case *StoreAction_Node:
                    switch sa.Action {
                    case StoreActionKindCreate:
            Severity: Minor
            Found in api/objects.pb.go - About 7 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 StoreAction.Unmarshal has 82 return statements (exceeds 4 allowed).
            Open

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

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

              func (m *StoreSnapshot) MarshalToSizedBuffer(dAtA []byte) (int, error) {
                  i := len(dAtA)
                  _ = i
                  var l int
                  _ = l
              Severity: Minor
              Found in api/snapshot.pb.go - About 6 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 GetRootCACertificateResponse.Unmarshal has a Cognitive Complexity of 59 (exceeds 20 allowed). Consider refactoring.
              Open

              func (m *GetRootCACertificateResponse) Unmarshal(dAtA []byte) error {
                  l := len(dAtA)
                  iNdEx := 0
                  for iNdEx < l {
                      preIndex := iNdEx
              Severity: Minor
              Found in api/ca.pb.go - About 6 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