mesg-foundation/core

View on GitHub

Showing 207 of 208 total issues

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

func (s *Orchestrator) resultFilter(exec *execution.Execution) func(wf *process.Process, node *process.Process_Node) (bool, error) {
    return func(wf *process.Process, node *process.Process_Node) (bool, error) {
        if result := node.GetResult(); result != nil {
            return result.InstanceHash.Equal(exec.InstanceHash) && result.TaskKey == exec.TaskKey, nil
        }
Severity: Major
Found in orchestrator/orchestrator.go and 1 other location - About 1 hr to fix
orchestrator/orchestrator.go on lines 83..90

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

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 (s *Orchestrator) eventFilter(event *event.Event) func(wf *process.Process, node *process.Process_Node) (bool, error) {
    return func(wf *process.Process, node *process.Process_Node) (bool, error) {
        if e := node.GetEvent(); e != nil {
            return e.InstanceHash.Equal(event.InstanceHash) && e.EventKey == event.Key, nil
        }
Severity: Major
Found in orchestrator/orchestrator.go and 1 other location - About 1 hr to fix
orchestrator/orchestrator.go on lines 92..99

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

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 executionServer.Stream has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring.
Open

func (s *executionServer) Stream(req *ExecutionStreamRequest, stream Execution_StreamServer) error {
    // check authorization
    if err := s.auth.IsAuthorized(stream.Context(), req); err != nil {
        return err
    }
Severity: Minor
Found in server/grpc/orchestrator/execution.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

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

func (m Process_Node_Map_Output_Map) MarshalAmino() ([]KeyOutput, error) {
    p := make([]KeyOutput, len(m.Outputs))
    outputKeys := make([]string, len(m.Outputs))
    i := 0
    for key := range m.Outputs {
Severity: Major
Found in process/codec.go and 2 other locations - About 1 hr to fix
process/codec.go on lines 44..60
protobuf/types/struct.go on lines 14..30

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

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 Process_Node_Map) MarshalAmino() ([]KeyOutput, error) {
    p := make([]KeyOutput, len(m.Outputs))
    outputKeys := make([]string, len(m.Outputs))
    i := 0
    for key := range m.Outputs {
Severity: Major
Found in process/codec.go and 2 other locations - About 1 hr to fix
process/codec.go on lines 72..88
protobuf/types/struct.go on lines 14..30

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

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 Struct) MarshalAmino() ([]KeyValue, error) {
    p := make([]KeyValue, len(m.Fields))
    fieldKeys := make([]string, len(m.Fields))
    i := 0
    for key := range m.Fields {
Severity: Major
Found in protobuf/types/struct.go and 2 other locations - About 1 hr to fix
process/codec.go on lines 44..60
process/codec.go on lines 72..88

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

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 Server.Execution has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring.
Open

func (s *Server) Execution(req *ExecutionRequest, stream Runner_ExecutionServer) error {
    // check authorization and get runner hash
    runnerHash, err := s.isAuthorized(stream.Context())
    if err != nil {
        return err
Severity: Minor
Found in server/grpc/runner/runner.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

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

func NewHandler(k Keeper) sdk.Handler {
    return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) {
        ctx = ctx.WithEventManager(sdk.NewEventManager())
        switch msg := msg.(type) {
        case MsgWithdraw:
Severity: Major
Found in x/ownership/handler.go and 1 other location - About 1 hr to fix
x/credit/handler.go on lines 12..23

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

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 NewHandler(k Keeper) sdk.Handler {
    return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) {
        ctx = ctx.WithEventManager(sdk.NewEventManager())
        switch msg := msg.(type) {
        case MsgAdd:
Severity: Major
Found in x/credit/handler.go and 1 other location - About 1 hr to fix
x/ownership/handler.go on lines 12..23

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

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 runnerServer.Register has 60 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (s *runnerServer) Register(ctx context.Context, req *RunnerRegisterRequest) (*RunnerRegisterResponse, error) {
    // check authorization
    if err := s.auth.IsAuthorized(ctx, req); err != nil {
        return nil, err
    }
Severity: Minor
Found in server/grpc/orchestrator/runner.go - About 1 hr to fix

    Method Keeper.Create has 16 return statements (exceeds 6 allowed).
    Open

    func (k *Keeper) Create(ctx sdk.Context, msg types.MsgCreate) (*executionpb.Execution, error) {
        run, err := k.runnerKeeper.Get(ctx, msg.ExecutorHash)
        if err != nil {
            return nil, err
        }
    Severity: Major
    Found in x/execution/internal/keeper/keeper.go - About 1 hr to fix

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

      func (k *Keeper) Import(ctx sdk.Context, services []*servicepb.Service) error {
          store := ctx.KVStore(k.storeKey)
          for _, serv := range services {
              value, err := k.cdc.MarshalBinaryLengthPrefixed(serv)
              if err != nil {
      Severity: Major
      Found in x/service/internal/keeper/keeper.go and 5 other locations - About 1 hr to fix
      x/execution/internal/keeper/keeper.go on lines 430..440
      x/instance/internal/keeper/keeper.go on lines 101..111
      x/ownership/internal/keeper/keeper.go on lines 173..183
      x/process/internal/keeper/keeper.go on lines 157..167
      x/runner/internal/keeper/keeper.go on lines 154..164

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

      func (k *Keeper) Import(ctx sdk.Context, instances []*instance.Instance) error {
          store := ctx.KVStore(k.storeKey)
          for _, inst := range instances {
              value, err := k.cdc.MarshalBinaryLengthPrefixed(inst)
              if err != nil {
      Severity: Major
      Found in x/instance/internal/keeper/keeper.go and 5 other locations - About 1 hr to fix
      x/execution/internal/keeper/keeper.go on lines 430..440
      x/ownership/internal/keeper/keeper.go on lines 173..183
      x/process/internal/keeper/keeper.go on lines 157..167
      x/runner/internal/keeper/keeper.go on lines 154..164
      x/service/internal/keeper/keeper.go on lines 122..132

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

      func (k *Keeper) Import(ctx sdk.Context, ownerships []*ownership.Ownership) error {
          store := ctx.KVStore(k.storeKey)
          for _, own := range ownerships {
              value, err := k.cdc.MarshalBinaryLengthPrefixed(own)
              if err != nil {
      Severity: Major
      Found in x/ownership/internal/keeper/keeper.go and 5 other locations - About 1 hr to fix
      x/execution/internal/keeper/keeper.go on lines 430..440
      x/instance/internal/keeper/keeper.go on lines 101..111
      x/process/internal/keeper/keeper.go on lines 157..167
      x/runner/internal/keeper/keeper.go on lines 154..164
      x/service/internal/keeper/keeper.go on lines 122..132

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

      func (k *Keeper) Import(ctx sdk.Context, runners []*runner.Runner) error {
          store := ctx.KVStore(k.storeKey)
          for _, run := range runners {
              value, err := k.cdc.MarshalBinaryLengthPrefixed(run)
              if err != nil {
      Severity: Major
      Found in x/runner/internal/keeper/keeper.go and 5 other locations - About 1 hr to fix
      x/execution/internal/keeper/keeper.go on lines 430..440
      x/instance/internal/keeper/keeper.go on lines 101..111
      x/ownership/internal/keeper/keeper.go on lines 173..183
      x/process/internal/keeper/keeper.go on lines 157..167
      x/service/internal/keeper/keeper.go on lines 122..132

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

      func (k *Keeper) Import(ctx sdk.Context, processes []*process.Process) error {
          store := ctx.KVStore(k.storeKey)
          for _, proc := range processes {
              value, err := k.cdc.MarshalBinaryLengthPrefixed(proc)
              if err != nil {
      Severity: Major
      Found in x/process/internal/keeper/keeper.go and 5 other locations - About 1 hr to fix
      x/execution/internal/keeper/keeper.go on lines 430..440
      x/instance/internal/keeper/keeper.go on lines 101..111
      x/ownership/internal/keeper/keeper.go on lines 173..183
      x/runner/internal/keeper/keeper.go on lines 154..164
      x/service/internal/keeper/keeper.go on lines 122..132

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

      func (k *Keeper) Import(ctx sdk.Context, execs []*executionpb.Execution) error {
          store := ctx.KVStore(k.storeKey)
          for _, exec := range execs {
              value, err := k.cdc.MarshalBinaryLengthPrefixed(exec)
              if err != nil {
      Severity: Major
      Found in x/execution/internal/keeper/keeper.go and 5 other locations - About 1 hr to fix
      x/instance/internal/keeper/keeper.go on lines 101..111
      x/ownership/internal/keeper/keeper.go on lines 173..183
      x/process/internal/keeper/keeper.go on lines 157..167
      x/runner/internal/keeper/keeper.go on lines 154..164
      x/service/internal/keeper/keeper.go on lines 122..132

      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

      Method Service.validateData has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring.
      Open

      func (s *Service) validateData() error {
          var errs xerrors.Errors
          if err := s.areKeysUnique(); err != nil {
              errs = append(errs, err)
          }
      Severity: Minor
      Found in service/validate.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

      Method Container.Start has 15 return statements (exceeds 6 allowed).
      Open

      func (c *Container) Start(srv *service.Service, instanceHash, runnerHash, instanceEnvHash hash.Hash, instanceEnv []string, registerPayload []byte) (err error) {
          // delete the service's container on any error
          errorOccurred := true
          defer func() {
              if errorOccurred {
      Severity: Major
      Found in container/container.go - About 1 hr to fix

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

        func registerQueryRoutes(cliCtx context.CLIContext, r *mux.Router) {
            r.HandleFunc(
                "/service/get/{hash}",
                queryGetHandlerFn(cliCtx),
            ).Methods(http.MethodGet)
        Severity: Major
        Found in x/service/client/rest/query.go and 2 other locations - About 1 hr to fix
        x/process/client/rest/query.go on lines 16..36
        x/runner/client/rest/query.go on lines 17..37

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

        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