wechaty/go-wechaty

View on GitHub

Showing 544 of 544 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

func (p *PuppetService) RoomAvatar(roomID string) (*filebox.FileBox, error) {
    log.Tracef("PuppetService RoomAvatar(%s)\n", roomID)
    response, err := p.grpcClient.RoomAvatar(context.Background(), &pbwechatypuppet.RoomAvatarRequest{
        Id: roomID,
    })
Severity: Major
Found in wechaty-puppet-service/puppet_service.go and 1 other location - About 1 hr to fix
wechaty-puppet-service/puppet_service.go on lines 439..448

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 126.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        Emotionpageshared struct {
            Text string `xml:",chardata"`
            Tid  struct {
                Text string `xml:",chardata"`
            } `xml:"tid"`
Severity: Major
Found in wechaty-puppet/helper/fix_unknown_message.go and 1 other location - About 1 hr to fix
wechaty-puppet/helper/fix_unknown_message.go on lines 406..426

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 119.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        Findernamecard struct {
            Text     string `xml:",chardata"`
            Username struct {
                Text string `xml:",chardata"`
            } `xml:"username"`
Severity: Major
Found in wechaty-puppet/helper/fix_unknown_message.go and 1 other location - About 1 hr to fix
wechaty-puppet/helper/fix_unknown_message.go on lines 211..231

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 119.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

func TestWechaty_Emit(t *testing.T) {
    wechaty := NewWechaty()
    got := ""
    expect := "test"
    wechaty.OnHeartbeat(func(context *Context, data string) {
Severity: Major
Found in wechaty/wechaty_test.go and 1 other location - About 1 hr to fix
wechaty/wechaty_test.go on lines 35..46

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 117.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

func TestWechaty_On(t *testing.T) {
    wechaty := NewWechaty()
    got := ""
    expect := "ding"
    wechaty.OnDong(func(context *Context, data string) {
Severity: Major
Found in wechaty/wechaty_test.go and 1 other location - About 1 hr to fix
wechaty/wechaty_test.go on lines 22..33

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 117.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

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
    }
Severity: Minor
Found in wechaty/user/message.go - About 1 hr to fix

    Similar blocks of code found in 6 locations. Consider refactoring.
    Open

    func (p *PuppetService) RoomTopic(roomID string) (string, error) {
        log.Tracef("PuppetService RoomTopic(%s)\n", roomID)
        response, err := p.grpcClient.RoomTopic(context.Background(), &pbwechatypuppet.RoomTopicRequest{
            Id: roomID,
        })
    Severity: Major
    Found in wechaty-puppet-service/puppet_service.go and 5 other locations - About 1 hr to fix
    wechaty-puppet-service/puppet_service.go on lines 537..546
    wechaty-puppet-service/puppet_service.go on lines 951..960
    wechaty-puppet-service/puppet_service.go on lines 1007..1016
    wechaty-puppet-service/puppet_service.go on lines 1050..1059
    wechaty-puppet-service/puppet_service.go on lines 1062..1071

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 112.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 6 locations. Consider refactoring.
    Open

    func (p *PuppetService) RoomAnnounce(roomID string) (string, error) {
        log.Tracef("PuppetService RoomAnnounce(%s)\n", roomID)
        response, err := p.grpcClient.RoomAnnounce(context.Background(), &pbwechatypuppet.RoomAnnounceRequest{
            Id: roomID,
        })
    Severity: Major
    Found in wechaty-puppet-service/puppet_service.go and 5 other locations - About 1 hr to fix
    wechaty-puppet-service/puppet_service.go on lines 537..546
    wechaty-puppet-service/puppet_service.go on lines 914..923
    wechaty-puppet-service/puppet_service.go on lines 951..960
    wechaty-puppet-service/puppet_service.go on lines 1050..1059
    wechaty-puppet-service/puppet_service.go on lines 1062..1071

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 112.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 6 locations. Consider refactoring.
    Open

    func (p *PuppetService) MessageContact(messageID string) (string, error) {
        log.Tracef("PuppetService MessageContact(%s)\n", messageID)
        response, err := p.grpcClient.MessageContact(context.Background(), &pbwechatypuppet.MessageContactRequest{
            Id: messageID,
        })
    Severity: Major
    Found in wechaty-puppet-service/puppet_service.go and 5 other locations - About 1 hr to fix
    wechaty-puppet-service/puppet_service.go on lines 914..923
    wechaty-puppet-service/puppet_service.go on lines 951..960
    wechaty-puppet-service/puppet_service.go on lines 1007..1016
    wechaty-puppet-service/puppet_service.go on lines 1050..1059
    wechaty-puppet-service/puppet_service.go on lines 1062..1071

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 112.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 6 locations. Consider refactoring.
    Open

    func (p *PuppetService) FriendshipSearchPhone(phone string) (string, error) {
        log.Tracef("PuppetService FriendshipSearchPhone(%s)\n", phone)
        response, err := p.grpcClient.FriendshipSearchPhone(context.Background(), &pbwechatypuppet.FriendshipSearchPhoneRequest{
            Phone: phone,
        })
    Severity: Major
    Found in wechaty-puppet-service/puppet_service.go and 5 other locations - About 1 hr to fix
    wechaty-puppet-service/puppet_service.go on lines 537..546
    wechaty-puppet-service/puppet_service.go on lines 914..923
    wechaty-puppet-service/puppet_service.go on lines 951..960
    wechaty-puppet-service/puppet_service.go on lines 1007..1016
    wechaty-puppet-service/puppet_service.go on lines 1062..1071

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 112.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 6 locations. Consider refactoring.
    Open

    func (p *PuppetService) RoomQRCode(roomID string) (string, error) {
        log.Tracef("PuppetService RoomQRCode(%s)\n", roomID)
        response, err := p.grpcClient.RoomQRCode(context.Background(), &pbwechatypuppet.RoomQRCodeRequest{
            Id: roomID,
        })
    Severity: Major
    Found in wechaty-puppet-service/puppet_service.go and 5 other locations - About 1 hr to fix
    wechaty-puppet-service/puppet_service.go on lines 537..546
    wechaty-puppet-service/puppet_service.go on lines 914..923
    wechaty-puppet-service/puppet_service.go on lines 1007..1016
    wechaty-puppet-service/puppet_service.go on lines 1050..1059
    wechaty-puppet-service/puppet_service.go on lines 1062..1071

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 112.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    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
    Severity: Minor
    Found in wechaty-puppet/puppet.go - About 1 hr to fix

      Similar blocks of code found in 6 locations. Consider refactoring.
      Open

      func (p *PuppetService) FriendshipSearchWeixin(weixin string) (string, error) {
          log.Tracef("PuppetService FriendshipSearchWeixin(%s)\n", weixin)
          response, err := p.grpcClient.FriendshipSearchWeixin(context.Background(), &pbwechatypuppet.FriendshipSearchHandleRequest{
              Weixin: weixin,
          })
      Severity: Major
      Found in wechaty-puppet-service/puppet_service.go and 5 other locations - About 1 hr to fix
      wechaty-puppet-service/puppet_service.go on lines 537..546
      wechaty-puppet-service/puppet_service.go on lines 914..923
      wechaty-puppet-service/puppet_service.go on lines 951..960
      wechaty-puppet-service/puppet_service.go on lines 1007..1016
      wechaty-puppet-service/puppet_service.go on lines 1050..1059

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 112.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      func (p *PuppetService) RoomDel(roomID, contactID string) error {
          log.Tracef("PuppetService roomDel(%s, %s)\n", roomID, contactID)
          _, err := p.grpcClient.RoomDel(context.Background(), &pbwechatypuppet.RoomDelRequest{
              Id:        roomID,
              ContactId: contactID,
      Severity: Major
      Found in wechaty-puppet-service/puppet_service.go and 1 other location - About 1 hr to fix
      wechaty-puppet-service/puppet_service.go on lines 891..901

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 110.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      func (p *PuppetService) RoomAdd(roomID, contactID string) error {
          log.Tracef("PuppetService RoomAdd(%s, %s)\n", roomID, contactID)
          _, err := p.grpcClient.RoomAdd(context.Background(), &pbwechatypuppet.RoomAddRequest{
              Id:        roomID,
              ContactId: contactID,
      Severity: Major
      Found in wechaty-puppet-service/puppet_service.go and 1 other location - About 1 hr to fix
      wechaty-puppet-service/puppet_service.go on lines 866..876

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 110.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 4 locations. Consider refactoring.
      Open

      func (p *Puppet) messageForwardMiniProgram(conversationID string, messageID string) (string, error) { //nolint:unused
          payload, err := p.puppetImplementation.MessageMiniProgram(messageID)
          if err != nil {
              return "", err
          }
      Severity: Major
      Found in wechaty-puppet/puppet.go and 3 other locations - About 1 hr to fix
      wechaty-puppet/puppet.go on lines 600..610
      wechaty-puppet/puppet.go on lines 624..634
      wechaty-puppet/puppet.go on lines 636..646

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 109.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

      func (m *Message) ToUrlLink() (*UrlLink, error) {
          if m.Type() != schemas.MessageTypeURL {
              return nil, errors.New("message not a Url Link")
          }
          urlPayload, err := m.GetPuppet().MessageURL(m.id)
      Severity: Major
      Found in wechaty/user/message.go and 2 other locations - About 1 hr to fix
      wechaty/user/message.go on lines 422..431
      wechaty/user/message.go on lines 433..443

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 109.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 4 locations. Consider refactoring.
      Open

      func (p *Puppet) messageForwardURL(conversationID string, messageID string) (string, error) { //nolint:unused
          payload, err := p.puppetImplementation.MessageURL(messageID)
          if err != nil {
              return "", err
          }
      Severity: Major
      Found in wechaty-puppet/puppet.go and 3 other locations - About 1 hr to fix
      wechaty-puppet/puppet.go on lines 600..610
      wechaty-puppet/puppet.go on lines 612..622
      wechaty-puppet/puppet.go on lines 636..646

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 109.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

      func (m *Message) ToLocation() (*Location, error) {
          if m.Type() != schemas.MessageTypeLocation {
              return nil, errors.New("message not a Location")
          }
      
      
      Severity: Major
      Found in wechaty/user/message.go and 2 other locations - About 1 hr to fix
      wechaty/user/message.go on lines 411..420
      wechaty/user/message.go on lines 422..431

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 109.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

      func (m *Message) ToMiniProgram() (*MiniProgram, error) {
          if m.Type() != schemas.MessageTypeMiniProgram {
              return nil, errors.New("message not a MiniProgram")
          }
          miniProgramPayload, err := m.GetPuppet().MessageMiniProgram(m.id)
      Severity: Major
      Found in wechaty/user/message.go and 2 other locations - About 1 hr to fix
      wechaty/user/message.go on lines 411..420
      wechaty/user/message.go on lines 433..443

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 109.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Severity
      Category
      Status
      Source
      Language