42wim/matterbridge

View on GitHub

Showing 47 of 74 total issues

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

func HandleDownloadSize(logger *logrus.Entry, msg *config.Message, name string, size int64, general *config.Protocol) error {
Severity: Minor
Found in bridge/helper/helper.go - About 35 mins to fix

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

    func HandleDownloadData2(logger *logrus.Entry, msg *config.Message, name, id, comment, url string, data *[]byte, general *config.Protocol) {
    Severity: Minor
    Found in bridge/helper/helper.go - About 35 mins to fix

      Method Bslack.handleSlackClient has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
      Open

      func (b *Bslack) handleSlackClient(messages chan *config.Message) {
          for msg := range b.rtm.IncomingEvents {
              if msg.Type != sUserTyping && msg.Type != sHello && msg.Type != sLatencyReport {
                  b.Log.Debugf("== Receiving event %#v", msg.Data)
              }
      Severity: Minor
      Found in bridge/slack/handlers.go - About 35 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 Bmatrix.handleEvent has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
      Open

      func (b *Bmatrix) handleEvent(ev *matrix.Event) {
          b.Log.Debugf("== Receiving event: %#v", ev)
          if ev.Sender != b.UserID {
              b.RLock()
              channel, ok := b.RoomMap[ev.RoomID]
      Severity: Minor
      Found in bridge/matrix/matrix.go - About 35 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 Btelegram.handleRecv has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
      Open

      func (b *Btelegram) handleRecv(updates <-chan tgbotapi.Update) {
          for update := range updates {
              b.Log.Debugf("== Receiving event: %#v", update.Message)
      
              if update.Message == nil && update.ChannelPost == nil &&
      Severity: Minor
      Found in bridge/telegram/handlers.go - About 35 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 Btelegram.handleEntities has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
      Open

      func (b *Btelegram) handleEntities(rmsg *config.Message, message *tgbotapi.Message) {
          if message.Entities == nil {
              return
          }
      
      
      Severity: Minor
      Found in bridge/telegram/handlers.go - About 35 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 Bxmpp.Send has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
      Open

      func (b *Bxmpp) Send(msg config.Message) (string, error) {
          // should be fixed by using a cache instead of dropping
          if !b.Connected() {
              return "", fmt.Errorf("bridge %s not connected, dropping message %#v to bridge", b.Account, msg)
          }
      Severity: Minor
      Found in bridge/xmpp/xmpp.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