go-sprout/sprout

View on GitHub

Showing 42 of 48 total issues

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

func (mr *MapsRegistry) RegisterFunctions(funcsMap sprout.FunctionMap) error {
    sprout.AddFunction(funcsMap, "dict", mr.Dict)
    sprout.AddFunction(funcsMap, "get", mr.Get)
    sprout.AddFunction(funcsMap, "set", mr.Set)
    sprout.AddFunction(funcsMap, "unset", mr.Unset)
Severity: Major
Found in registry/maps/maps.go and 1 other location - About 3 hrs to fix
registry/crypto/crypto.go on lines 70..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 264.

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 (tr *TimeRegistry) RegisterFunctions(funcsMap sprout.FunctionMap) error {
    sprout.AddFunction(funcsMap, "date", tr.Date)
    sprout.AddFunction(funcsMap, "dateInZone", tr.DateInZone)
    sprout.AddFunction(funcsMap, "duration", tr.Duration)
    sprout.AddFunction(funcsMap, "dateAgo", tr.DateAgo)
Severity: Major
Found in registry/time/time.go and 1 other location - About 2 hrs to fix
registry/filesystem/filesystem.go on lines 26..38

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

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 (fsr *FileSystemRegistry) RegisterFunctions(funcsMap sprout.FunctionMap) error {
    sprout.AddFunction(funcsMap, "pathBase", fsr.PathBase)
    sprout.AddFunction(funcsMap, "pathDir", fsr.PathDir)
    sprout.AddFunction(funcsMap, "pathExt", fsr.PathExt)
    sprout.AddFunction(funcsMap, "pathClean", fsr.PathClean)
Severity: Major
Found in registry/filesystem/filesystem.go and 1 other location - About 2 hrs to fix
registry/time/time.go on lines 26..38

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

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

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

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

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

Refactorings

Further Reading

Method StringsRegistry.transformString has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring.
Open

func (sr *StringsRegistry) transformString(style caseStyle, str string) string {
    var result strings.Builder
    result.Grow(len(str) + 10) // Allocate a bit more for potential separators

    capitalizeNext := style.CapitalizeNext
Severity: Minor
Found in registry/strings/helpers.go - About 2 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

func (rr *RegexpRegistry) RegisterFunctions(funcsMap sprout.FunctionMap) error {
    sprout.AddFunction(funcsMap, "regexFind", rr.RegexFind)
    sprout.AddFunction(funcsMap, "regexFindAll", rr.RegexFindAll)
    sprout.AddFunction(funcsMap, "regexMatch", rr.RegexMatch)
    sprout.AddFunction(funcsMap, "regexSplit", rr.RegexSplit)
Severity: Major
Found in registry/regexp/regexp.go and 1 other location - About 2 hrs to fix
registry/conversion/conversion.go on lines 25..38

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

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 (sr *StdRegistry) RegisterFunctions(funcsMap sprout.FunctionMap) error {
    sprout.AddFunction(funcsMap, "hello", sr.Hello)
    sprout.AddFunction(funcsMap, "default", sr.Default)
    sprout.AddFunction(funcsMap, "empty", sr.Empty)
    sprout.AddFunction(funcsMap, "all", sr.All)
Severity: Major
Found in registry/std/std.go and 1 other location - About 1 hr to fix
registry/reflect/reflect.go on lines 26..36

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

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 (rr *ReflectRegistry) RegisterFunctions(funcsMap sprout.FunctionMap) error {
    sprout.AddFunction(funcsMap, "typeIs", rr.TypeIs)
    sprout.AddFunction(funcsMap, "typeIsLike", rr.TypeIsLike)
    sprout.AddFunction(funcsMap, "typeOf", rr.TypeOf)
    sprout.AddFunction(funcsMap, "kindIs", rr.KindIs)
Severity: Major
Found in registry/reflect/reflect.go and 1 other location - About 1 hr to fix
registry/std/std.go on lines 26..36

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

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 (rr *RegexpRegistry) RegisterNotices(notices *[]sprout.FunctionNotice) error {
    sprout.AddNotice(notices, sprout.NewDeprecatedNotice("mustRegexFind", "please use `regexFind` instead"))
    sprout.AddNotice(notices, sprout.NewDeprecatedNotice("mustRegexFindAll", "please use `regexFindAll` instead"))
    sprout.AddNotice(notices, sprout.NewDeprecatedNotice("mustRegexMatch", "please use `regexMatch` instead"))
    sprout.AddNotice(notices, sprout.NewDeprecatedNotice("mustRegexSplit", "please use `regexSplit` instead"))
Severity: Major
Found in registry/regexp/regexp.go and 1 other location - About 1 hr to fix
registry/encoding/encoding.go on lines 49..57

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

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 (er *EncodingRegistry) RegisterNotices(notices *[]sprout.FunctionNotice) error {
    sprout.AddNotice(notices, sprout.NewDeprecatedNotice("mustFromJson", "please use `fromJson` instead"))
    sprout.AddNotice(notices, sprout.NewDeprecatedNotice("mustToJson", "please use `toJson` instead"))
    sprout.AddNotice(notices, sprout.NewDeprecatedNotice("mustToPrettyJson", "please use `toPrettyJson` instead"))
    sprout.AddNotice(notices, sprout.NewDeprecatedNotice("mustToRawJson", "please use `toRawJson` instead"))
Severity: Major
Found in registry/encoding/encoding.go and 1 other location - About 1 hr to fix
registry/regexp/regexp.go on lines 51..59

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

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 (nr *NumericRegistry) Min(a any, i ...any) (int64, error) {
    intA, err := cast.ToInt64E(a)
    if err != nil {
        return 0, sprout.NewErrConvertFailed("int64", a, err)
    }
Severity: Major
Found in registry/numeric/functions.go and 1 other location - About 1 hr to fix
registry/numeric/functions.go on lines 350..367

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

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 (nr *NumericRegistry) Max(a any, i ...any) (int64, error) {
    intA, err := cast.ToInt64E(a)
    if err != nil {
        return 0, sprout.NewErrConvertFailed("int64", a, err)
    }
Severity: Major
Found in registry/numeric/functions.go and 1 other location - About 1 hr to fix
registry/numeric/functions.go on lines 287..303

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

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

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

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

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

Refactorings

Further Reading

Method RandomRegistry.randomString has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring.
Open

func (rr *RandomRegistry) randomString(count int, opts *randomOpts) string {
    if count <= 0 {
        return ""
    }

Severity: Minor
Found in registry/random/helpers.go - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

func (nr *NumericRegistry) Maxf(a any, i ...any) (float64, error) {
    floatA, err := cast.ToFloat64E(a)
    if err != nil {
        return 0, sprout.NewErrConvertFailed("float64", a, err)
    }
Severity: Major
Found in registry/numeric/functions.go and 1 other location - About 1 hr to fix
registry/numeric/functions.go on lines 320..333

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

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 (nr *NumericRegistry) Minf(a any, i ...any) (float64, error) {
    floatA, err := cast.ToFloat64E(a)
    if err != nil {
        return 0, sprout.NewErrConvertFailed("float64", a, err)
    }
Severity: Major
Found in registry/numeric/functions.go and 1 other location - About 1 hr to fix
registry/numeric/functions.go on lines 384..397

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

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

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

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

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

Refactorings

Further Reading

Method TimeRegistry.DurationRound has 55 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (tr *TimeRegistry) DurationRound(duration any) string {
    var d time.Duration

    switch duration := duration.(type) {
    case string:
Severity: Minor
Found in registry/time/functions.go - About 1 hr to fix

    Method CryptoRegistry.parsePrivateKeyPEM has 10 return statements (exceeds 4 allowed).
    Open

    func (ch *CryptoRegistry) parsePrivateKeyPEM(pemBlock string) (crypto.PrivateKey, error) {
        block, _ := pem.Decode([]byte(pemBlock))
        if block == nil {
            return nil, errors.New("no PEM data in input")
        }
    Severity: Major
    Found in registry/crypto/helpers.go - About 1 hr to fix

      Method SlicesRegistry.Slice has 8 return statements (exceeds 4 allowed).
      Open

      func (sr *SlicesRegistry) Slice(args ...any) (any, error) {
          // ! BACKWARDS COMPATIBILITY: deprecated in v1.0 and removed in v1.1
          // ! Due to change in signature, this function still supports the old signature
          // ! to let users transition to the new signature.
          // * Old signature: Slice(list any, indices ...any)
      Severity: Major
      Found in registry/slices/functions.go - About 50 mins to fix

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

        func (rr *RegexpRegistry) RegisterAliases(aliasesMap sprout.FunctionAliasMap) error {
            sprout.AddAlias(aliasesMap, "regexFind", "mustRegexFind")
            sprout.AddAlias(aliasesMap, "regexFindAll", "mustRegexFindAll")
            sprout.AddAlias(aliasesMap, "regexMatch", "mustRegexMatch")
            sprout.AddAlias(aliasesMap, "regexSplit", "mustRegexSplit")
        Severity: Minor
        Found in registry/regexp/regexp.go and 1 other location - About 45 mins to fix
        registry/encoding/encoding.go on lines 39..47

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 117.

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

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

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

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

        Refactorings

        Further Reading

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

        func (er *EncodingRegistry) RegisterAliases(aliasesMap sprout.FunctionAliasMap) error {
            sprout.AddAlias(aliasesMap, "fromJson", "mustFromJson")
            sprout.AddAlias(aliasesMap, "toJson", "mustToJson")
            sprout.AddAlias(aliasesMap, "toPrettyJson", "mustToPrettyJson")
            sprout.AddAlias(aliasesMap, "toRawJson", "mustToRawJson")
        Severity: Minor
        Found in registry/encoding/encoding.go and 1 other location - About 45 mins to fix
        registry/regexp/regexp.go on lines 41..49

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 117.

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

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

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

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

        Refactorings

        Further Reading

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

            switch date := date.(type) {
            default:
                t = time.Now()
            case time.Time:
                t = date
        Severity: Minor
        Found in registry/time/functions.go and 1 other location - About 45 mins to fix
        registry/time/functions.go on lines 48..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 117.

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

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

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

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

        Refactorings

        Further Reading

        Severity
        Category
        Status
        Source
        Language