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
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
- Read upRead up
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
- Read upRead up
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
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
- Read upRead up
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 {
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
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
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()
Function main
has 56 lines of code (exceeds 50 allowed). Consider refactoring. Open
func main() {
logo := `
___ _ ___ _ ___
| _ \_ _ ___| |_ ___ / __| | |_ _|
| _/ '_/ _ \ _/ _ \| (__| |__ | |
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)
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 {
- Read upRead up
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)
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)
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)
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)
Avoid deeply nested control flow statements. Open
if !aErr.DoNotPanic {
panic(err)
}
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)
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 {
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)