Showing 10 of 544 total issues
Method Wechaty.initPuppetEventBridge
has a Cognitive Complexity of 85 (exceeds 14 allowed). Consider refactoring. Open
func (w *Wechaty) initPuppetEventBridge() {
// TODO temporary
for _, name := range schemas.GetEventNames() {
name := name
switch name {
- 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 Wechaty.initPuppetEventBridge
has 180 lines of code (exceeds 45 allowed). Consider refactoring. Open
func (w *Wechaty) initPuppetEventBridge() {
// TODO temporary
for _, name := range schemas.GetEventNames() {
name := name
switch name {
PuppetService
has 66 methods (exceeds 60 allowed). Consider refactoring. Open
type PuppetService struct {
*wechatyPuppet.Puppet
grpcConn *grpc.ClientConn
grpcClient pbwechaty.PuppetClient
eventStream pbwechaty.Puppet_EventClient
File puppet_service.go
has 1010 lines of code (exceeds 1000 allowed). Consider refactoring. Open
package puppetservice
import (
"context"
"crypto/x509"
Method Message.MentionList
has a Cognitive Complexity of 23 (exceeds 14 allowed). Consider refactoring. Open
func (m *Message) MentionList() []_interface.IContact {
room := m.Room()
if m.Type() != schemas.MessageTypeText || room == nil {
return 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 Message.MentionList
has 52 lines of code (exceeds 45 allowed). Consider refactoring. Open
func (m *Message) MentionList() []_interface.IContact {
room := m.Room()
if m.Type() != schemas.MessageTypeText || room == nil {
return nil
}
Method Puppet.messageQueryFilterFactory
has 50 lines of code (exceeds 45 allowed). Consider refactoring. Open
func (p *Puppet) messageQueryFilterFactory(query *schemas.MessageQueryFilter) schemas.MessagePayloadFilterFunction {
var filters []schemas.MessagePayloadFilterFunction
// Deprecated FromId compatible
//nolint:staticcheck
Method emitter.Once
has a Cognitive Complexity of 18 (exceeds 14 allowed). Consider refactoring. Open
func (e *emitter) Once(evt EventName, listener ...Listener) {
if len(listener) == 0 {
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
Method Wechaty.initPuppetEventBridge
has 14 return statements (exceeds 12 allowed). Open
func (w *Wechaty) initPuppetEventBridge() {
// TODO temporary
for _, name := range schemas.GetEventNames() {
name := name
switch name {
Method Puppet.messageQueryFilterFactory
has a Cognitive Complexity of 16 (exceeds 14 allowed). Consider refactoring. Open
func (p *Puppet) messageQueryFilterFactory(query *schemas.MessageQueryFilter) schemas.MessagePayloadFilterFunction {
var filters []schemas.MessagePayloadFilterFunction
// Deprecated FromId compatible
//nolint:staticcheck
- 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"