Showing 300 of 1,194 total issues
Function before_create_object
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def before_create_object(self, data, view_kwargs):
if data.get('used_for') == 'ticket' and (event_id := data.get('event')):
discount_codes = DiscountCode.query.filter_by(
event_id=event_id, code=data['code'], deleted_at=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 get_token
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def get_token(
self,
user: User,
event: Optional[Event] = None,
retried=False,
- 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_token_virtual_room
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def get_token_virtual_room(
self,
user: User,
event: Optional[Event] = None,
retried=False,
- 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 _fix_related_fields
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def _fix_related_fields(srv, data, service_ids):
"""
Fixes the ids services which are related to others.
Like track, format -> session
Also fixes their schema
- 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_value_from_qr_filed
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def get_value_from_qr_filed(field: BadgeFieldForms, ticket_holder: TicketHolder) -> dict:
"""Get the value of a QR code field."""
qr_value = {}
custom_fields = []
if field.qr_custom_field is not 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 upgrade
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.rename_table('user', 'temp_user')
op.create_table('users',
sa.Column('id', sa.Integer(), nullable=False, autoincrement=True),
- Create a ticketCreate a ticket
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
File speaker_invites.py
has 264 lines of code (exceeds 250 allowed). Consider refactoring. Open
from flask import Blueprint, jsonify
from flask_jwt_extended import current_user
from flask_rest_jsonapi import ResourceDetail, ResourceList, ResourceRelationship
from sqlalchemy.orm.exc import NoResultFound
- Create a ticketCreate a ticket
File orders.py
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
import os
from datetime import datetime
from flask import Blueprint, jsonify, make_response, request
from flask.helpers import send_from_directory
- Create a ticketCreate a ticket
Function export_attendees_csv_task
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def export_attendees_csv_task(self, event_id):
attendees = (
db.session.query(TicketHolder)
.filter_by(event_id=event_id)
.order_by(desc(func.date(TicketHolder.created_at)))
- 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 upgrade
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_or_replace_sp(replace_in_table)
op.alter_column('social_links', 'link',
existing_type=sa.VARCHAR(),
- Create a ticketCreate a ticket
Function downgrade
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
def downgrade():
# commands auto generated by Alembic - please adjust! #
op.rename_table('activities', 'activity')
op.rename_table('custom_placeholders', 'custom_placeholder')
op.rename_table('custom_sys_roles', 'custom_sys_role')
- Create a ticketCreate a ticket
Function upgrade
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
def upgrade():
# commands auto generated by Alembic - please adjust! #
op.rename_table('activity', 'activities')
op.rename_table('custom_placeholder', 'custom_placeholders')
op.rename_table('custom_sys_role', 'custom_sys_roles')
- Create a ticketCreate a ticket
Function before_patch
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def before_patch(_args, kwargs, data):
"""
before patch method
:param _args:
:param kwargs:
- 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 before_patch
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def before_patch(_args, kwargs, data):
"""
before patch method
:param _args:
:param kwargs:
- 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 create_object
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def create_object(self, data, view_kwargs):
"""
create_object method for the Charges layer
charge the user using paypal or stripe
: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
File instance.py
has 253 lines of code (exceeds 250 allowed). Consider refactoring. Open
import logging
import os.path
import secrets
import sys
from datetime import timedelta
- Create a ticketCreate a ticket
Function create_default_user
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def create_default_user(email, password):
print("Your login is 'super_admin'.")
if not email:
ask_email = True
while ask_email:
- 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 login_user
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def login_user(provider):
if provider == 'facebook':
provider_class = FbOAuth()
payload = {
'client_id': provider_class.get_client_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 upgrade
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.execute("SET TIME ZONE 'utc'")
op.alter_column('access_codes', 'created_at',
existing_type=postgresql.TIMESTAMP(),
- Create a ticketCreate a ticket