Showing 11 of 17 total issues
Function get
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def get(self, business_id):
"""return a list of all businesses else a single business"""
filter_by = request.args.get('category', 'all', type=str)
if business_id is None and filter_by == "all":
business_ = [business.serialize() for business in store]
- 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
Function validate_null
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def validate_null(**kwargs):
"""Returns a list with null fields"""
messages = []
for key in kwargs:
strip_text = True
- 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
Avoid too many return
statements within this function. Open
return jsonify(response), 201
Avoid too many return
statements within this function. Open
return jsonify(response), 403
Avoid too many return
statements within this function. Open
return jsonify(response), 200
Avoid too many return
statements within this function. Open
return jsonify(response), 404
Avoid too many return
statements within this function. Open
return jsonify(response), 200
Avoid too many return
statements within this function. Open
return jsonify(response), 404
Avoid too many return
statements within this function. Open
return jsonify(response), 201
Avoid too many return
statements within this function. Open
return jsonify(response), 200
Function delete
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def delete(self, business_id):
if self.validate_json():
return self.validate_json()
data = request.get_json()
password = data.get('password')
- 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"