docker/swarmkit

View on GitHub

Showing 1,820 of 1,820 total issues

Method SecretDriver.Get has 5 return statements (exceeds 4 allowed).
Open

func (d *SecretDriver) Get(spec *api.SecretSpec, task *api.Task) ([]byte, bool, error) {
    if spec == nil {
        return nil, false, fmt.Errorf("secret spec is nil")
    }
    if task == nil {
Severity: Major
Found in manager/drivers/secrets.go - About 35 mins to fix

    Method Allocator.reallocateNode has 5 return statements (exceeds 4 allowed).
    Open

    func (a *Allocator) reallocateNode(ctx context.Context, nodeID string) error {
        var (
            node *api.Node
        )
        a.store.View(func(tx store.ReadTx) {
    Severity: Major
    Found in manager/allocator/network.go - About 35 mins to fix

      Method Node.TransferLeadership has 5 return statements (exceeds 4 allowed).
      Open

      func (n *Node) TransferLeadership(ctx context.Context) error {
          ctx, cancelTransfer := context.WithTimeout(ctx, n.reqTimeout())
          defer cancelTransfer()
      
          n.stopMu.RLock()
      Severity: Major
      Found in manager/state/raft/raft.go - About 35 mins to fix

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

                if t.Spec.Restart != nil && t.Spec.Restart.Delay != nil {
                    var err error
                    restartDelay, err = gogotypes.DurationFromProto(t.Spec.Restart.Delay)
                    if err != nil {
                        log.G(ctx).WithError(err).Error("invalid restart delay; using default")
        Severity: Minor
        Found in manager/orchestrator/restart/restart.go and 1 other location - About 35 mins to fix
        manager/orchestrator/taskinit/init.go on lines 66..73

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

        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 t.Spec.Restart != nil && t.Spec.Restart.Delay != nil {
                        var err error
                        restartDelay, err = gogotypes.DurationFromProto(t.Spec.Restart.Delay)
                        if err != nil {
                            log.G(ctx).WithError(err).Error("invalid restart delay")
        Severity: Minor
        Found in manager/orchestrator/taskinit/init.go and 1 other location - About 35 mins to fix
        manager/orchestrator/restart/restart.go on lines 177..186

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

        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 (r resourceEntry) EventUpdate(oldObject api.StoreObject) api.Event {
            if oldObject != nil {
                return api.EventUpdateResource{Resource: r.Resource, OldResource: oldObject.(resourceEntry).Resource}
            }
            return api.EventUpdateResource{Resource: r.Resource}
        Severity: Minor
        Found in manager/state/store/resources.go and 1 other location - About 35 mins to fix
        manager/state/store/extensions.go on lines 74..79

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

        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 spec.Rollback == nil {
                spec.Rollback = Service.Rollback.Copy()
            } else {
                if spec.Rollback.Monitor == nil {
                    spec.Rollback.Monitor = &gogotypes.Duration{}
        Severity: Minor
        Found in api/defaults/service.go and 1 other location - About 35 mins to fix
        api/defaults/service.go on lines 80..87

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

        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 (e extensionEntry) EventUpdate(oldObject api.StoreObject) api.Event {
            if oldObject != nil {
                return api.EventUpdateExtension{Extension: e.Extension, OldExtension: oldObject.(extensionEntry).Extension}
            }
            return api.EventUpdateExtension{Extension: e.Extension}
        Severity: Minor
        Found in manager/state/store/extensions.go and 1 other location - About 35 mins to fix
        manager/state/store/resources.go on lines 84..89

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

        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 spec.Update == nil {
                spec.Update = Service.Update.Copy()
            } else {
                if spec.Update.Monitor == nil {
                    spec.Update.Monitor = &gogotypes.Duration{}
        Severity: Minor
        Found in api/defaults/service.go and 1 other location - About 35 mins to fix
        api/defaults/service.go on lines 89..96

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

        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 *DetachNetworkRequest) Size() (n int) {
            if m == nil {
                return 0
            }
            var l int
        Severity: Major
        Found in api/resource.pb.go and 11 other locations - About 30 mins to fix
        api/ca.pb.go on lines 1372..1383
        api/ca.pb.go on lines 1450..1461
        api/dispatcher.pb.go on lines 2823..2834
        api/dispatcher.pb.go on lines 2936..2947
        api/dispatcher.pb.go on lines 2964..2975
        api/health.pb.go on lines 479..490
        api/raft.pb.go on lines 2449..2460
        api/raft.pb.go on lines 2563..2574
        api/resource.pb.go on lines 723..734
        api/specs.pb.go on lines 4066..4077
        api/specs.pb.go on lines 4232..4243

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

        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 *ContainerSpec_PullOptions) Size() (n int) {
            if m == nil {
                return 0
            }
            var l int
        Severity: Major
        Found in api/specs.pb.go and 11 other locations - About 30 mins to fix
        api/ca.pb.go on lines 1372..1383
        api/ca.pb.go on lines 1450..1461
        api/dispatcher.pb.go on lines 2823..2834
        api/dispatcher.pb.go on lines 2936..2947
        api/dispatcher.pb.go on lines 2964..2975
        api/health.pb.go on lines 479..490
        api/raft.pb.go on lines 2449..2460
        api/raft.pb.go on lines 2563..2574
        api/resource.pb.go on lines 723..734
        api/resource.pb.go on lines 736..747
        api/specs.pb.go on lines 4066..4077

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

        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 *HeartbeatRequest) Size() (n int) {
            if m == nil {
                return 0
            }
            var l int
        Severity: Major
        Found in api/dispatcher.pb.go and 11 other locations - About 30 mins to fix
        api/ca.pb.go on lines 1372..1383
        api/ca.pb.go on lines 1450..1461
        api/dispatcher.pb.go on lines 2936..2947
        api/dispatcher.pb.go on lines 2964..2975
        api/health.pb.go on lines 479..490
        api/raft.pb.go on lines 2449..2460
        api/raft.pb.go on lines 2563..2574
        api/resource.pb.go on lines 723..734
        api/resource.pb.go on lines 736..747
        api/specs.pb.go on lines 4066..4077
        api/specs.pb.go on lines 4232..4243

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

        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 *NetworkAttachmentSpec) Size() (n int) {
            if m == nil {
                return 0
            }
            var l int
        Severity: Major
        Found in api/specs.pb.go and 11 other locations - About 30 mins to fix
        api/ca.pb.go on lines 1372..1383
        api/ca.pb.go on lines 1450..1461
        api/dispatcher.pb.go on lines 2823..2834
        api/dispatcher.pb.go on lines 2936..2947
        api/dispatcher.pb.go on lines 2964..2975
        api/health.pb.go on lines 479..490
        api/raft.pb.go on lines 2449..2460
        api/raft.pb.go on lines 2563..2574
        api/resource.pb.go on lines 723..734
        api/resource.pb.go on lines 736..747
        api/specs.pb.go on lines 4232..4243

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

        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 *HealthCheckRequest) Size() (n int) {
            if m == nil {
                return 0
            }
            var l int
        Severity: Major
        Found in api/health.pb.go and 11 other locations - About 30 mins to fix
        api/ca.pb.go on lines 1372..1383
        api/ca.pb.go on lines 1450..1461
        api/dispatcher.pb.go on lines 2823..2834
        api/dispatcher.pb.go on lines 2936..2947
        api/dispatcher.pb.go on lines 2964..2975
        api/raft.pb.go on lines 2449..2460
        api/raft.pb.go on lines 2563..2574
        api/resource.pb.go on lines 723..734
        api/resource.pb.go on lines 736..747
        api/specs.pb.go on lines 4066..4077
        api/specs.pb.go on lines 4232..4243

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

        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 *JoinRequest) Size() (n int) {
            if m == nil {
                return 0
            }
            var l int
        Severity: Major
        Found in api/raft.pb.go and 11 other locations - About 30 mins to fix
        api/ca.pb.go on lines 1372..1383
        api/ca.pb.go on lines 1450..1461
        api/dispatcher.pb.go on lines 2823..2834
        api/dispatcher.pb.go on lines 2936..2947
        api/dispatcher.pb.go on lines 2964..2975
        api/health.pb.go on lines 479..490
        api/raft.pb.go on lines 2563..2574
        api/resource.pb.go on lines 723..734
        api/resource.pb.go on lines 736..747
        api/specs.pb.go on lines 4066..4077
        api/specs.pb.go on lines 4232..4243

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

        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 *NodeCertificateStatusRequest) Size() (n int) {
            if m == nil {
                return 0
            }
            var l int
        Severity: Major
        Found in api/ca.pb.go and 11 other locations - About 30 mins to fix
        api/ca.pb.go on lines 1450..1461
        api/dispatcher.pb.go on lines 2823..2834
        api/dispatcher.pb.go on lines 2936..2947
        api/dispatcher.pb.go on lines 2964..2975
        api/health.pb.go on lines 479..490
        api/raft.pb.go on lines 2449..2460
        api/raft.pb.go on lines 2563..2574
        api/resource.pb.go on lines 723..734
        api/resource.pb.go on lines 736..747
        api/specs.pb.go on lines 4066..4077
        api/specs.pb.go on lines 4232..4243

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

        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 *ResolveAddressResponse) Size() (n int) {
            if m == nil {
                return 0
            }
            var l int
        Severity: Major
        Found in api/raft.pb.go and 11 other locations - About 30 mins to fix
        api/ca.pb.go on lines 1372..1383
        api/ca.pb.go on lines 1450..1461
        api/dispatcher.pb.go on lines 2823..2834
        api/dispatcher.pb.go on lines 2936..2947
        api/dispatcher.pb.go on lines 2964..2975
        api/health.pb.go on lines 479..490
        api/raft.pb.go on lines 2449..2460
        api/resource.pb.go on lines 723..734
        api/resource.pb.go on lines 736..747
        api/specs.pb.go on lines 4066..4077
        api/specs.pb.go on lines 4232..4243

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

        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 *GetRootCACertificateResponse) Size() (n int) {
            if m == nil {
                return 0
            }
            var l int
        Severity: Major
        Found in api/ca.pb.go and 11 other locations - About 30 mins to fix
        api/ca.pb.go on lines 1372..1383
        api/dispatcher.pb.go on lines 2823..2834
        api/dispatcher.pb.go on lines 2936..2947
        api/dispatcher.pb.go on lines 2964..2975
        api/health.pb.go on lines 479..490
        api/raft.pb.go on lines 2449..2460
        api/raft.pb.go on lines 2563..2574
        api/resource.pb.go on lines 723..734
        api/resource.pb.go on lines 736..747
        api/specs.pb.go on lines 4066..4077
        api/specs.pb.go on lines 4232..4243

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

        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 *TasksRequest) Size() (n int) {
            if m == nil {
                return 0
            }
            var l int
        Severity: Major
        Found in api/dispatcher.pb.go and 11 other locations - About 30 mins to fix
        api/ca.pb.go on lines 1372..1383
        api/ca.pb.go on lines 1450..1461
        api/dispatcher.pb.go on lines 2823..2834
        api/dispatcher.pb.go on lines 2964..2975
        api/health.pb.go on lines 479..490
        api/raft.pb.go on lines 2449..2460
        api/raft.pb.go on lines 2563..2574
        api/resource.pb.go on lines 723..734
        api/resource.pb.go on lines 736..747
        api/specs.pb.go on lines 4066..4077
        api/specs.pb.go on lines 4232..4243

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

        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 *AssignmentsRequest) Size() (n int) {
            if m == nil {
                return 0
            }
            var l int
        Severity: Major
        Found in api/dispatcher.pb.go and 11 other locations - About 30 mins to fix
        api/ca.pb.go on lines 1372..1383
        api/ca.pb.go on lines 1450..1461
        api/dispatcher.pb.go on lines 2823..2834
        api/dispatcher.pb.go on lines 2936..2947
        api/health.pb.go on lines 479..490
        api/raft.pb.go on lines 2449..2460
        api/raft.pb.go on lines 2563..2574
        api/resource.pb.go on lines 723..734
        api/resource.pb.go on lines 736..747
        api/specs.pb.go on lines 4066..4077
        api/specs.pb.go on lines 4232..4243

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

        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