File applications.py
has 290 lines of code (exceeds 250 allowed). Consider refactoring. Open
from flask_restful import Resource
from werkzeug.exceptions import BadRequest
from flask import request, jsonify, g
from flask import current_app as app
from datetime import datetime
- Create a ticketCreate a ticket
Function post
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def post(self):
"""
Create new application. Required data:
birth_day
birth_month
- Read upRead up
- Create a ticketCreate a ticket
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
Function put
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def put(self, application_id):
"""
Update the application. Required data: application_id
birth_day
birth_month
- Read upRead up
- Create a ticketCreate a ticket
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
Function delete
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def delete(self, application_id):
"""
Delete the application. Required data: application_id
"""
user_status, calling_user = has_admin_privileges()
- Read upRead up
- Create a ticketCreate a ticket
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
Function get
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def get(self, application_id):
"""
GET the application details based on specific application_id
"""
# using get instead of filter and it is marginally faster than filter
- Read upRead up
- Create a ticketCreate a ticket
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
Avoid too many return
statements within this function. Open
return (internal_server_error, 500, headers)
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return (internal_server_error, 500, headers)
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return (internal_server_error, 500, headers)
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return (forbidden, 403, headers)
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return (forbidden, 403, headers)
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return (ret, 201, headers)
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return (not_found, 404, headers)
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return (internal_server_error, 500, headers)
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return (internal_server_error, 500, headers)
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return (not_found, 404, headers)
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return (forbidden, 403, headers)
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return (not_found, 404, headers)
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return (conflict, 409, headers)
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return (internal_server_error, 500, headers)
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return (forbidden, 403, headers)
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return (ret, 200, headers)
- Create a ticketCreate a ticket
Function get
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get(self):
"""
GET all the applications at a time.
"""
user_status, calling_user = has_admin_privileges()
- Read upRead up
- Create a ticketCreate a ticket
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"