status-im/status-go

View on GitHub
protocol/messenger_chats.go

Summary

Maintainability
B
4 hrs
Test Coverage
F
17%

Messenger has 24 methods (exceeds 21 allowed). Consider refactoring.
Open

func (m *Messenger) getOneToOneAndNextClock(contact *Contact) (*Chat, uint64, error) {
    chat, ok := m.allChats.Load(contact.ID)
    if !ok {
        publicKey, err := contact.PublicKey()
        if err != nil {
Severity: Minor
Found in protocol/messenger_chats.go - About 2 hrs to fix

    Avoid deeply nested control flow statements.
    Open

                            if strings.Contains(chatPreview.Text, "0x") {
                                //if there is a mention, we would like to send parsed text as well
                                chatPreview.ParsedText = chat.LastMessage.ParsedText
                            }
    Severity: Major
    Found in protocol/messenger_chats.go - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if len(simplifiedText) > 100 {
                                  chatPreview.Text = simplifiedText[:100]
                              } else {
                                  chatPreview.Text = simplifiedText
                              }
      Severity: Major
      Found in protocol/messenger_chats.go - About 45 mins to fix

        There are no issues that match your filters.

        Category
        Status