mesg-foundation/core

View on GitHub

Showing 207 of 208 total issues

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

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

          func (c *RPC) setAccountSequence(seq uint64) error {
              c.accountMutex.Lock()
              defer c.accountMutex.Unlock()
              if c.acc == nil {
                  return fmt.Errorf("c.acc should not be nil. use GetAccount first")
          Severity: Minor
          Found in cosmos/rpc.go and 1 other location - About 30 mins to fix
          cosmos/lcd.go on lines 199..206

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

          func (lcd *LCD) setAccountSequence(seq uint64) error {
              lcd.accountMutex.Lock()
              defer lcd.accountMutex.Unlock()
              if lcd.acc == nil {
                  return fmt.Errorf("lcd.acc should not be nil. use getAccount first")
          Severity: Minor
          Found in cosmos/lcd.go and 1 other location - About 30 mins to fix
          cosmos/rpc.go on lines 193..200

          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

          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

          Your code does not pass gofmt in 1 place. Go fmt your code!
          Open

          // +build tools
          Severity: Minor
          Found in internal/tools/tools.go by gofmt

          comment on exported type Keeper should be of the form "Keeper ..." (with optional leading article)
          Open

          // module types
          Severity: Minor
          Found in x/process/alias.go by golint

          comment on exported type GenesisState should be of the form "GenesisState ..." (with optional leading article)
          Open

          // module types
          Severity: Minor
          Found in x/ownership/alias.go by golint

          comment on exported type GenesisState should be of the form "GenesisState ..." (with optional leading article)
          Open

          // module types
          Severity: Minor
          Found in x/service/alias.go by golint

          a blank import should be only in a main or test package, or have a comment justifying it
          Open

              _ "github.com/go-bindata/go-bindata/go-bindata"
          Severity: Minor
          Found in internal/tools/tools.go by golint

          comment on exported type Params should be of the form "Params ..." (with optional leading article)
          Open

          // module types
          Severity: Minor
          Found in x/credit/alias.go by golint

          comment on exported type Keeper should be of the form "Keeper ..." (with optional leading article)
          Open

          // module types
          Severity: Minor
          Found in x/execution/alias.go by golint

          comment on exported type MsgUpdateError should be of the form "MsgUpdateError ..." (with optional leading article)
          Open

          // module types
          Severity: Minor
          Found in x/execution/alias.go by golint

          comment on exported type Keeper should be of the form "Keeper ..." (with optional leading article)
          Open

          // module types
          Severity: Minor
          Found in x/service/alias.go by golint

          comment on exported function IsDomainName should be of the form "IsDomainName ..."
          Open

          // Source: https://golang.org/src/net/dnsclient.go
          Severity: Minor
          Found in ext/xnet/dnsclient.go by golint

          comment on exported type Keeper should be of the form "Keeper ..." (with optional leading article)
          Open

          // module types
          Severity: Minor
          Found in x/instance/alias.go by golint
          Severity
          Category
          Status
          Source
          Language