docker/swarmkit

View on GitHub

Showing 1,820 of 1,820 total issues

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

    if err := a.store.Batch(func(batch *store.Batch) error {
        for _, node := range allocatedNodes {
            if err := a.commitAllocatedNode(ctx, batch, node); err != nil {
                log.G(ctx).WithError(err).Errorf("Failed to commit allocation of network resources for node %s", node.ID)
            }
Severity: Major
Found in manager/allocator/network.go and 1 other location - About 1 hr to fix
manager/allocator/network.go on lines 631..640

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

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 err := a.store.Batch(func(batch *store.Batch) error {
        for _, n := range allocatedNetworks {
            if err := a.commitAllocatedNetwork(ctx, batch, n); err != nil {
                log.G(ctx).WithError(err).Errorf("failed committing allocation of network %s during init", n.ID)
            }
Severity: Major
Found in manager/allocator/network.go and 1 other location - About 1 hr to fix
manager/allocator/network.go on lines 474..483

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

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

func (m *Object) MarshalToSizedBuffer(dAtA []byte) (int, error) {
    i := len(dAtA)
    _ = i
    var l int
    _ = l
Severity: Major
Found in api/watch.pb.go and 2 other locations - About 1 hr to fix
api/dispatcher.pb.go on lines 2234..2249
api/watch.pb.go on lines 1670..1685

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

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

func (m *SelectBy) MarshalToSizedBuffer(dAtA []byte) (int, error) {
    i := len(dAtA)
    _ = i
    var l int
    _ = l
Severity: Major
Found in api/watch.pb.go and 2 other locations - About 1 hr to fix
api/dispatcher.pb.go on lines 2234..2249
api/watch.pb.go on lines 1349..1364

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

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

func (m *Assignment) MarshalToSizedBuffer(dAtA []byte) (int, error) {
    i := len(dAtA)
    _ = i
    var l int
    _ = l
Severity: Major
Found in api/dispatcher.pb.go and 2 other locations - About 1 hr to fix
api/watch.pb.go on lines 1349..1364
api/watch.pb.go on lines 1670..1685

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

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 controller.Logs has 58 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (r *controller) Logs(ctx context.Context, publisher exec.LogPublisher, options api.LogSubscriptionOptions) error {
    if err := r.checkClosed(); err != nil {
        return err
    }

Severity: Minor
Found in swarmd/dockerexec/controller.go - About 1 hr to fix

    Function convertMount has 58 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func convertMount(m api.Mount) enginemount.Mount {
        mount := enginemount.Mount{
            Source:   m.Source,
            Target:   m.Target,
            ReadOnly: m.ReadOnly,
    Severity: Minor
    Found in swarmd/dockerexec/container.go - About 1 hr to fix

      Function ConvertExtensionWatch has 58 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func ConvertExtensionWatch(action WatchActionKind, filters []*SelectBy) ([]Event, error) {
          var (
              m          Extension
              checkFuncs []ExtensionCheckFunc
          )
      Severity: Minor
      Found in api/objects.pb.go - About 1 hr to fix

        Function ConvertSecretWatch has 58 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func ConvertSecretWatch(action WatchActionKind, filters []*SelectBy) ([]Event, error) {
            var (
                m          Secret
                checkFuncs []SecretCheckFunc
            )
        Severity: Minor
        Found in api/objects.pb.go - About 1 hr to fix

          Function ConvertVolumeWatch has 58 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func ConvertVolumeWatch(action WatchActionKind, filters []*SelectBy) ([]Event, error) {
              var (
                  m          Volume
                  checkFuncs []VolumeCheckFunc
              )
          Severity: Minor
          Found in api/objects.pb.go - About 1 hr to fix

            Function ConvertClusterWatch has 58 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func ConvertClusterWatch(action WatchActionKind, filters []*SelectBy) ([]Event, error) {
                var (
                    m          Cluster
                    checkFuncs []ClusterCheckFunc
                )
            Severity: Minor
            Found in api/objects.pb.go - About 1 hr to fix

              Function ConvertConfigWatch has 58 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func ConvertConfigWatch(action WatchActionKind, filters []*SelectBy) ([]Event, error) {
                  var (
                      m          Config
                      checkFuncs []ConfigCheckFunc
                  )
              Severity: Minor
              Found in api/objects.pb.go - About 1 hr to fix

                Function ConvertNetworkWatch has 58 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func ConvertNetworkWatch(action WatchActionKind, filters []*SelectBy) ([]Event, error) {
                    var (
                        m          Network
                        checkFuncs []NetworkCheckFunc
                    )
                Severity: Minor
                Found in api/objects.pb.go - About 1 hr to fix

                  Function ConvertServiceWatch has 58 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func ConvertServiceWatch(action WatchActionKind, filters []*SelectBy) ([]Event, error) {
                      var (
                          m          Service
                          checkFuncs []ServiceCheckFunc
                      )
                  Severity: Minor
                  Found in api/objects.pb.go - About 1 hr to fix

                    Method testSuite.TestIPAMNotNil has 58 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func (suite *testSuite) TestIPAMNotNil() {
                        s := store.NewMemoryStore(nil)
                        suite.NotNil(s)
                        defer s.Close()
                    
                    
                    Severity: Minor
                    Found in manager/allocator/allocator_test_suite_linux.go - About 1 hr to fix

                      Method Node.JoinAndStart has 58 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func (n *Node) JoinAndStart(ctx context.Context) (err error) {
                          ctx, cancel := n.WithContext(ctx)
                          defer func() {
                              cancel()
                              if err != nil {
                      Severity: Minor
                      Found in manager/state/raft/raft.go - About 1 hr to fix

                        Method LogBroker.ListenSubscriptions has 58 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func (lb *LogBroker) ListenSubscriptions(request *api.ListenSubscriptionsRequest, stream api.LogBroker_ListenSubscriptionsServer) error {
                            remote, err := ca.RemoteNode(stream.Context())
                            if err != nil {
                                return err
                            }
                        Severity: Minor
                        Found in manager/logbroker/broker.go - About 1 hr to fix

                          Method Collector.Run has 58 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func (c *Collector) Run(ctx context.Context) error {
                              defer close(c.doneChan)
                          
                              watcher, cancel, err := store.ViewAndWatch(c.store, func(readTx store.ReadTx) error {
                                  nodes, err := store.FindNodes(readTx, store.All)
                          Severity: Minor
                          Found in manager/metrics/collector.go - About 1 hr to fix

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

                                    case 10:
                                        if wireType != 0 {
                                            return fmt.Errorf("proto: wrong wireType = %d for field DesiredState", wireType)
                                        }
                                        var v int
                            Severity: Major
                            Found in protobuf/plugin/plugin.pb.go and 13 other locations - About 1 hr to fix
                            protobuf/plugin/plugin.pb.go on lines 702..722
                            protobuf/plugin/plugin.pb.go on lines 723..743
                            protobuf/plugin/plugin.pb.go on lines 744..764
                            protobuf/plugin/plugin.pb.go on lines 765..785
                            protobuf/plugin/plugin.pb.go on lines 786..806
                            protobuf/plugin/plugin.pb.go on lines 807..827
                            protobuf/plugin/plugin.pb.go on lines 828..848
                            protobuf/plugin/plugin.pb.go on lines 849..869
                            protobuf/plugin/plugin.pb.go on lines 870..890
                            protobuf/plugin/plugin.pb.go on lines 912..932
                            protobuf/plugin/plugin.pb.go on lines 933..953
                            protobuf/plugin/plugin.pb.go on lines 954..974
                            protobuf/plugin/plugin.pb.go on lines 1148..1168

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

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

                                    case 12:
                                        if wireType != 0 {
                                            return fmt.Errorf("proto: wrong wireType = %d for field Membership", wireType)
                                        }
                                        var v int
                            Severity: Major
                            Found in protobuf/plugin/plugin.pb.go and 13 other locations - About 1 hr to fix
                            protobuf/plugin/plugin.pb.go on lines 702..722
                            protobuf/plugin/plugin.pb.go on lines 723..743
                            protobuf/plugin/plugin.pb.go on lines 744..764
                            protobuf/plugin/plugin.pb.go on lines 765..785
                            protobuf/plugin/plugin.pb.go on lines 786..806
                            protobuf/plugin/plugin.pb.go on lines 807..827
                            protobuf/plugin/plugin.pb.go on lines 828..848
                            protobuf/plugin/plugin.pb.go on lines 849..869
                            protobuf/plugin/plugin.pb.go on lines 870..890
                            protobuf/plugin/plugin.pb.go on lines 891..911
                            protobuf/plugin/plugin.pb.go on lines 912..932
                            protobuf/plugin/plugin.pb.go on lines 954..974
                            protobuf/plugin/plugin.pb.go on lines 1148..1168

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

                            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