Showing 65 of 108 total issues

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

            } else if item.Prices.Coutant >= 30 && item.Prices.Coutant < 130 {
                item.Prices.Externe = arrondiAuMutilple(item.Prices.Coutant*3/2, 5)
                item.Prices.Ceten = arrondiAuMutilple(item.Prices.Coutant*113/100, 5)
                item.Prices.StaffBar = arrondiAuMutilple(item.Prices.Coutant*108/100, 5)
                item.Prices.Privilegies = arrondiAuMutilple(item.Prices.Coutant*11/10, 5)
Severity: Major
Found in backend/api/restock.go and 2 other locations - About 1 hr to fix
backend/api/restock.go on lines 121..133
backend/api/restock.go on lines 127..133

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

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 Server.PostTransactions has 32 return statements (exceeds 20 allowed).
Open

func (s *Server) PostTransactions(c echo.Context) error {
    // Get account from cookie
    account, err := MustGetUser(c)
    if err != nil {
        return nil
Severity: Major
Found in backend/api/passerCommande.go - About 1 hr to fix

    Method Server.CallbackLinking has 109 lines of code (exceeds 100 allowed). Consider refactoring.
    Open

    func (s *Server) CallbackLinking(c echo.Context, params autogen.CallbackParams, state *StateCache) error {
        accountID := state.Data
    
        conf := config.GetConfig()
    
    
    Severity: Major
    Found in backend/api/auth.go - About 1 hr to fix

      Method Server.PatchTransactionId has 107 lines of code (exceeds 100 allowed). Consider refactoring.
      Open

      func (s *Server) PatchTransactionId(c echo.Context, accountId autogen.UUID, transactionId autogen.UUID, params autogen.PatchTransactionIdParams) error {
          _, err := MustGetAdmin(c)
          if err != nil {
              return nil
          }
      Severity: Major
      Found in backend/api/validerCommande.go - About 1 hr to fix

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

            filter := bson.M{
                "$and": []bson.M{
                    {
                        "deleted_at": nil,
                    },
        Severity: Major
        Found in backend/internal/db/mongo/item_misc.go and 1 other location - About 1 hr to fix
        backend/internal/db/mongo/item_misc.go on lines 257..287

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

        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

            filter := bson.M{
                "$and": []bson.M{
                    {
                        "deleted_at": nil,
                    },
        Severity: Major
        Found in backend/internal/db/mongo/item_misc.go and 1 other location - About 1 hr to fix
        backend/internal/db/mongo/item_misc.go on lines 97..127

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

        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

                            if item.MenuItems != nil {
                                for _, subitem := range *txitem.MenuItems {
                                    sItem, err := s.DBackend.GetItem(ctx, subitem.Id.String())
                                    if err != nil {
                                        continue
        Severity: Major
        Found in backend/api/validerCommande.go and 2 other locations - About 1 hr to fix
        backend/api/validerCommande.go on lines 85..98
        backend/api/validerCommande.go on lines 291..304

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

        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

                            if txitem.PickedCategoriesItems != nil {
                                for _, pickedItem := range *txitem.PickedCategoriesItems {
                                    pItem, err := s.DBackend.GetItem(ctx, pickedItem.ItemId.String())
                                    if err != nil {
                                        continue
        Severity: Major
        Found in backend/api/validerCommande.go and 2 other locations - About 1 hr to fix
        backend/api/validerCommande.go on lines 70..83
        backend/api/validerCommande.go on lines 291..304

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

        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

                        if item.PickedCategoriesItems != nil {
                            for _, pickedItem := range *item.PickedCategoriesItems {
                                pItem, err := s.DBackend.GetItem(ctx, pickedItem.ItemId.String())
                                if err != nil {
                                    continue
        Severity: Major
        Found in backend/api/validerCommande.go and 2 other locations - About 1 hr to fix
        backend/api/validerCommande.go on lines 70..83
        backend/api/validerCommande.go on lines 85..98

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

        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 Server.PostItem has 101 lines of code (exceeds 100 allowed). Consider refactoring.
        Open

        func (s *Server) PostItem(c echo.Context, categoryId autogen.UUID) error {
            usr, err := MustGetUser(c)
            if err != nil {
                return nil
            }
        Severity: Major
        Found in backend/api/ajoutProduit.go - About 1 hr to fix

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

                      for _, menuItem := range *item.MenuItems {
                          mItem, err := s.DBackend.GetItem(c.Request().Context(), menuItem.Id.String())
                          if err != nil {
                              if err == mongo.ErrNoDocuments {
                                  return nil, ErrorItemNotFound(c)
          Severity: Minor
          Found in backend/api/passerCommande.go and 1 other location - About 55 mins to fix
          backend/api/passerCommande.go on lines 101..111

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

          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 _, pickedItem := range *potentialItem.PickedCategoriesItems {
                          mItem, err := s.DBackend.GetItem(c.Request().Context(), pickedItem.ItemId.String())
                          if err != nil {
                              if err == mongo.ErrNoDocuments {
                                  return nil, ErrorItemNotFound(c)
          Severity: Minor
          Found in backend/api/passerCommande.go and 1 other location - About 55 mins to fix
          backend/api/passerCommande.go on lines 86..96

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

          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 init() {
              godotenv.Load()
              if err := env.Parse(&config); err != nil {
                  logrus.Fatal(err)
              }
          Severity: Minor
          Found in porte/config.go and 1 other location - About 50 mins to fix
          nfc/config.go on lines 23..35

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

          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 init() {
              godotenv.Load()
              if err := env.Parse(&config); err != nil {
                  logrus.Fatal(err)
              }
          Severity: Minor
          Found in nfc/config.go and 1 other location - About 50 mins to fix
          porte/config.go on lines 25..37

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

          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 Server.PatchTransactionItemId has 24 return statements (exceeds 20 allowed).
          Open

          func (s *Server) PatchTransactionItemId(c echo.Context, accountId autogen.UUID, transactionId autogen.UUID, itemId autogen.UUID, params autogen.PatchTransactionItemIdParams) error {
              _, err := MustGetAdmin(c)
              if err != nil {
                  return nil
              }
          Severity: Major
          Found in backend/api/validerCommande.go - About 50 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                        if err == mongo.ErrNoDocuments {
                                            continue
                                        }
            Severity: Major
            Found in backend/api/validerCommande.go - About 45 mins to fix

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

                  for _, asset := range release.Assets {
                      name := asset.GetName()
                      if !strings.HasPrefix(name, "nfc") {
                          continue
                      }
              Severity: Minor
              Found in nfc/update.go and 1 other location - About 45 mins to fix
              porte/update.go on lines 36..48

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

              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

              Avoid deeply nested control flow statements.
              Open

                                          if err == mongo.ErrNoDocuments {
                                              continue
                                          }
              Severity: Major
              Found in backend/api/validerCommande.go - About 45 mins to fix

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

                    for _, asset := range release.Assets {
                        name := asset.GetName()
                        if !strings.HasPrefix(name, "porte") {
                            continue
                        }
                Severity: Minor
                Found in porte/update.go and 1 other location - About 45 mins to fix
                nfc/update.go on lines 38..50

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

                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

                package models
                
                import (
                    "bar/autogen"
                    "encoding/json"
                Severity: Major
                Found in backend/internal/models/restocks.go and 5 other locations - About 45 mins to fix
                backend/internal/models/carousel_image.go on lines 1..26
                backend/internal/models/carousel_text.go on lines 1..26
                backend/internal/models/category.go on lines 1..26
                backend/internal/models/item.go on lines 1..26
                backend/internal/models/refill.go on lines 1..26

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

                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