docker/swarmkit

View on GitHub

Showing 1,820 of 1,820 total issues

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

Method StoreSnapshot.Unmarshal has 79 return statements (exceeds 4 allowed).
Open

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

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

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

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

    func (m *TasksMessage) Unmarshal(dAtA []byte) error {
        l := len(dAtA)
        iNdEx := 0
        for iNdEx < l {
            preIndex := iNdEx
    Severity: Minor
    Found in api/dispatcher.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 ServiceSpec.Unmarshal has 79 return statements (exceeds 4 allowed).
    Open

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

      Method Object.Unmarshal has 79 return statements (exceeds 4 allowed).
      Open

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

        Function dumpObject has 191 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func dumpObject(swarmdir, unlockKey, objType string, selector objSelector) error {
            memStore := store.NewMemoryStore(nil)
            defer memStore.Close()
        
            walData, snapshot, err := loadData(swarmdir, unlockKey)
        Severity: Major
        Found in swarmd/cmd/swarm-rafttool/dump.go - About 6 hrs to fix

          Method LogSubscriptionOptions.Unmarshal has 191 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

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

            File health.pb.go has 693 lines of code (exceeds 500 allowed). Consider refactoring.
            Open

            // Code generated by protoc-gen-gogo. DO NOT EDIT.
            // source: github.com/docker/swarmkit/api/health.proto
            
            package api
            
            
            Severity: Minor
            Found in api/health.pb.go - About 6 hrs to fix

              Function reconcileTaskState has a Cognitive Complexity of 58 (exceeds 20 allowed). Consider refactoring.
              Open

              func reconcileTaskState(ctx context.Context, w *worker, assignments []*api.AssignmentChange, fullSnapshot bool) error {
                  var (
                      updatedTasks []*api.Task
                      removedTasks []*api.Task
                  )
              Severity: Minor
              Found in agent/worker.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 Node.Unmarshal has 77 return statements (exceeds 4 allowed).
              Open

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

                Method ConstraintEnforcer.rejectNoncompliantTasks has a Cognitive Complexity of 58 (exceeds 20 allowed). Consider refactoring.
                Open

                func (ce *ConstraintEnforcer) rejectNoncompliantTasks(node *api.Node) {
                    // If the availability is "drain", the orchestrator will
                    // shut down all tasks.
                    // If the availability is "pause", we shouldn't touch
                    // the tasks on this node.
                Severity: Minor
                Found in manager/orchestrator/constraintenforcer/constraint_enforcer.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 Assignment.Unmarshal has 187 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

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

                  Method SecretSpec.Unmarshal has 186 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

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

                    Method TaskSpec.Unmarshal has 75 return statements (exceeds 4 allowed).
                    Open

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

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

                      func (m *ContainerSpec) Size() (n int) {
                          if m == nil {
                              return 0
                          }
                          var l int
                      Severity: Minor
                      Found in api/specs.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 readTx.findIterators has a Cognitive Complexity of 57 (exceeds 20 allowed). Consider refactoring.
                      Open

                      func (tx readTx) findIterators(table string, by By, checkType func(By) error) ([]memdb.ResultIterator, error) {
                          switch by.(type) {
                          case byAll, orCombinator: // generic types
                          default: // all other types
                              if err := checkType(by); err != nil {
                      Severity: Minor
                      Found in manager/state/store/memory.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

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

                      func (m *LogSelector) MarshalToSizedBuffer(dAtA []byte) (int, error) {
                          i := len(dAtA)
                          _ = i
                          var l int
                          _ = l
                      Severity: Major
                      Found in api/logbroker.pb.go and 1 other location - About 6 hrs to fix
                      api/specs.pb.go on lines 3233..3266

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

                      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 *ContainerSpec_DNSConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) {
                          i := len(dAtA)
                          _ = i
                          var l int
                          _ = l
                      Severity: Major
                      Found in api/specs.pb.go and 1 other location - About 6 hrs to fix
                      api/logbroker.pb.go on lines 1269..1302

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

                      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