wechaty/go-wechaty

View on GitHub

Showing 544 of 544 total issues

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

func (m *Message) Listener() _interface.IContact {
    if m.payload.ListenerId == "" {
        return nil
    }
    return m.GetWechaty().Contact().Load(m.payload.ListenerId)
Severity: Major
Found in wechaty/user/message.go and 2 other locations - About 45 mins to fix
wechaty/user/message.go on lines 117..122
wechaty/user/room.go on lines 266..271

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 86.

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) Talker() _interface.IContact {
    if m.payload.TalkerId == "" {
        return nil
    }
    return m.GetWechaty().Contact().Load(m.payload.TalkerId)
Severity: Major
Found in wechaty/user/message.go and 2 other locations - About 45 mins to fix
wechaty/user/message.go on lines 216..221
wechaty/user/room.go on lines 266..271

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 86.

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 (fb *fileBoxQRCode) toJSONMap() (map[string]interface{}, error) {
    if fb.qrCode == "" {
        return nil, fmt.Errorf("fileBoxQRCode.toJSONMap %w", ErrNoQRCode)
    }

Severity: Minor
Found in wechaty-puppet/filebox/file_box_qrcode.go and 1 other location - About 45 mins to fix
wechaty-puppet/filebox/file_box_base64.go on lines 20..28

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 84.

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 (fb *fileBoxBase64) toJSONMap() (map[string]interface{}, error) {
    if fb.base64Data == "" {
        return nil, fmt.Errorf("fileBoxBase64.toJSONMap %w", ErrNoBase64Data)
    }

Severity: Minor
Found in wechaty-puppet/filebox/file_box_base64.go and 1 other location - About 45 mins to fix
wechaty-puppet/filebox/file_box_qrcode.go on lines 20..28

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 84.

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

  t.Run("Set string return 0", func(t *testing.T) {
    key := "set_string_return_0"
    mc.SetString(key, "string")
    got := mc.GetInt64(key)
    if got != 0 {
Severity: Minor
Found in wechaty-puppet/memory-card/memory_card_test.go and 1 other location - About 45 mins to fix
wechaty-puppet/memory-card/memory_card_test.go on lines 51..58

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 83.

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

  t.Run("Set int return empty string", func(t *testing.T) {
    key := "set_int_return_empty_string"
    mc.SetInt64(key, 1)
    got := mc.GetString(key)
    if got != "" {
Severity: Minor
Found in wechaty-puppet/memory-card/memory_card_test.go and 1 other location - About 45 mins to fix
wechaty-puppet/memory-card/memory_card_test.go on lines 22..29

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 83.

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) MessageSendContact(conversationID string, contactID string) (string, error) {
    log.Tracef("PuppetService MessageSendContact(%s, %s)\n", conversationID, contactID)
    response, err := p.grpcClient.MessageSendContact(context.Background(), &pbwechatypuppet.MessageSendContactRequest{
        ConversationId: conversationID,
        ContactId:      contactID,
Severity: Minor
Found in wechaty-puppet-service/puppet_service.go and 1 other location - About 40 mins to fix
wechaty-puppet-service/puppet_service.go on lines 926..936

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 82.

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) RoomCreate(contactIDList []string, topic string) (string, error) {
    log.Tracef("PuppetService roomCreate(%s, %s)\n", contactIDList, topic)
    response, err := p.grpcClient.RoomCreate(context.Background(), &pbwechatypuppet.RoomCreateRequest{
        ContactIds: contactIDList,
        Topic:      topic,
Severity: Minor
Found in wechaty-puppet-service/puppet_service.go and 1 other location - About 40 mins to fix
wechaty-puppet-service/puppet_service.go on lines 777..787

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 82.

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

    t.Run("FromJSON json.Unmarshal err", func(t *testing.T) {
        if err := FromJSON("abcd").Error(); !strings.Contains(err.Error(), "FromJSON json.Unmarshal") {
            t.Error(err)
        }
    })
Severity: Minor
Found in wechaty-puppet/filebox/file_box_test.go and 1 other location - About 40 mins to fix
wechaty-puppet/filebox/file_box_test.go on lines 15..19

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 81.

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

    t.Run("FromJSON invalid value boxType", func(t *testing.T) {
        if err := FromJSON("{}").Error(); !strings.Contains(err.Error(), "FromJSON invalid value boxType") {
            t.Error(err)
        }
    })
Severity: Minor
Found in wechaty-puppet/filebox/file_box_test.go and 1 other location - About 40 mins to fix
wechaty-puppet/filebox/file_box_test.go on lines 10..14

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 81.

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 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 {
Severity: Major
Found in wechaty/wechaty.go - About 40 mins to fix

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

    func (p *PuppetService) MessageImage(messageID string, imageType schemas.ImageType) (*filebox.FileBox, error) {
        log.Tracef("PuppetService MessageImage(%s, %s)\n", messageID, imageType)
        response, err := p.grpcClient.MessageImage(context.Background(), &pbwechatypuppet.MessageImageRequest{
            Id:   messageID,
            Type: pbwechatypuppet.ImageType(imageType),
    Severity: Minor
    Found in wechaty-puppet-service/puppet_service.go and 2 other locations - About 40 mins to fix
    wechaty-puppet-mock/puppet_mock.go on lines 49..51
    wechaty-puppet/puppet.go on lines 15..15

    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 34.

    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

                    case schemas.PayloadTypeRoom:
                        if err := w.room.Load(payload.PayloadId).Ready(true); err != nil {
                            log.Errorf("emit dirty room.Ready() err: %s\n", err.Error())
                            w.emit(schemas.PuppetEventNameError, NewContext(), err)
                            return
    Severity: Minor
    Found in wechaty/wechaty.go and 1 other location - About 40 mins to fix
    wechaty/wechaty.go on lines 471..477

    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 79.

    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

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

        MessageImage(messageID string, imageType schemas.ImageType) (*filebox.FileBox, error)
    Severity: Minor
    Found in wechaty-puppet/puppet.go and 2 other locations - About 40 mins to fix
    wechaty-puppet-mock/puppet_mock.go on lines 49..51
    wechaty-puppet-service/puppet_service.go on lines 119..129

    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 34.

    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

                    case schemas.PayloadTypeRoomMember,
                        schemas.PayloadTypeContact:
                        if err := w.contact.Load(payload.PayloadId).Ready(true); err != nil {
                            log.Errorf("emit dirty contact.Ready() err: %s\n", err.Error())
                            w.emit(schemas.PuppetEventNameError, NewContext(), err)
    Severity: Minor
    Found in wechaty/wechaty.go and 1 other location - About 40 mins to fix
    wechaty/wechaty.go on lines 478..483

    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 79.

    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

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

    func (p PuppetMock) MessageImage(messageID string, imageType schemas.ImageType) (*filebox.FileBox, error) {
        panic("implement me")
    }
    Severity: Minor
    Found in wechaty-puppet-mock/puppet_mock.go and 2 other locations - About 40 mins to fix
    wechaty-puppet-service/puppet_service.go on lines 119..129
    wechaty-puppet/puppet.go on lines 15..15

    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 34.

    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 (r *RoomFactory) Load(id string) _interface.IRoom {
        load, ok := r.pool.Load(id)
        if ok {
            return load.(*user.Room)
        }
    Severity: Minor
    Found in wechaty/factory/room.go and 1 other location - About 35 mins to fix
    wechaty/factory/tag.go on lines 22..30

    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 77.

    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 (r *TagFactory) Load(id string) _interface.ITag {
        load, ok := r.pool.Load(id)
        if ok {
            return load.(*user.Tag)
        }
    Severity: Minor
    Found in wechaty/factory/tag.go and 1 other location - About 35 mins to fix
    wechaty/factory/room.go on lines 97..105

    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 77.

    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 15 locations. Consider refactoring.
    Open

    func (p *Plugin) OnRoomLeave(f EventRoomLeave) *Plugin {
        p.events = append(p.events, PluginEvent{
            name: schemas.PuppetEventNameRoomLeave,
            f:    f,
        })
    Severity: Major
    Found in wechaty/plugin.go and 14 other locations - About 35 mins to fix
    wechaty/plugin.go on lines 73..79
    wechaty/plugin.go on lines 82..88
    wechaty/plugin.go on lines 91..97
    wechaty/plugin.go on lines 100..106
    wechaty/plugin.go on lines 109..115
    wechaty/plugin.go on lines 118..124
    wechaty/plugin.go on lines 127..133
    wechaty/plugin.go on lines 136..142
    wechaty/plugin.go on lines 145..151
    wechaty/plugin.go on lines 154..160
    wechaty/plugin.go on lines 163..169
    wechaty/plugin.go on lines 181..187
    wechaty/plugin.go on lines 190..196
    wechaty/plugin.go on lines 199..205

    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 76.

    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 15 locations. Consider refactoring.
    Open

    func (p *Plugin) OnReady(f EventReady) *Plugin {
        p.events = append(p.events, PluginEvent{
            name: schemas.PuppetEventNameReady,
            f:    f,
        })
    Severity: Major
    Found in wechaty/plugin.go and 14 other locations - About 35 mins to fix
    wechaty/plugin.go on lines 73..79
    wechaty/plugin.go on lines 82..88
    wechaty/plugin.go on lines 91..97
    wechaty/plugin.go on lines 100..106
    wechaty/plugin.go on lines 109..115
    wechaty/plugin.go on lines 118..124
    wechaty/plugin.go on lines 127..133
    wechaty/plugin.go on lines 136..142
    wechaty/plugin.go on lines 154..160
    wechaty/plugin.go on lines 163..169
    wechaty/plugin.go on lines 172..178
    wechaty/plugin.go on lines 181..187
    wechaty/plugin.go on lines 190..196
    wechaty/plugin.go on lines 199..205

    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 76.

    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