Showing 7 of 9 total issues
Function update_delivery_status
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def update_delivery_status(delivery_id, email_notify=False):
from api.models import Shipment, ShipmentStatus
delivery_status = Client().update_delivery_status(delivery_id)
if delivery_status and delivery_id:
- 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 __init__
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function create_delivery
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def create_delivery(self, order):
create_delivery = CreateDelivery(order)
req_body_create_delivery = create_delivery.body()
self.logger.info(
'Koiki request to {}. body={}'.format(
- 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 _get_shipment_status
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _get_shipment_status(self, status_code):
from api.models import ShipmentStatus
if self.is_errored():
return ShipmentStatus.ERROR_FROM_TRACKING
else:
- 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 _by_method
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _by_method(self, shipping_lines):
by_method = defaultdict(list)
method_id = None
nometadata = False
for line_item in shipping_lines:
- 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 False
Function search_email
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def search_email(self, email):
args = [email, ["Accounts", "Contacts"], 0, 1, "", ["id"], False, False]
self.logger.info("SugarCRM searching email in CRM: {}".format(email))
response = self._api_request("search_by_module", args)
result = response.json()
- 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"