aergoio/aergo-actor

View on GitHub

Showing 33 of 64 total issues

localContext has 48 methods (exceeds 20 allowed). Consider refactoring.
Open

type localContext struct {
    message            interface{}
    parent             *PID
    self               *PID
    actor              Actor
Severity: Minor
Found in actor/local_context.go - About 6 hrs to fix

    Method HelloActor.Receive has a Cognitive Complexity of 36 (exceeds 20 allowed). Consider refactoring.
    Open

    func (a *HelloActor) Receive(ctx actor.Context) {
        switch msg := ctx.Message().(type) {
        case *actor.Started:
            a.inner = xHelloFactory()
            id := ctx.Self().Id
    Severity: Minor
    Found in examples/cluster-metrics/shared/protos_protoactor.go - About 2 hrs 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 HelloActor.Receive has a Cognitive Complexity of 36 (exceeds 20 allowed). Consider refactoring.
    Open

    func (a *HelloActor) Receive(ctx actor.Context) {
        switch msg := ctx.Message().(type) {
        case *actor.Started:
            a.inner = xHelloFactory()
            id := ctx.Self().Id
    Severity: Minor
    Found in examples/cluster/shared/protos_protoactor.go - About 2 hrs 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 memberListValue.updateAndNotify has 79 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (ml *memberListValue) updateAndNotify(new *MemberStatus, old *MemberStatus) {
    
        if new == nil && old == nil {
            //ignore, not possible
            return
    Severity: Major
    Found in cluster/member_list.go - About 2 hrs to fix

      Method memberListValue.updateAndNotify has a Cognitive Complexity of 31 (exceeds 20 allowed). Consider refactoring.
      Open

      func (ml *memberListValue) updateAndNotify(new *MemberStatus, old *MemberStatus) {
      
          if new == nil && old == nil {
              //ignore, not possible
              return
      Severity: Minor
      Found in cluster/member_list.go - About 2 hrs 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 main has 73 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func main() {
          flag.Parse()
          if *cpuprofile != "" {
              f, err := os.Create(*cpuprofile)
              if err != nil {
      Severity: Minor
      Found in examples/inprocessbenchmark/main.go - About 1 hr to fix

        Method HelloActor.Receive has 67 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (a *HelloActor) Receive(ctx actor.Context) {
            switch msg := ctx.Message().(type) {
            case *actor.Started:
                a.inner = xHelloFactory()
                id := ctx.Self().Id
        Severity: Minor
        Found in examples/cluster-metrics/shared/protos_protoactor.go - About 1 hr to fix

          Method HelloActor.Receive has 67 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (a *HelloActor) Receive(ctx actor.Context) {
              switch msg := ctx.Message().(type) {
              case *actor.Started:
                  a.inner = xHelloFactory()
                  id := ctx.Self().Id
          Severity: Minor
          Found in examples/cluster/shared/protos_protoactor.go - About 1 hr to fix

            Method endpointWatcher.Receive has 62 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (state *endpointWatcher) Receive(ctx actor.Context) {
                switch msg := ctx.Message().(type) {
                case *actor.Started:
                    state.initialize()
            
            
            Severity: Minor
            Found in remote/endpoint_watcher.go - About 1 hr to fix

              Function main has 56 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func main() {
                  logo := `
                   ___         _         ___ _    ___
                  | _ \_ _ ___| |_ ___  / __| |  |_ _|
                  |  _/ '_/ _ \  _/ _ \| (__| |__ | |
              Severity: Minor
              Found in cli/main.go - About 1 hr to fix

                Method endpointWriter.sendEnvelopes has 53 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (state *endpointWriter) sendEnvelopes(msg []interface{}, ctx actor.Context) {
                    envelopes := make([]*MessageEnvelope, len(msg))
                
                    //type name uniqueness map name string to type index
                    typeNames := make(map[string]int32)
                Severity: Minor
                Found in remote/endpoint_writer.go - About 1 hr to fix

                  Method defaultMailbox.run has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func (m *defaultMailbox) run() {
                      var msg interface{}
                  
                      defer func() {
                          if r := recover(); r != nil {
                  Severity: Minor
                  Found in mailbox/mailbox.go - About 55 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 HelloGrain.SayHelloWithOpts has 7 return statements (exceeds 4 allowed).
                  Open

                  func (g *HelloGrain) SayHelloWithOpts(r *HelloRequest, opts *cluster.GrainCallOptions) (*HelloResponse, error) {
                      fun := func() (*HelloResponse, error) {
                              pid, statusCode := cluster.Get(g.ID, "Hello")
                              if statusCode != remote.ResponseStatusCodeOK {
                                  return nil, fmt.Errorf("Get PID failed with StatusCode: %v", statusCode)
                  Severity: Major
                  Found in examples/cluster/shared/protos_protoactor.go - About 45 mins to fix

                    Method HelloGrain.AddWithOpts has 7 return statements (exceeds 4 allowed).
                    Open

                    func (g *HelloGrain) AddWithOpts(r *AddRequest, opts *cluster.GrainCallOptions) (*AddResponse, error) {
                        fun := func() (*AddResponse, error) {
                                pid, statusCode := cluster.Get(g.ID, "Hello")
                                if statusCode != remote.ResponseStatusCodeOK {
                                    return nil, fmt.Errorf("Get PID failed with StatusCode: %v", statusCode)
                    Severity: Major
                    Found in examples/cluster-metrics/shared/protos_protoactor.go - About 45 mins to fix

                      Method HelloGrain.VoidFuncWithOpts has 7 return statements (exceeds 4 allowed).
                      Open

                      func (g *HelloGrain) VoidFuncWithOpts(r *AddRequest, opts *cluster.GrainCallOptions) (*Unit, error) {
                          fun := func() (*Unit, error) {
                                  pid, statusCode := cluster.Get(g.ID, "Hello")
                                  if statusCode != remote.ResponseStatusCodeOK {
                                      return nil, fmt.Errorf("Get PID failed with StatusCode: %v", statusCode)
                      Severity: Major
                      Found in examples/cluster-metrics/shared/protos_protoactor.go - About 45 mins to fix

                        Method HelloGrain.AddWithOpts has 7 return statements (exceeds 4 allowed).
                        Open

                        func (g *HelloGrain) AddWithOpts(r *AddRequest, opts *cluster.GrainCallOptions) (*AddResponse, error) {
                            fun := func() (*AddResponse, error) {
                                    pid, statusCode := cluster.Get(g.ID, "Hello")
                                    if statusCode != remote.ResponseStatusCodeOK {
                                        return nil, fmt.Errorf("Get PID failed with StatusCode: %v", statusCode)
                        Severity: Major
                        Found in examples/cluster/shared/protos_protoactor.go - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                      if !aErr.DoNotPanic {
                                          panic(err)
                                      }
                          Severity: Major
                          Found in remote/activator_actor.go - About 45 mins to fix

                            Method HelloGrain.SayHelloWithOpts has 7 return statements (exceeds 4 allowed).
                            Open

                            func (g *HelloGrain) SayHelloWithOpts(r *HelloRequest, opts *cluster.GrainCallOptions) (*HelloResponse, error) {
                                fun := func() (*HelloResponse, error) {
                                        pid, statusCode := cluster.Get(g.ID, "Hello")
                                        if statusCode != remote.ResponseStatusCodeOK {
                                            return nil, fmt.Errorf("Get PID failed with StatusCode: %v", statusCode)
                            Severity: Major
                            Found in examples/cluster-metrics/shared/protos_protoactor.go - About 45 mins to fix

                              Method ConsulProvider.RegisterMember has 6 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                              func (p *ConsulProvider) RegisterMember(clusterName string, address string, port int, knownKinds []string,
                                  statusValue cluster.MemberStatusValue, serializer cluster.MemberStatusValueSerializer) error {
                              Severity: Minor
                              Found in cluster/consul/consul_provider.go - About 45 mins to fix

                                Method HelloGrain.VoidFuncWithOpts has 7 return statements (exceeds 4 allowed).
                                Open

                                func (g *HelloGrain) VoidFuncWithOpts(r *AddRequest, opts *cluster.GrainCallOptions) (*Unit, error) {
                                    fun := func() (*Unit, error) {
                                            pid, statusCode := cluster.Get(g.ID, "Hello")
                                            if statusCode != remote.ResponseStatusCodeOK {
                                                return nil, fmt.Errorf("Get PID failed with StatusCode: %v", statusCode)
                                Severity: Major
                                Found in examples/cluster/shared/protos_protoactor.go - About 45 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language