Showing 1,194 of 1,194 total issues
Function is_speaker_itself_or_admin
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def is_speaker_itself_or_admin(view, view_args, view_kwargs, *args, **kwargs):
"""
Allows admin and super admin access to any resource irrespective of id.
Otherwise the user can only access his/her resource.
"""
- 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 add_in_room_virtual_room
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_in_room_virtual_room(
self, event: Event, rocket_user_id, videoStream: Optional[VideoStream] = None
):
bot = self.check_or_create_bot()
data = self.get_token_virtual_room(bot, videoStream=videoStream)
- 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_payment_intent_stripe
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_payment_intent_stripe(order_invoice, currency=None, credentials=None):
"""
Capture payments through stripe.
:param order_invoice: Order to be charged for
:param currency: Currency of the order amount.
- 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 verify_payment
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def verify_payment(payment_id, order):
"""
Verify Paypal payment one more time for paying with Paypal in mobile client
"""
PayPalPaymentsManager.configure_paypal()
- 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 _has_perm
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _has_perm(self, operation, service_class, event_id):
# Operation names and their corresponding permission in `Permissions`
operations = {
'create': 'can_create',
'read': 'can_read',
- 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_chat_token
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_chat_token(stream_id: int):
stream = VideoStream.query.get_or_404(stream_id)
event = stream.event
if not stream.user_can_access:
raise NotFoundError({'source': ''}, 'Video Stream Not 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
Function get_virtual_room_chat_token
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_virtual_room_chat_token(event_id: int, video_stream_id: int):
"""
Get room chat token for specific room
@param event_id: event identifier
@param video_stream_id: microlocation 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 get_room_chat_token
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_room_chat_token(event_id: int, microlocation_id: int):
"""
Get room chat token for specific room
@param event_id: event identifier
@param microlocation_id: microlocation 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 validate_date
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate_date(self, data, original_data):
if 'id' in original_data['data']:
speakers_calls = SpeakersCall.query.filter_by(
id=original_data['data']['id']
).one()
- 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_timezone
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate_timezone(self, data, original_data):
if 'id' in original_data['data']:
try:
event = Event.query.filter_by(id=original_data['data']['id']).one()
except NoResultFound:
- 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 to_event_id
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def to_event_id(func):
"""
Change event_identifier to event_id in kwargs
:param f:
: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 get_settings
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_settings(from_db=False):
"""
Use this to get latest system settings
"""
if not from_db and 'custom_settings' in current_app.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
Function is_moderator
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def is_moderator(f):
"""
Allows Organizer, Co-organizer and Moderator to access the resource(s).
:param f:
: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 import_event_json
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def import_event_json(task_handle, zip_path, creator_id):
"""
Imports and creates event from json zip
"""
global CUR_ID, UPLOAD_QUEUE
- 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 export_sessions_csv_task
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def export_sessions_csv_task(self, event_id, status='all'):
if status not in [
'all',
'pending',
'accepted',
- 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 after_get
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def after_get(self, res):
"""following the get event, compute the price"""
if 'data' in res:
data = res['data']
_events_id = map(lambda x: x['id'], 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 status_summary
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def status_summary(sales_summary, tickets_summary, status):
"""
Groups orders by status and returns the total sales and ticket count as a
dictionary
"""
- 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_distinct_sort_fields
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_distinct_sort_fields(schema, model, sort=True):
"""Due to the poor code of flask-rest-jsonapi, distinct query needed
in sessions API to remove duplicate sessions can't be sorted on
returning subquery, thus we need to add all sort fields in distinct
group and repeat it in sort group as well"""
- 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 check_email_override
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def check_email_override(data, event_id, speaker=None):
is_organizer = has_access('is_organizer', event_id=event_id)
email_overridden = data.get('is_email_overridden')
if email_overridden and not is_organizer:
raise ForbiddenError(
- 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_new_identifier
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_new_identifier(model=None, length=None):
if not length:
identifier = str(uuid.uuid4())
else:
identifier = str(binascii.b2a_hex(os.urandom(int(length / 2))), 'utf-8')
- 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"