wechaty/go-wechaty

View on GitHub

Showing 117 of 544 total issues

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) 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 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) 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

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 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) messageForwardContact(conversationID string, messageID string) (string, error) { //nolint:unused
    payload, err := p.puppetImplementation.MessageContact(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 624..634

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

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

func (p *Puppet) messageForwardFile(conversationID string, messageID string) (string, error) { //nolint:unused
    file, err := p.puppetImplementation.MessageFile(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 612..622
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 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 2 locations. Consider refactoring.
Open

func _() {
    // An "invalid array index" compiler error signifies that the constant values have changed.
    // Re-run the stringer command to generate them again.
    var x [1]struct{}
    _ = x[PayloadTypeUnknown-0]
Severity: Major
Found in wechaty-puppet/schemas/payloadtype_string.go and 1 other location - About 1 hr to fix
wechaty-puppet/schemas/scanstatus_string.go on lines 7..17

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

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 _() {
    // An "invalid array index" compiler error signifies that the constant values have changed.
    // Re-run the stringer command to generate them again.
    var x [1]struct{}
    _ = x[ScanStatusUnknown-0]
Severity: Major
Found in wechaty-puppet/schemas/scanstatus_string.go and 1 other location - About 1 hr to fix
wechaty-puppet/schemas/payloadtype_string.go on lines 7..17

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

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

                for _, id := range payload.RemoveeIdList {
                    c := w.contact.Load(id)
                    if err := c.Ready(false); err != nil {
                        log.Errorf("emit roomleave contact.Ready() err: %s\n", err.Error())
                        w.emit(schemas.PuppetEventNameError, NewContext(), err)
Severity: Major
Found in wechaty/wechaty.go and 1 other location - About 1 hr to fix
wechaty/wechaty.go on lines 395..403

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

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

                for _, id := range payload.InviteeIdList {
                    c := w.contact.Load(id)
                    if err := c.Ready(false); err != nil {
                        log.Errorf("emit roomjoin contact.Ready() err: %s\n", err.Error())
                        w.emit(schemas.PuppetEventNameError, NewContext(), err)
Severity: Major
Found in wechaty/wechaty.go and 1 other location - About 1 hr to fix
wechaty/wechaty.go on lines 422..430

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

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

type IMiniProgram interface {
    AppID() string
    Description() string
    PagePath() string
    ThumbUrl() string
Severity: Major
Found in wechaty/interface/mini_program.go and 1 other location - About 1 hr to fix
wechaty/interface/wechaty.go on lines 4..12

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

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