wechaty/go-wechaty

View on GitHub

Showing 117 of 544 total issues

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

func (p *Plugin) OnHeartbeat(f EventHeartbeat) *Plugin {
    p.events = append(p.events, PluginEvent{
        name: schemas.PuppetEventNameHeartbeat,
        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 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 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

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

func (p *Plugin) OnLogout(f EventLogout) *Plugin {
    p.events = append(p.events, PluginEvent{
        name: schemas.PuppetEventNameLogout,
        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 145..151
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

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

func (p *Plugin) OnMessage(f EventMessage) *Plugin {
    p.events = append(p.events, PluginEvent{
        name: schemas.PuppetEventNameMessage,
        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 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 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

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

func (p *Plugin) OnRoomInvite(f EventRoomInvite) *Plugin {
    p.events = append(p.events, PluginEvent{
        name: schemas.PuppetEventNameRoomInvite,
        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 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

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

  table := []struct {
    key   string
    value int64
  }{
    {"key1", 1},
Severity: Minor
Found in wechaty-puppet/memory-card/memory_card_test.go and 1 other location - About 35 mins to fix
wechaty-puppet/memory-card/memory_card_test.go on lines 116..122

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

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

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

func (p *Plugin) OnRoomTopic(f EventRoomTopic) *Plugin {
    p.events = append(p.events, PluginEvent{
        name: schemas.PuppetEventNameRoomTopic,
        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 172..178
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) OnRoomJoin(f EventRoomJoin) *Plugin {
    p.events = append(p.events, PluginEvent{
        name: schemas.PuppetEventNameRoomJoin,
        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 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

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

    RoomMemberRawPayload(roomID string, contactID string) (*schemas.RoomMemberPayload, error)
Severity: Minor
Found in wechaty-puppet/puppet.go and 2 other locations - About 35 mins to fix
wechaty-puppet-mock/puppet_mock.go on lines 209..211
wechaty-puppet-service/puppet_service.go on lines 975..991

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

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

    ContactSearch(query interface{}, searchIDList []string) ([]string, error)
Severity: Minor
Found in wechaty-puppet/puppet.go and 1 other location - About 35 mins to fix
wechaty-puppet/puppet.go on lines 348..369

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

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 *PuppetService) RoomMemberRawPayload(roomID string, contactID string) (*schemas.RoomMemberPayload, error) {
    log.Tracef("PuppetService RoomMemberRawPayload(%s, %s)\n", roomID, contactID)
    response, err := p.grpcClient.RoomMemberPayload(context.Background(), &pbwechatypuppet.RoomMemberPayloadRequest{
        Id:       roomID,
        MemberId: contactID,
Severity: Minor
Found in wechaty-puppet-service/puppet_service.go and 2 other locations - About 35 mins to fix
wechaty-puppet-mock/puppet_mock.go on lines 209..211
wechaty-puppet/puppet.go on lines 53..53

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

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) RoomMemberRawPayload(roomID string, contactID string) (*schemas.RoomMemberPayload, error) {
    panic("implement me")
}
Severity: Minor
Found in wechaty-puppet-mock/puppet_mock.go and 2 other locations - About 35 mins to fix
wechaty-puppet-service/puppet_service.go on lines 975..991
wechaty-puppet/puppet.go on lines 53..53

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

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

func (p *Puppet) ContactSearch(query interface{}, searchIDList []string) ([]string, error) {
    if searchIDList == nil {
        var err error
        searchIDList, err = p.puppetImplementation.ContactList()
        if err != nil || len(searchIDList) == 0 {
Severity: Minor
Found in wechaty-puppet/puppet.go and 1 other location - About 35 mins to fix
wechaty-puppet/puppet.go on lines 78..78

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

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.PuppetEventNameDong:
            w.puppet.On(name, func(i ...interface{}) {
                w.emit(name, NewContext(), i[0].(*schemas.EventDongPayload).Data)
            })
Severity: Minor
Found in wechaty/wechaty.go and 1 other location - About 35 mins to fix
wechaty/wechaty.go on lines 325..328

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

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.PuppetEventNameHeartbeat:
            w.puppet.On(name, func(i ...interface{}) {
                w.emit(name, NewContext(), i[0].(*schemas.EventHeartbeatPayload).Data)
            })
Severity: Minor
Found in wechaty/wechaty.go and 1 other location - About 35 mins to fix
wechaty/wechaty.go on lines 317..320

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

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

func (p *Puppet) RoomMemberSearch(roomID string, query interface{}) ([]string, error) {
    switch v := query.(type) {
    case string:
        return p.roomMemberSearchByString(roomID, v)
    case *schemas.RoomMemberQueryFilter:
Severity: Minor
Found in wechaty-puppet/puppet.go and 1 other location - About 35 mins to fix
wechaty-puppet/puppet.go on lines 85..85

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

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

            for _, v := range data {
                values = append(values, reflect.ValueOf(v))
            }
Severity: Minor
Found in wechaty/plugin.go and 1 other location - About 35 mins to fix
wechaty/wechaty.go on lines 101..103

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

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

    RoomMemberSearch(roomID string, query interface{}) ([]string, error)
Severity: Minor
Found in wechaty-puppet/puppet.go and 1 other location - About 35 mins to fix
wechaty-puppet/puppet.go on lines 463..472

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

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

        for _, v := range data {
            values = append(values, reflect.ValueOf(v))
        }
Severity: Minor
Found in wechaty/wechaty.go and 1 other location - About 35 mins to fix
wechaty/plugin.go on lines 59..61

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

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

    SetContactAvatar(contactID string, fileBox *filebox.FileBox) error
Severity: Minor
Found in wechaty-puppet/puppet.go and 2 other locations - About 30 mins to fix
wechaty-puppet-mock/puppet_mock.go on lines 117..119
wechaty-puppet-service/puppet_service.go on lines 416..436

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

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