mesg-foundation/core

View on GitHub

Showing 56 of 208 total issues

Method executionServer.Stream has 8 return statements (exceeds 6 allowed).
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: Major
Found in server/grpc/orchestrator/execution.go - About 40 mins to fix

    Method Process.Validate has 8 return statements (exceeds 6 allowed).
    Open

    func (w *Process) Validate() error {
        if err := xvalidator.Struct(w); err != nil {
            return err
        }
        if err := w.validate(); err != nil {
    Severity: Major
    Found in process/process.go - About 40 mins to fix

      Method Orchestrator.resolveRef has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      func (s *Orchestrator) resolveRef(wf *process.Process, exec *execution.Execution, nodeKey string, data *types.Struct, ref *process.Process_Node_Reference) (*types.Value, error) {
      Severity: Minor
      Found in orchestrator/orchestrator.go - About 35 mins to fix

        Method Orchestrator.filterMatch has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        func (s *Orchestrator) filterMatch(f *process.Process_Node_Filter, wf *process.Process, n *process.Process_Node, exec *execution.Execution, data *types.Struct) bool {
        Severity: Minor
        Found in orchestrator/orchestrator.go - About 35 mins to fix

          Method Orchestrator.executeNode has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          func (s *Orchestrator) executeNode(wf *process.Process, n *process.Process_Node, exec *execution.Execution, event *event.Event, data *types.Struct) error {
          Severity: Minor
          Found in orchestrator/orchestrator.go - About 35 mins to fix

            Method Orchestrator.processMap has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            func (s *Orchestrator) processMap(nodeKey string, outputs map[string]*process.Process_Node_Map_Output, wf *process.Process, exec *execution.Execution, data *types.Struct) (*types.Struct, error) {
            Severity: Minor
            Found in orchestrator/orchestrator.go - About 35 mins to fix

              Function keyvals has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              func keyvals(proc *process.Process, node *process.Process_Node, parentExec *execution.Execution, event *event.Event, data *types.Struct) []interface{} {
              Severity: Minor
              Found in orchestrator/orchestrator.go - About 35 mins to fix

                Method Orchestrator.outputToValue has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                func (s *Orchestrator) outputToValue(nodeKey string, output *process.Process_Node_Map_Output, wf *process.Process, exec *execution.Execution, data *types.Struct) (*types.Value, error) {
                Severity: Minor
                Found in orchestrator/orchestrator.go - About 35 mins to fix

                  Method Keeper.Set has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  func (k Keeper) Set(ctx sdk.Context, owner sdk.AccAddress, resourceHash hash.Hash, resource ownership.Ownership_Resource, resourceAddress sdk.AccAddress) (*ownership.Ownership, error) {
                  Severity: Minor
                  Found in x/ownership/internal/keeper/keeper.go - About 35 mins to fix

                    Method ExecutionStreamRequest_Filter.Match has 7 return statements (exceeds 6 allowed).
                    Open

                    func (f *ExecutionStreamRequest_Filter) Match(e *execution.Execution) bool {
                        if f == nil {
                            return true
                        }
                        if !f.ExecutorHash.IsZero() && !f.ExecutorHash.Equal(e.ExecutorHash) {
                    Severity: Major
                    Found in server/grpc/orchestrator/execution.go - About 35 mins to fix

                      Method ListFilter.Match has 7 return statements (exceeds 6 allowed).
                      Open

                      func (f ListFilter) Match(exec *execution.Execution) bool {
                          if f.Status != execution.Status_Unknown && f.Status != exec.Status {
                              return false
                          }
                          if !f.ProcessHash.IsZero() && !f.ProcessHash.Equal(exec.ProcessHash) {
                      Severity: Major
                      Found in x/execution/internal/types/querier.go - About 35 mins to fix

                        Method LCD.BroadcastMsgs has 7 return statements (exceeds 6 allowed).
                        Open

                        func (lcd *LCD) BroadcastMsgs(msgs []sdk.Msg) ([]byte, error) {
                            // Lock the getAccount + create and sign tx + broadcast
                            lcd.broadcastMutex.Lock()
                            defer lcd.broadcastMutex.Unlock()
                        
                        
                        Severity: Major
                        Found in cosmos/lcd.go - About 35 mins to fix

                          Method Authorizer.IsAuthorized has 7 return statements (exceeds 6 allowed).
                          Open

                          func (a *Authorizer) IsAuthorized(ctx context.Context, payload interface{}) error {
                              md, ok := metadata.FromIncomingContext(ctx)
                              if !ok {
                                  return fmt.Errorf("signature not found in metadata, make sure to set it using the key %q", RequestSignature)
                              }
                          Severity: Major
                          Found in server/grpc/orchestrator/authorizer.go - About 35 mins to fix

                            Method Process_Node_Reference_Path.Resolve has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
                            Open

                            func (path *Process_Node_Reference_Path) Resolve(data *types.Struct) (*types.Value, error) {
                                if path == nil {
                                    return &types.Value{Kind: &types.Value_StructValue{StructValue: data}}, nil
                                }
                            
                            
                            Severity: Minor
                            Found in process/ref.go - About 25 mins 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 startOrchestratorCmd has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
                            Open

                            func startOrchestratorCmd(cdc *codec.Codec) *cobra.Command {
                                cmd := &cobra.Command{
                                    Use:   "start",
                                    Short: "Start the Orchestrator",
                                    RunE: func(cmd *cobra.Command, args []string) error {
                            Severity: Minor
                            Found in cmd/mesg-cli/orchestrator.go - About 25 mins 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 Keeper.Update has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
                            Open

                            func (k *Keeper) Update(ctx sdk.Context, msg types.MsgUpdate) (*executionpb.Execution, error) {
                                store := ctx.KVStore(k.storeKey)
                                if !store.Has(msg.Hash) {
                                    return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "execution %q doesn't exist", msg.Hash)
                                }
                            Severity: Minor
                            Found in x/execution/internal/keeper/keeper.go - About 25 mins 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

                            Severity
                            Category
                            Status
                            Source
                            Language