Function calculate_update_amount
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def calculate_update_amount(order):
discount = None
if order.discount_code_id:
discount = order.discount_code
# Access code part will be done ticket_holders API
- 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
File ticketing.py
has 265 lines of code (exceeds 250 allowed). Consider refactoring. Open
import logging
from datetime import datetime
import pytz
from flask_rest_jsonapi.exceptions import ObjectNotFound
- Create a ticketCreate a ticket
Function is_discount_available
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def is_discount_available(
discount_code,
tickets=None,
ticket_holders=None,
quantity_discount=None,
- 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 validate_discount_code
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def validate_discount_code(
discount_code, tickets=None, ticket_holders=None, event_id=None
):
"""Tickets validation should be performed before calling this function"""
from app.models.discount_code import DiscountCode
- 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 is_discount_available
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def is_discount_available(
- Create a ticketCreate a ticket