Showing 300 of 1,194 total issues
Function send_email
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def send_email(to, action, subject, html, attachments=None, bcc=None, reply_to=None):
- Create a ticketCreate a ticket
Function upload_to_aws
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def upload_to_aws(
- Create a ticketCreate a ticket
Function get_order_data
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_order_data(order):
"""Get order data from order object"""
if not order:
return {
'Tax ID': '',
- 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 celery_task
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def celery_task(task_id):
"""
Get CeleryTask status of an API based task
"""
# in case of always eager, get results. don't call AsyncResult
- 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 deeply nested control flow statements. Open
if access_code:
access_code_value = access_code.code
break
- Create a ticketCreate a ticket
Function health_check_celery
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def health_check_celery():
"""
Check health status of celery and redis broker
:return:
"""
- 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_date
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def validate_date(self, data, original_data):
ends_at = data.get('valid_till', None)
if 'id' in original_data['data']:
try:
discount_code = DiscountCode.query.filter_by(
- 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 deeply nested control flow statements. Open
if session.ends_at is None or session.starts_at is None:
duration = ""
else:
duration = format_timedelta(
session.ends_at - session.starts_at
- Create a ticketCreate a ticket
Function query
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def query(self, view_kwargs):
"""
query method for SessionList class
:param view_kwargs:
:return:
- 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 send_event_invoice
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def send_event_invoice(
self, event_id: int, send_notification: bool = True, force: bool = False
):
this_month = this_month_date()
# Check if this month's invoice has been generated
- 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 deeply nested control flow statements. Open
for speaker in session.speakers:
person = Person(id=speaker.id, name=speaker.name)
session_event.add_person(person)
- Create a ticketCreate a ticket
Function event_query
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def event_query(
- Create a ticketCreate a ticket
Function before_update_object
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def before_update_object(self, ticket, data, view_kwargs):
"""
method to check if paid ticket has payment method before updating ticket object
:param ticket:
:param data:
- 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 send_email_task_smtp
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def send_email_task_smtp(payload):
smtp_config = get_smtp_config()
mailer_config = {'transport': {'use': 'smtp', **smtp_config}}
mailer = Mailer(mailer_config)
- 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 deeply nested control flow statements. Open
if hasattr(data, f):
fetched = getattr(data, f)
break
else:
- Create a ticketCreate a ticket
Function get_discount_amount
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_discount_amount(code, price, tax_included, tax, ticket_tax, discounted_tax):
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if element not in relationships and data[element] != getattr(
order, element, None
):
if element != 'status':
raise ForbiddenError(
- Create a ticketCreate a ticket
Function virtual_check_in
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def virtual_check_in(event_identifier):
"""Search attendees by name or email."""
event = db.session.query(Event).filter_by(identifier=event_identifier).first()
if event is None:
raise NotFoundError({'source': ''}, 'event can not be found')
- 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 deeply nested control flow statements. Open
if (
type(result.data['response']['recordings']['recording'])
is list
):
recordings = result.data['response']['recordings'][
- Create a ticketCreate a ticket
Function upload_to_gs
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def upload_to_gs(bucket_name, client_id, client_secret, file, key, acl='public-read'):
- Create a ticketCreate a ticket