mesg-foundation/core

View on GitHub

Showing 113 of 208 total issues

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

    validate.RegisterTranslation("coinsPositiveZero", trans, func(ut ut.Translator) error {
        return ut.Add("coinsPositiveZero", "{0} must be positive or zero coins", false)
    }, func(ut ut.Translator, fe validator.FieldError) string {
        t, _ := ut.T(fe.Tag(), fe.Field(), prefix)
        return t
Severity: Major
Found in ext/xvalidator/validator.go and 11 other locations - About 45 mins to fix
ext/xvalidator/validator.go on lines 49..54
ext/xvalidator/validator.go on lines 57..62
ext/xvalidator/validator.go on lines 65..70
ext/xvalidator/validator.go on lines 73..78
ext/xvalidator/validator.go on lines 81..86
ext/xvalidator/validator.go on lines 89..94
ext/xvalidator/validator.go on lines 97..102
ext/xvalidator/validator.go on lines 113..118
ext/xvalidator/validator.go on lines 121..126
ext/xvalidator/validator.go on lines 129..134
ext/xvalidator/validator.go on lines 137..142

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

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

    validate.RegisterTranslation("portmap", trans, func(ut ut.Translator) error {
        return ut.Add("portmap", "{0} must be a valid port mapping (eg: 80 or 80:80)", false)
    }, func(ut ut.Translator, fe validator.FieldError) string {
        t, _ := ut.T(fe.Tag(), fe.Field(), prefix)
        return t
Severity: Major
Found in ext/xvalidator/validator.go and 11 other locations - About 45 mins to fix
ext/xvalidator/validator.go on lines 49..54
ext/xvalidator/validator.go on lines 65..70
ext/xvalidator/validator.go on lines 73..78
ext/xvalidator/validator.go on lines 81..86
ext/xvalidator/validator.go on lines 89..94
ext/xvalidator/validator.go on lines 97..102
ext/xvalidator/validator.go on lines 105..110
ext/xvalidator/validator.go on lines 113..118
ext/xvalidator/validator.go on lines 121..126
ext/xvalidator/validator.go on lines 129..134
ext/xvalidator/validator.go on lines 137..142

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

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

    validate.RegisterTranslation("accaddress", trans, func(ut ut.Translator) error {
        return ut.Add("accaddress", "{0} must be a valid address", false)
    }, func(ut ut.Translator, fe validator.FieldError) string {
        t, _ := ut.T(fe.Tag(), fe.Field(), prefix)
        return t
Severity: Major
Found in ext/xvalidator/validator.go and 11 other locations - About 45 mins to fix
ext/xvalidator/validator.go on lines 49..54
ext/xvalidator/validator.go on lines 57..62
ext/xvalidator/validator.go on lines 65..70
ext/xvalidator/validator.go on lines 73..78
ext/xvalidator/validator.go on lines 89..94
ext/xvalidator/validator.go on lines 97..102
ext/xvalidator/validator.go on lines 105..110
ext/xvalidator/validator.go on lines 113..118
ext/xvalidator/validator.go on lines 121..126
ext/xvalidator/validator.go on lines 129..134
ext/xvalidator/validator.go on lines 137..142

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

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

    validate.RegisterTranslation("coins", trans, func(ut ut.Translator) error {
        return ut.Add("coins", "{0} must be a valid coins", false)
    }, func(ut ut.Translator, fe validator.FieldError) string {
        t, _ := ut.T(fe.Tag(), fe.Field(), prefix)
        return t
Severity: Major
Found in ext/xvalidator/validator.go and 11 other locations - About 45 mins to fix
ext/xvalidator/validator.go on lines 49..54
ext/xvalidator/validator.go on lines 57..62
ext/xvalidator/validator.go on lines 65..70
ext/xvalidator/validator.go on lines 73..78
ext/xvalidator/validator.go on lines 81..86
ext/xvalidator/validator.go on lines 97..102
ext/xvalidator/validator.go on lines 105..110
ext/xvalidator/validator.go on lines 113..118
ext/xvalidator/validator.go on lines 121..126
ext/xvalidator/validator.go on lines 129..134
ext/xvalidator/validator.go on lines 137..142

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

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

    validate.RegisterTranslation("mnemonic", trans, func(ut ut.Translator) error {
        return ut.Add("mnemonic", "{0} must be a valid mnemonic", false)
    }, func(ut ut.Translator, fe validator.FieldError) string {
        t, _ := ut.T(fe.Tag(), fe.Field(), prefix)
        return t
Severity: Major
Found in ext/xvalidator/validator.go and 11 other locations - About 45 mins to fix
ext/xvalidator/validator.go on lines 49..54
ext/xvalidator/validator.go on lines 57..62
ext/xvalidator/validator.go on lines 65..70
ext/xvalidator/validator.go on lines 73..78
ext/xvalidator/validator.go on lines 81..86
ext/xvalidator/validator.go on lines 89..94
ext/xvalidator/validator.go on lines 97..102
ext/xvalidator/validator.go on lines 105..110
ext/xvalidator/validator.go on lines 113..118
ext/xvalidator/validator.go on lines 129..134
ext/xvalidator/validator.go on lines 137..142

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

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

    validate.RegisterTranslation("env", trans, func(ut ut.Translator) error {
        return ut.Add("env", "{0} must be a valid env variable name", false)
    }, func(ut ut.Translator, fe validator.FieldError) string {
        t, _ := ut.T(fe.Tag(), fe.Field(), prefix)
        return t
Severity: Major
Found in ext/xvalidator/validator.go and 11 other locations - About 45 mins to fix
ext/xvalidator/validator.go on lines 57..62
ext/xvalidator/validator.go on lines 65..70
ext/xvalidator/validator.go on lines 73..78
ext/xvalidator/validator.go on lines 81..86
ext/xvalidator/validator.go on lines 89..94
ext/xvalidator/validator.go on lines 97..102
ext/xvalidator/validator.go on lines 105..110
ext/xvalidator/validator.go on lines 113..118
ext/xvalidator/validator.go on lines 121..126
ext/xvalidator/validator.go on lines 129..134
ext/xvalidator/validator.go on lines 137..142

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

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

    validate.RegisterTranslation("hash", trans, func(ut ut.Translator) error {
        return ut.Add("hash", "{0} must be a valid hash", false)
    }, func(ut ut.Translator, fe validator.FieldError) string {
        t, _ := ut.T(fe.Tag(), fe.Field(), prefix)
        return t
Severity: Major
Found in ext/xvalidator/validator.go and 11 other locations - About 45 mins to fix
ext/xvalidator/validator.go on lines 49..54
ext/xvalidator/validator.go on lines 57..62
ext/xvalidator/validator.go on lines 65..70
ext/xvalidator/validator.go on lines 81..86
ext/xvalidator/validator.go on lines 89..94
ext/xvalidator/validator.go on lines 97..102
ext/xvalidator/validator.go on lines 105..110
ext/xvalidator/validator.go on lines 113..118
ext/xvalidator/validator.go on lines 121..126
ext/xvalidator/validator.go on lines 129..134
ext/xvalidator/validator.go on lines 137..142

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

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

    validate.RegisterTranslation("bech32accpubkey", trans, func(ut ut.Translator) error {
        return ut.Add("bech32accpubkey", "{0} must be a valid bech32accpubkey", false)
    }, func(ut ut.Translator, fe validator.FieldError) string {
        t, _ := ut.T(fe.Tag(), fe.Field(), prefix)
        return t
Severity: Major
Found in ext/xvalidator/validator.go and 11 other locations - About 45 mins to fix
ext/xvalidator/validator.go on lines 49..54
ext/xvalidator/validator.go on lines 57..62
ext/xvalidator/validator.go on lines 65..70
ext/xvalidator/validator.go on lines 73..78
ext/xvalidator/validator.go on lines 81..86
ext/xvalidator/validator.go on lines 89..94
ext/xvalidator/validator.go on lines 97..102
ext/xvalidator/validator.go on lines 105..110
ext/xvalidator/validator.go on lines 113..118
ext/xvalidator/validator.go on lines 121..126
ext/xvalidator/validator.go on lines 137..142

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

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

package types

import (
    "github.com/cosmos/cosmos-sdk/codec"
)
Severity: Minor
Found in x/credit/internal/types/codec.go and 2 other locations - About 35 mins to fix
x/ownership/internal/types/codec.go on lines 1..20
x/service/internal/types/codec.go on lines 1..20

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

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

package types

import (
    "github.com/cosmos/cosmos-sdk/codec"
)
Severity: Minor
Found in x/service/internal/types/codec.go and 2 other locations - About 35 mins to fix
x/credit/internal/types/codec.go on lines 1..20
x/ownership/internal/types/codec.go on lines 1..20

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

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

package types

import (
    "github.com/cosmos/cosmos-sdk/codec"
)
Severity: Minor
Found in x/ownership/internal/types/codec.go and 2 other locations - About 35 mins to fix
x/credit/internal/types/codec.go on lines 1..20
x/service/internal/types/codec.go on lines 1..20

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

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 (c *RPC) setAccountSequence(seq uint64) error {
    c.accountMutex.Lock()
    defer c.accountMutex.Unlock()
    if c.acc == nil {
        return fmt.Errorf("c.acc should not be nil. use GetAccount first")
Severity: Minor
Found in cosmos/rpc.go and 1 other location - About 30 mins to fix
cosmos/lcd.go on lines 199..206

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

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 (lcd *LCD) setAccountSequence(seq uint64) error {
    lcd.accountMutex.Lock()
    defer lcd.accountMutex.Unlock()
    if lcd.acc == nil {
        return fmt.Errorf("lcd.acc should not be nil. use getAccount first")
Severity: Minor
Found in cosmos/lcd.go and 1 other location - About 30 mins to fix
cosmos/rpc.go on lines 193..200

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

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