Showing 300 of 1,194 total issues
File order.py
has 421 lines of code (exceeds 250 allowed). Consider refactoring. Open
import logging
from datetime import datetime, timedelta, timezone
from flask import render_template
from flask_rest_jsonapi.exceptions import ObjectNotFound
- Create a ticketCreate a ticket
Function validate_value
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
def validate_value(self, data, original_data):
if 'id' in original_data['data']:
try:
discount_code = DiscountCode.query.filter_by(
id=original_data['data']['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 before_update_object
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
def before_update_object(self, obj, data, kwargs):
"""
before update object method for attendee detail
:param obj:
: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 csv_jobs_util.py
has 394 lines of code (exceeds 250 allowed). Consider refactoring. Open
import pytz
from app.api.admin_sales.utils import event_type, summary
from app.api.helpers.group_user_role import get_user_group_role
from app.models import db
- Create a ticketCreate a ticket
File user.py
has 392 lines of code (exceeds 250 allowed). Consider refactoring. Open
import random
from datetime import datetime
import humanize
import pytz
- Create a ticketCreate a ticket
File users.py
has 389 lines of code (exceeds 250 allowed). Consider refactoring. Open
import logging
from datetime import datetime
from flask import Blueprint, abort, jsonify, make_response, request
from flask_jwt_extended import current_user, verify_fresh_jwt_in_request
- Create a ticketCreate a ticket
File sessions.py
has 379 lines of code (exceeds 250 allowed). Consider refactoring. Open
from datetime import datetime
from typing import Dict, Optional
import pytz
from flask import Blueprint, g, jsonify, request
- Create a ticketCreate a ticket
File files.py
has 374 lines of code (exceeds 250 allowed). Consider refactoring. Open
import base64
import io
import os
import urllib.parse
import urllib.request
- Create a ticketCreate a ticket
Function create_print_badge_pdf
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def create_print_badge_pdf(self, attendee_id, list_field_show):
"""
Create tickets and invoices for the holders of an order.
@param self: create_print_badge_pdf
@param attendee_id: attendee
- 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 populate_db.py
has 370 lines of code (exceeds 250 allowed). Consider refactoring. Open
from app.api.helpers.db import get_or_create
# Admin message settings
from app.api.helpers.system_mails import MailType
from app.instance import current_app
- Create a ticketCreate a ticket
Function before_update_object
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def before_update_object(self, user, data, view_kwargs):
# TODO: Make a celery task for this
# if data.get('avatar_url') and data['original_image_url'] != user.original_image_url:
# try:
# uploaded_images = create_save_image_sizes(data['original_image_url'], 'speaker-image', user.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 create_order
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def create_order():
data, errors = OrderAmountInputSchema().load(request.get_json())
if errors:
return make_response(jsonify(errors), 422)
- 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
Event
has 36 functions (exceeds 20 allowed). Consider refactoring. Open
class Event(SoftDeletionModel):
"""Event object table"""
class State:
PUBLISHED = 'published'
- Create a ticketCreate a ticket
Function create_preivew_badge_pdf
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def create_preivew_badge_pdf(badgeForms):
"""
Create tickets and invoices for the holders of an order.
:param badgeForms: The order for which to create tickets for.
"""
- 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 calculate_order_amount
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def calculate_order_amount(tickets, verify_discount=True, discount_code=None):
from app.api.helpers.ticketing import (
is_discount_available,
validate_discount_code,
validate_tickets,
- 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 f5fec4ca8b2b_.py
has 357 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""empty message
Revision ID: f5fec4ca8b2b
Revises: b15e124e9b93
Create Date: 2017-06-07 02:26:13.097039
- Create a ticketCreate a ticket
Function _upload_media
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def _upload_media(task_handle, event_id, base_path):
"""
Actually uploads the resources
"""
global 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
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def export(event_id):
"""Takes an event id and returns the event in pentabarf XML format"""
event = EventModel.query.get(event_id)
diff = event.ends_at - event.starts_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
File video_stream.py
has 350 lines of code (exceeds 250 allowed). Consider refactoring. Open
import logging
from uuid import uuid4
from flask import jsonify
from flask.blueprints import Blueprint
- Create a ticketCreate a ticket
Function before_create_object
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def before_create_object(self, data, _view_kwargs):
"""
before create object method for UserCheckInListPost Class
:param data:
:param _view_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"