Showing 12 of 108 total issues

Method Server.PostTransactions has a Cognitive Complexity of 169 (exceeds 50 allowed). Consider refactoring.
Open

func (s *Server) PostTransactions(c echo.Context) error {
    // Get account from cookie
    account, err := MustGetUser(c)
    if err != nil {
        return nil
Severity: Minor
Found in backend/api/passerCommande.go - About 2 days 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

Method Server.PatchTransactionItemId has a Cognitive Complexity of 148 (exceeds 50 allowed). Consider refactoring.
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: Minor
Found in backend/api/validerCommande.go - About 2 days 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

Method Server.PatchTransactionId has a Cognitive Complexity of 92 (exceeds 50 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: Minor
Found in backend/api/validerCommande.go - About 7 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

Method Server.PostTransactions has 244 lines of code (exceeds 100 allowed). Consider refactoring.
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 6 hrs to fix

    Method Server.PatchTransactionItemId has 165 lines of code (exceeds 100 allowed). Consider refactoring.
    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 3 hrs to fix

      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

            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

              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

                  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
                    Severity
                    Category
                    Status
                    Source
                    Language