docker/swarmkit

View on GitHub

Showing 1,820 of 1,820 total issues

Function skipRaft has 11 return statements (exceeds 4 allowed).
Open

func skipRaft(dAtA []byte) (n int, err error) {
    l := len(dAtA)
    iNdEx := 0
    depth := 0
    for iNdEx < l {
Severity: Major
Found in api/raft.pb.go - About 1 hr to fix

    Method Server.UpdateCluster has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring.
    Open

    func (s *Server) UpdateCluster(ctx context.Context, request *api.UpdateClusterRequest) (*api.UpdateClusterResponse, error) {
        if request.ClusterID == "" || request.ClusterVersion == nil {
            return nil, status.Errorf(codes.InvalidArgument, errInvalidArgument.Error())
        }
        if err := validateClusterSpec(request.Spec); err != nil {
    Severity: Minor
    Found in manager/controlapi/cluster.go - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function validateConfigRefsSpec has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring.
    Open

    func validateConfigRefsSpec(spec api.TaskSpec) error {
        container := spec.GetContainer()
        if container == nil {
            return nil
        }
    Severity: Minor
    Found in manager/controlapi/service.go - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function validateHealthCheck has 11 return statements (exceeds 4 allowed).
    Open

    func validateHealthCheck(hc *api.HealthConfig) error {
        if hc == nil {
            return nil
        }
    
    
    Severity: Major
    Found in manager/controlapi/service.go - About 1 hr to fix

      Method Node.processInternalRaftRequest has 11 return statements (exceeds 4 allowed).
      Open

      func (n *Node) processInternalRaftRequest(ctx context.Context, r *api.InternalRaftRequest, cb func()) (proto.Message, error) {
          n.stopMu.RLock()
          if !n.IsMember() {
              n.stopMu.RUnlock()
              return nil, ErrStopped
      Severity: Major
      Found in manager/state/raft/raft.go - About 1 hr to fix

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

            if request.Filters != nil {
                for _, name := range request.Filters.Names {
                    byFilters = append(byFilters, store.ByName(name))
                }
                for _, prefix := range request.Filters.NamePrefixes {
        Severity: Major
        Found in manager/controlapi/config.go and 1 other location - About 1 hr to fix
        manager/controlapi/secret.go on lines 109..120

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

        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

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

            if request.Filters != nil {
                for _, name := range request.Filters.Names {
                    byFilters = append(byFilters, store.ByName(name))
                }
                for _, prefix := range request.Filters.NamePrefixes {
        Severity: Major
        Found in manager/controlapi/secret.go and 1 other location - About 1 hr to fix
        manager/controlapi/config.go on lines 109..120

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

        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

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

                for _, taskID := range restartTasks {
                    if err := batch.Update(func(tx store.Tx) error {
                        // get the latest version of the task for the restart
                        t := store.GetTask(tx, taskID)
                        // if it's deleted, nothing to do
        Severity: Major
        Found in manager/orchestrator/jobs/global/reconciler.go and 1 other location - About 1 hr to fix
        manager/orchestrator/jobs/replicated/reconciler.go on lines 231..247

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

        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

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

                for _, taskID := range restartTasks {
                    if err := batch.Update(func(tx store.Tx) error {
                        t := store.GetTask(tx, taskID)
                        if t == nil {
                            return nil
        Severity: Major
        Found in manager/orchestrator/jobs/replicated/reconciler.go and 1 other location - About 1 hr to fix
        manager/orchestrator/jobs/global/reconciler.go on lines 186..210

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

        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

            downgradeKeyCmd = &cobra.Command{
                Use:   "downgrade-key",
                Short: "Downgrade swarm node key from PKCS8 to PKCS1",
                RunE: func(cmd *cobra.Command, args []string) error {
                    stateDir, err := cmd.Flags().GetString("state-dir")
        Severity: Major
        Found in swarmd/cmd/swarm-rafttool/main.go and 1 other location - About 1 hr to fix
        swarmd/cmd/swarm-rafttool/main.go on lines 161..177

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

        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

            renewCertsCmd = &cobra.Command{
                Use:   "renew-certs",
                Short: "Renew expired manager cert",
                RunE: func(cmd *cobra.Command, args []string) error {
                    stateDir, err := cmd.Flags().GetString("state-dir")
        Severity: Major
        Found in swarmd/cmd/swarm-rafttool/main.go and 1 other location - About 1 hr to fix
        swarmd/cmd/swarm-rafttool/main.go on lines 143..159

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

        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 LogBroker.SubscribeLogs has 52 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (lb *LogBroker) SubscribeLogs(request *api.SubscribeLogsRequest, stream api.Logs_SubscribeLogsServer) error {
            ctx := stream.Context()
        
            if err := validateSelector(request.Selector); err != nil {
                return err
        Severity: Minor
        Found in manager/logbroker/broker.go - About 1 hr to fix

          Method MemoryStore.update has 52 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (s *MemoryStore) update(proposer state.Proposer, cb func(Tx) error) error {
              defer metrics.StartTimer(updateLatencyTimer)()
              s.updateLock.Lock()
              memDBTx := s.memDB.Txn(true)
          
          
          Severity: Minor
          Found in manager/state/store/memory.go - About 1 hr to fix

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

                case EventUpdateConfig:
                    if v.OldConfig != nil {
                        return &WatchMessage_Event{Action: WatchActionKindUpdate, Object: &Object{Object: &Object_Config{Config: v.Config}}, OldObject: &Object{Object: &Object_Config{Config: v.OldConfig}}}
                    } else {
                        return &WatchMessage_Event{Action: WatchActionKindUpdate, Object: &Object{Object: &Object_Config{Config: v.Config}}}
            Severity: Major
            Found in api/objects.pb.go and 9 other locations - About 1 hr to fix
            api/objects.pb.go on lines 5871..5876
            api/objects.pb.go on lines 5881..5886
            api/objects.pb.go on lines 5891..5896
            api/objects.pb.go on lines 5901..5906
            api/objects.pb.go on lines 5911..5916
            api/objects.pb.go on lines 5921..5926
            api/objects.pb.go on lines 5941..5946
            api/objects.pb.go on lines 5951..5956
            api/objects.pb.go on lines 5961..5966

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

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

                case EventUpdateCluster:
                    if v.OldCluster != nil {
                        return &WatchMessage_Event{Action: WatchActionKindUpdate, Object: &Object{Object: &Object_Cluster{Cluster: v.Cluster}}, OldObject: &Object{Object: &Object_Cluster{Cluster: v.OldCluster}}}
                    } else {
                        return &WatchMessage_Event{Action: WatchActionKindUpdate, Object: &Object{Object: &Object_Cluster{Cluster: v.Cluster}}}
            Severity: Major
            Found in api/objects.pb.go and 9 other locations - About 1 hr to fix
            api/objects.pb.go on lines 5871..5876
            api/objects.pb.go on lines 5881..5886
            api/objects.pb.go on lines 5891..5896
            api/objects.pb.go on lines 5901..5906
            api/objects.pb.go on lines 5921..5926
            api/objects.pb.go on lines 5931..5936
            api/objects.pb.go on lines 5941..5946
            api/objects.pb.go on lines 5951..5956
            api/objects.pb.go on lines 5961..5966

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

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

                case EventUpdateNetwork:
                    if v.OldNetwork != nil {
                        return &WatchMessage_Event{Action: WatchActionKindUpdate, Object: &Object{Object: &Object_Network{Network: v.Network}}, OldObject: &Object{Object: &Object_Network{Network: v.OldNetwork}}}
                    } else {
                        return &WatchMessage_Event{Action: WatchActionKindUpdate, Object: &Object{Object: &Object_Network{Network: v.Network}}}
            Severity: Major
            Found in api/objects.pb.go and 9 other locations - About 1 hr to fix
            api/objects.pb.go on lines 5871..5876
            api/objects.pb.go on lines 5881..5886
            api/objects.pb.go on lines 5891..5896
            api/objects.pb.go on lines 5911..5916
            api/objects.pb.go on lines 5921..5926
            api/objects.pb.go on lines 5931..5936
            api/objects.pb.go on lines 5941..5946
            api/objects.pb.go on lines 5951..5956
            api/objects.pb.go on lines 5961..5966

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

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

                case EventUpdateExtension:
                    if v.OldExtension != nil {
                        return &WatchMessage_Event{Action: WatchActionKindUpdate, Object: &Object{Object: &Object_Extension{Extension: v.Extension}}, OldObject: &Object{Object: &Object_Extension{Extension: v.OldExtension}}}
                    } else {
                        return &WatchMessage_Event{Action: WatchActionKindUpdate, Object: &Object{Object: &Object_Extension{Extension: v.Extension}}}
            Severity: Major
            Found in api/objects.pb.go and 9 other locations - About 1 hr to fix
            api/objects.pb.go on lines 5871..5876
            api/objects.pb.go on lines 5881..5886
            api/objects.pb.go on lines 5891..5896
            api/objects.pb.go on lines 5901..5906
            api/objects.pb.go on lines 5911..5916
            api/objects.pb.go on lines 5921..5926
            api/objects.pb.go on lines 5931..5936
            api/objects.pb.go on lines 5941..5946
            api/objects.pb.go on lines 5961..5966

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

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

                case EventUpdateResource:
                    if v.OldResource != nil {
                        return &WatchMessage_Event{Action: WatchActionKindUpdate, Object: &Object{Object: &Object_Resource{Resource: v.Resource}}, OldObject: &Object{Object: &Object_Resource{Resource: v.OldResource}}}
                    } else {
                        return &WatchMessage_Event{Action: WatchActionKindUpdate, Object: &Object{Object: &Object_Resource{Resource: v.Resource}}}
            Severity: Major
            Found in api/objects.pb.go and 9 other locations - About 1 hr to fix
            api/objects.pb.go on lines 5871..5876
            api/objects.pb.go on lines 5881..5886
            api/objects.pb.go on lines 5891..5896
            api/objects.pb.go on lines 5901..5906
            api/objects.pb.go on lines 5911..5916
            api/objects.pb.go on lines 5921..5926
            api/objects.pb.go on lines 5931..5936
            api/objects.pb.go on lines 5951..5956
            api/objects.pb.go on lines 5961..5966

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

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

                case EventUpdateSecret:
                    if v.OldSecret != nil {
                        return &WatchMessage_Event{Action: WatchActionKindUpdate, Object: &Object{Object: &Object_Secret{Secret: v.Secret}}, OldObject: &Object{Object: &Object_Secret{Secret: v.OldSecret}}}
                    } else {
                        return &WatchMessage_Event{Action: WatchActionKindUpdate, Object: &Object{Object: &Object_Secret{Secret: v.Secret}}}
            Severity: Major
            Found in api/objects.pb.go and 9 other locations - About 1 hr to fix
            api/objects.pb.go on lines 5871..5876
            api/objects.pb.go on lines 5881..5886
            api/objects.pb.go on lines 5891..5896
            api/objects.pb.go on lines 5901..5906
            api/objects.pb.go on lines 5911..5916
            api/objects.pb.go on lines 5931..5936
            api/objects.pb.go on lines 5941..5946
            api/objects.pb.go on lines 5951..5956
            api/objects.pb.go on lines 5961..5966

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

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

                case EventUpdateTask:
                    if v.OldTask != nil {
                        return &WatchMessage_Event{Action: WatchActionKindUpdate, Object: &Object{Object: &Object_Task{Task: v.Task}}, OldObject: &Object{Object: &Object_Task{Task: v.OldTask}}}
                    } else {
                        return &WatchMessage_Event{Action: WatchActionKindUpdate, Object: &Object{Object: &Object_Task{Task: v.Task}}}
            Severity: Major
            Found in api/objects.pb.go and 9 other locations - About 1 hr to fix
            api/objects.pb.go on lines 5871..5876
            api/objects.pb.go on lines 5881..5886
            api/objects.pb.go on lines 5901..5906
            api/objects.pb.go on lines 5911..5916
            api/objects.pb.go on lines 5921..5926
            api/objects.pb.go on lines 5931..5936
            api/objects.pb.go on lines 5941..5946
            api/objects.pb.go on lines 5951..5956
            api/objects.pb.go on lines 5961..5966

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

            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