docker/swarmkit

View on GitHub

Showing 1,820 of 1,820 total issues

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

func (m *GetRootCACertificateRequest) Unmarshal(dAtA []byte) error {
    l := len(dAtA)
    iNdEx := 0
    for iNdEx < l {
        preIndex := iNdEx
Severity: Major
Found in api/ca.pb.go and 11 other locations - About 4 hrs to fix
api/ca.pb.go on lines 2178..2227
api/dispatcher.pb.go on lines 4071..4120
api/dispatcher.pb.go on lines 4339..4388
api/logbroker.pb.go on lines 3399..3448
api/logbroker.pb.go on lines 3759..3808
api/raft.pb.go on lines 3501..3550
api/raft.pb.go on lines 3637..3686
api/raft.pb.go on lines 3773..3822
api/resource.pb.go on lines 1094..1143
api/specs.pb.go on lines 5503..5552
api/specs.pb.go on lines 5641..5690

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

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 12 locations. Consider refactoring.
Open

func (m *GlobalJob) Unmarshal(dAtA []byte) error {
    l := len(dAtA)
    iNdEx := 0
    for iNdEx < l {
        preIndex := iNdEx
Severity: Major
Found in api/specs.pb.go and 11 other locations - About 4 hrs to fix
api/ca.pb.go on lines 2044..2093
api/ca.pb.go on lines 2178..2227
api/dispatcher.pb.go on lines 4071..4120
api/dispatcher.pb.go on lines 4339..4388
api/logbroker.pb.go on lines 3399..3448
api/logbroker.pb.go on lines 3759..3808
api/raft.pb.go on lines 3501..3550
api/raft.pb.go on lines 3637..3686
api/raft.pb.go on lines 3773..3822
api/resource.pb.go on lines 1094..1143
api/specs.pb.go on lines 5503..5552

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

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 12 locations. Consider refactoring.
Open

func (m *UpdateTaskStatusResponse) Unmarshal(dAtA []byte) error {
    l := len(dAtA)
    iNdEx := 0
    for iNdEx < l {
        preIndex := iNdEx
Severity: Major
Found in api/dispatcher.pb.go and 11 other locations - About 4 hrs to fix
api/ca.pb.go on lines 2044..2093
api/ca.pb.go on lines 2178..2227
api/dispatcher.pb.go on lines 4339..4388
api/logbroker.pb.go on lines 3399..3448
api/logbroker.pb.go on lines 3759..3808
api/raft.pb.go on lines 3501..3550
api/raft.pb.go on lines 3637..3686
api/raft.pb.go on lines 3773..3822
api/resource.pb.go on lines 1094..1143
api/specs.pb.go on lines 5503..5552
api/specs.pb.go on lines 5641..5690

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

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 12 locations. Consider refactoring.
Open

func (m *ProcessRaftMessageResponse) Unmarshal(dAtA []byte) error {
    l := len(dAtA)
    iNdEx := 0
    for iNdEx < l {
        preIndex := iNdEx
Severity: Major
Found in api/raft.pb.go and 11 other locations - About 4 hrs to fix
api/ca.pb.go on lines 2044..2093
api/ca.pb.go on lines 2178..2227
api/dispatcher.pb.go on lines 4071..4120
api/dispatcher.pb.go on lines 4339..4388
api/logbroker.pb.go on lines 3399..3448
api/logbroker.pb.go on lines 3759..3808
api/raft.pb.go on lines 3501..3550
api/raft.pb.go on lines 3773..3822
api/resource.pb.go on lines 1094..1143
api/specs.pb.go on lines 5503..5552
api/specs.pb.go on lines 5641..5690

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

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 12 locations. Consider refactoring.
Open

func (m *GlobalService) Unmarshal(dAtA []byte) error {
    l := len(dAtA)
    iNdEx := 0
    for iNdEx < l {
        preIndex := iNdEx
Severity: Major
Found in api/specs.pb.go and 11 other locations - About 4 hrs to fix
api/ca.pb.go on lines 2044..2093
api/ca.pb.go on lines 2178..2227
api/dispatcher.pb.go on lines 4071..4120
api/dispatcher.pb.go on lines 4339..4388
api/logbroker.pb.go on lines 3399..3448
api/logbroker.pb.go on lines 3759..3808
api/raft.pb.go on lines 3501..3550
api/raft.pb.go on lines 3637..3686
api/raft.pb.go on lines 3773..3822
api/resource.pb.go on lines 1094..1143
api/specs.pb.go on lines 5641..5690

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

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

Function Do has 141 lines of code (exceeds 50 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: Major
Found in agent/exec/controller.go - About 4 hrs to fix

    Method WatchMessage_Event.Unmarshal has 138 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

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

      Method Reconciler.ReconcileService has 138 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (r *Reconciler) ReconcileService(id string) error {
          var (
              service *api.Service
              cluster *api.Cluster
              tasks   []*api.Task
      Severity: Major
      Found in manager/orchestrator/jobs/global/reconciler.go - About 4 hrs to fix

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

        func reconcileConfigs(ctx context.Context, w *worker, assignments []*api.AssignmentChange, fullSnapshot bool) error {
            var (
                updatedConfigs []api.Config
                removedConfigs []string
            )
        Severity: Major
        Found in agent/worker.go and 1 other location - About 4 hrs to fix
        agent/worker.go on lines 334..375

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

        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 reconcileSecrets(ctx context.Context, w *worker, assignments []*api.AssignmentChange, fullSnapshot bool) error {
            var (
                updatedSecrets []api.Secret
                removedSecrets []string
            )
        Severity: Major
        Found in agent/worker.go and 1 other location - About 4 hrs to fix
        agent/worker.go on lines 377..418

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

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

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

          Method WatchRequest.Unmarshal has 137 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

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

            Method WatchSelectors.MarshalToSizedBuffer has 135 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (m *WatchSelectors) MarshalToSizedBuffer(dAtA []byte) (int, error) {
                i := len(dAtA)
                _ = i
                var l int
                _ = l
            Severity: Major
            Found in protobuf/plugin/plugin.pb.go - About 4 hrs to fix

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

              func ParseDropCapability(cmd *cobra.Command, spec *api.ServiceSpec, flagName string) error {
                  flags := cmd.Flags()
              
                  if !flags.Changed(flagName) {
                      return nil
              Severity: Major
              Found in swarmd/cmd/swarmctl/service/flagparser/capability.go and 1 other location - About 4 hrs to fix
              swarmd/cmd/swarmctl/service/flagparser/capability.go on lines 9..56

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

              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 ParseAddCapability(cmd *cobra.Command, spec *api.ServiceSpec, flagName string) error {
                  flags := cmd.Flags()
              
                  if !flags.Changed(flagName) {
                      return nil
              Severity: Major
              Found in swarmd/cmd/swarmctl/service/flagparser/capability.go and 1 other location - About 4 hrs to fix
              swarmd/cmd/swarmctl/service/flagparser/capability.go on lines 59..106

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

              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

              SelectBy has 34 methods (exceeds 20 allowed). Consider refactoring.
              Open

              type SelectBy struct {
                  // TODO(aaronl): Are all of these things we want to expose in
                  // the API? Exposing them may commit us to maintaining those
                  // internal indices going forward.
                  //
              Severity: Minor
              Found in api/watch.pb.go - About 4 hrs to fix

                Function EventFromStoreAction has 133 lines of code (exceeds 50 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: Major
                Found in api/objects.pb.go - About 4 hrs to fix

                  Method PublishLogsMessage.Unmarshal has 133 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

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

                    Method Node.Run has 133 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func (n *Node) Run(ctx context.Context) error {
                        ctx = log.WithLogger(ctx, logrus.WithField("raft_id", fmt.Sprintf("%x", n.Config.ID)))
                        ctx, cancel := context.WithCancel(ctx)
                    
                        for _, node := range n.bootstrapMembers {
                    Severity: Major
                    Found in manager/state/raft/raft.go - About 4 hrs to fix

                      Method Snapshot.Unmarshal has 132 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

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