timoth-y/kicksware-api

View on GitHub

Showing 60 of 60 total issues

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

package rest

import (
    "net/http"
)
Severity: Major
Found in services/cdn/api/rest/health.go and 5 other locations - About 45 mins to fix
services/orders/api/rest/health.go on lines 1..13
services/products/api/rest/health.go on lines 1..13
services/references/api/rest/health.go on lines 1..13
services/search/api/REST/health.go on lines 1..13
services/users/api/rest/health.go on lines 1..13

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

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

package rest

import (
    "net/http"
)
Severity: Major
Found in services/products/api/rest/health.go and 5 other locations - About 45 mins to fix
services/cdn/api/rest/health.go on lines 1..13
services/orders/api/rest/health.go on lines 1..13
services/references/api/rest/health.go on lines 1..13
services/search/api/REST/health.go on lines 1..13
services/users/api/rest/health.go on lines 1..13

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

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

package rest

import (
    "net/http"
)
Severity: Major
Found in services/users/api/rest/health.go and 5 other locations - About 45 mins to fix
services/cdn/api/rest/health.go on lines 1..13
services/orders/api/rest/health.go on lines 1..13
services/products/api/rest/health.go on lines 1..13
services/references/api/rest/health.go on lines 1..13
services/search/api/REST/health.go on lines 1..13

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

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

package rest

import (
    "net/http"
)
Severity: Major
Found in services/references/api/rest/health.go and 5 other locations - About 45 mins to fix
services/cdn/api/rest/health.go on lines 1..13
services/orders/api/rest/health.go on lines 1..13
services/products/api/rest/health.go on lines 1..13
services/search/api/REST/health.go on lines 1..13
services/users/api/rest/health.go on lines 1..13

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

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

package rest

import (
    "net/http"
)
Severity: Major
Found in services/search/api/REST/health.go and 5 other locations - About 45 mins to fix
services/cdn/api/rest/health.go on lines 1..13
services/orders/api/rest/health.go on lines 1..13
services/products/api/rest/health.go on lines 1..13
services/references/api/rest/health.go on lines 1..13
services/users/api/rest/health.go on lines 1..13

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

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

package rest

import (
    "net/http"
)
Severity: Major
Found in services/orders/api/rest/health.go and 5 other locations - About 45 mins to fix
services/cdn/api/rest/health.go on lines 1..13
services/products/api/rest/health.go on lines 1..13
services/references/api/rest/health.go on lines 1..13
services/search/api/REST/health.go on lines 1..13
services/users/api/rest/health.go on lines 1..13

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

Method communicator.GetMessage has 6 return statements (exceeds 4 allowed).
Open

func (c *communicator) GetMessage(endpoint string, response interface{}, params ...*meta.RequestParams) error {
    url := fmt.Sprintf(c.endpointFormat, endpoint)
    req, err := http.NewRequest("GET", url, nil); if err != nil {
        return err
    }
Severity: Major
Found in shared/api/rest/innerServiceCommunicator.go - About 40 mins to fix

    Method authService.Remote has 6 return statements (exceeds 4 allowed).
    Open

    func (s *authService) Remote(user *model.User) (*meta.AuthToken, error) {
        if user == nil || len(user.UniqueID) == 0 {
            return nil, service.ErrInvalidRemoteID
        } else if len(user.Provider) == 0 || user.Provider == model.Internal {
            return nil, service.ErrInvalidRemoteProvider
    Severity: Major
    Found in services/users/usecase/business/authServiceJTW.go - About 40 mins to fix

      Method Handler.DeleteOrder has 6 return statements (exceeds 4 allowed).
      Open

      func (h *Handler) DeleteOrder(ctx context.Context, filter *proto.OrderFilter) (resp *proto.OrderResponse, err error) {
          orderIDs := filter.OrderID; orderID := orderIDs[0]; if len(orderIDs) == 0 || len(orderID) == 0 {
              return nil, business.ErrOrderNotFound
          }
      
      
      Severity: Major
      Found in services/orders/api/gRPC/handler.go - About 40 mins to fix

        Method repository.Fetch has 6 return statements (exceeds 4 allowed).
        Open

        func (r *repository) Fetch(usernames []string, params *meta.RequestParams) ([]*model.User, error) {
            ctx, cancel := context.WithTimeout(context.Background(), r.timeout)
            defer cancel()
        
            filter := bson.M{"unique_id": bson.M{"$in": usernames}}
        Severity: Major
        Found in services/users/usecase/storage/mongo/repository.go - About 40 mins to fix

          Method repository.FetchQuery has 6 return statements (exceeds 4 allowed).
          Open

          func (r *repository) FetchQuery(query meta.RequestQuery, params *meta.RequestParams) ([]*model.User, error) {
              ctx, cancel := context.WithTimeout(context.Background(), r.timeout)
              defer cancel()
          
              filter, err := query.ToBson()
          Severity: Major
          Found in services/users/usecase/storage/mongo/repository.go - About 40 mins to fix

            Method serviceContainer.Resolve has 6 return statements (exceeds 4 allowed).
            Open

            func (c *serviceContainer) Resolve(receiver interface{}) error {
                receiverType := reflect.TypeOf(receiver); if receiverType == nil {
                    return ErrReceiverNotValid
                }
            
            
            Severity: Major
            Found in shared/container/serviceContainer.go - About 40 mins to fix

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

                  if another, _ := s.FetchByUsername(username); another != nil {
                      baseUsername := username
                      for another != nil {
                          rand.Seed(user.RegisterDate.Unix())
                          username = fmt.Sprintf("%v_%v", baseUsername, strconv.Itoa(rand.Int())[:3])
              Severity: Minor
              Found in services/users/usecase/business/userService.go and 1 other location - About 40 mins to fix
              services/users/usecase/business/userService.go on lines 162..169

              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

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

              func newRedisClient(redisURL string) (*redis.Client, error) {
                  opts, err := redis.ParseURL(redisURL)
                  if err != nil {
                      return nil, err
                  }
              Severity: Minor
              Found in services/users/usecase/storage/redis/repository.go and 1 other location - About 40 mins to fix
              services/products/usecase/storage/redis/repository.go on lines 23..34

              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

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

                      if another, _ := s.FetchByUsername(username); another != nil {
                          baseUsername := username
                          for another != nil {
                              rand.Seed(user.RegisterDate.Unix())
                              username = fmt.Sprintf("%v_%v", baseUsername, strconv.Itoa(rand.Int())[:3])
              Severity: Minor
              Found in services/users/usecase/business/userService.go and 1 other location - About 40 mins to fix
              services/users/usecase/business/userService.go on lines 87..94

              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

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

              func newRedisClient(redisURL string) (*redis.Client, error) {
                  opts, err := redis.ParseURL(redisURL)
                  if err != nil {
                      return nil, err
                  }
              Severity: Minor
              Found in services/products/usecase/storage/redis/repository.go and 1 other location - About 40 mins to fix
              services/users/usecase/storage/redis/repository.go on lines 33..44

              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

              Function NewHandler has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              func NewHandler(service service.UserService, auth service.AuthService, mail service.MailService,
                  interact service.InteractService, config config.CommonConfig) *Handler {
              Severity: Minor
              Found in services/users/api/rest/handler.go - About 35 mins to fix

                Function ProvideRESTGatewayHandler has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                func ProvideRESTGatewayHandler(service service.UserService, authService service.AuthService, mailService service.MailService,
                    interactService service.InteractService, config env.ServiceConfig) *rest.Handler {
                Severity: Minor
                Found in services/users/container/factory/gatewayHandlerFactory.go - About 35 mins to fix

                  Method repository.FetchQuery has 5 return statements (exceeds 4 allowed).
                  Open

                  func (r *repository) FetchQuery(query meta.RequestQuery, params *meta.RequestParams) ([]*model.SneakerReference, error) {
                      ctx, cancel := context.WithTimeout(context.Background(), r.timeout)
                      defer cancel()
                  
                      filter, err := query.ToBson(); if err != nil {
                  Severity: Major
                  Found in services/references/usecase/storage/mongo/repository.go - About 35 mins to fix

                    Method repository.FetchAll has 5 return statements (exceeds 4 allowed).
                    Open

                    func (r *repository) FetchAll(params *meta.RequestParams) ([]*model.SneakerProduct, error) {
                        keys := r.client.Keys("sneakerProduct*").Val()
                        if len(keys) == 0 {
                            return nil, errors.Wrap(business.ErrProductNotFound, "repository.SneakerProduct.FetchAll")
                        }
                    Severity: Major
                    Found in services/products/usecase/storage/redis/repository.go - About 35 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language