glocurrency/commons

View on GitHub

Showing 8 of 8 total issues

Function RegisterTranslatorFor has 13 return statements (exceeds 4 allowed).
Open

func RegisterTranslatorFor(v *validator.Validate) ut.Translator {
    v.RegisterTagNameFunc(func(fld reflect.StructField) string {
        name := strings.SplitN(fld.Tag.Get("json"), ",", 2)[0]
        if name == "-" {
            return ""
Severity: Major
Found in translator/translator.go - About 1 hr to fix

    Method cloudTasksQ.Enqueue has 51 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (q *cloudTasksQ) Enqueue(ctx context.Context, task *Task, opts ...CloudTasksOption) (info *TaskInfo, err error) {
        queueID := task.typename
        uniqueKey := ""
    
        var payload []byte
    Severity: Minor
    Found in q/cloudtasks.go - About 1 hr to fix

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

          v.RegisterTranslation("alphanumspacedash", fallback, func(ut ut.Translator) error {
              return ut.Add("alphanumspacedash", "{0} can only contain alphanumeric characters, spaces and dashes", true)
          }, func(ut ut.Translator, fe validator.FieldError) string {
              t, _ := ut.T("alphanumspacedash", fe.Field())
              return t
      Severity: Major
      Found in translator/translator.go and 4 other locations - About 35 mins to fix
      translator/translator.go on lines 27..32
      translator/translator.go on lines 34..39
      translator/translator.go on lines 41..46
      translator/translator.go on lines 55..60

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

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

          v.RegisterTranslation("banksupported", fallback, func(ut ut.Translator) error {
              return ut.Add("banksupported", "{0} can only contain bank suported characters", true)
          }, func(ut ut.Translator, fe validator.FieldError) string {
              t, _ := ut.T("banksupported", fe.Field())
              return t
      Severity: Major
      Found in translator/translator.go and 4 other locations - About 35 mins to fix
      translator/translator.go on lines 27..32
      translator/translator.go on lines 34..39
      translator/translator.go on lines 41..46
      translator/translator.go on lines 48..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 106.

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

          v.RegisterTranslation("bic", fallback, func(ut ut.Translator) error {
              return ut.Add("bic", "{0} must comply with BIC format", true)
          }, func(ut ut.Translator, fe validator.FieldError) string {
              t, _ := ut.T("bic", fe.Field())
              return t
      Severity: Major
      Found in translator/translator.go and 4 other locations - About 35 mins to fix
      translator/translator.go on lines 34..39
      translator/translator.go on lines 41..46
      translator/translator.go on lines 48..53
      translator/translator.go on lines 55..60

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

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

          v.RegisterTranslation("iso3166_1_alpha2", fallback, func(ut ut.Translator) error {
              return ut.Add("iso3166_1_alpha2", "{0} must be a valid country code", true)
          }, func(ut ut.Translator, fe validator.FieldError) string {
              t, _ := ut.T("iso3166_1_alpha2", fe.Field())
              return t
      Severity: Major
      Found in translator/translator.go and 4 other locations - About 35 mins to fix
      translator/translator.go on lines 27..32
      translator/translator.go on lines 41..46
      translator/translator.go on lines 48..53
      translator/translator.go on lines 55..60

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

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

          v.RegisterTranslation("alphanumspace", fallback, func(ut ut.Translator) error {
              return ut.Add("alphanumspace", "{0} can only contain alphanumeric characters and spaces", true)
          }, func(ut ut.Translator, fe validator.FieldError) string {
              t, _ := ut.T("alphanumspace", fe.Field())
              return t
      Severity: Major
      Found in translator/translator.go and 4 other locations - About 35 mins to fix
      translator/translator.go on lines 27..32
      translator/translator.go on lines 34..39
      translator/translator.go on lines 48..53
      translator/translator.go on lines 55..60

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

      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

      Function RewriteForPubSub has 5 return statements (exceeds 4 allowed).
      Open

      func RewriteForPubSub(req *http.Request) error {
          data, err := io.ReadAll(req.Body)
          if err != nil {
              return fmt.Errorf("cannot read body: %w", err)
          }
      Severity: Major
      Found in q/pubsub-router/router.go - About 35 mins to fix
        Severity
        Category
        Status
        Source
        Language