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
- Read upRead up
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
}
- Read upRead up
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
}
- Read upRead up
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
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
}
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
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()
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
}
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
}
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
}
Avoid deeply nested control flow statements. Open
if err == mongo.ErrNoDocuments {
continue
}
Avoid deeply nested control flow statements. Open
if err == mongo.ErrNoDocuments {
continue
}