fossasia/open-event-orga-server

View on GitHub

Showing 300 of 1,194 total issues

Function query has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def query(self, view_kwargs):
        """
        query method for speakers list class
        :param view_kwargs:
        :return:
Severity: Minor
Found in app/api/speakers.py - About 45 mins to fix

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 recording in recordings:
                            get_or_create(
                                VideoRecording,
                                bbb_record_id=recording['recordID'],
                                participants=recording['participants'],
Severity: Major
Found in app/api/video_recordings.py - About 45 mins to fix

Function get_discount_data has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

def get_discount_data(
Severity: Minor
Found in app/api/helpers/order.py - About 45 mins to fix

Function create_permissions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def create_permissions():
    ownr = Role.query.filter_by(name=Role.OWNER).first()
    orgr = Role.query.filter_by(name=Role.ORGANIZER).first()
    coorgr = Role.query.filter_by(name=Role.COORGANIZER).first()
    track_orgr = Role.query.filter_by(name=TRACK_ORGANIZER).first()
Severity: Minor
Found in populate_db.py - About 45 mins to fix

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_to_attendees has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def send_email_to_attendees(order):
    attachments = None
    if current_app.config['ATTACH_ORDER_PDF']:
        attachments = [order.ticket_pdf_path, order.invoice_pdf_path]

Severity: Minor
Found in app/api/helpers/mail.py - About 45 mins to fix

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 (
                            element not in relationships
                            and data[element] != getattr(order, element, None)
                            and element not in get_updatable_fields()
                        ):
Severity: Major
Found in app/api/orders.py - About 45 mins to fix

Function db_drop_everything has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def db_drop_everything(db):
    # From http://www.sqlalchemy.org/trac/wiki/UsageRecipes/DropEverything

    conn = db.engine.connect()

Severity: Minor
Found in drop_db.py - About 45 mins to fix

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_create_object has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def after_create_object(self, event_topic, data, view_kwargs):
        """
        after create method to save roles for users and add the user as an accepted role(organizer)
        :param event_topic:
        :param data:
Severity: Minor
Found in app/api/event_topics.py - About 45 mins to fix

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 8 (exceeds 5 allowed). Consider refactoring.
Open

    def before_update_object(self, event_topic, data, view_kwargs):
        """
        method to save image urls before updating event object
        :param event_topic:
        :param data:
Severity: Minor
Found in app/api/event_topics.py - About 45 mins to fix

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

Consider simplifying this complex logical expression.
Open

    if mode == 'stripe':
        return (
            (order.paid_via == 'stripe')
            and order.brand
            and order.transaction_id
Severity: Major
Found in app/api/orders.py - About 40 mins to fix

Consider simplifying this complex logical expression.
Open

    if data.get('is_billing_enabled') and not (
        data.get('company')
        and data.get('address')
        and data.get('city')
        and data.get('zipcode')
Severity: Major
Found in app/api/orders.py - About 40 mins to fix

Function is_session_self_submitted has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

def is_session_self_submitted(view, view_args, view_kwargs, *args, **kwargs):
Severity: Minor
Found in app/api/helpers/permission_manager.py - About 35 mins to fix

Function is_user_itself has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

def is_user_itself(view, view_args, view_kwargs, *args, **kwargs):
Severity: Minor
Found in app/api/helpers/permission_manager.py - About 35 mins to fix

Function set_event_id has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

def set_event_id(model, identifier, kwargs, attr='event_id', column_name='id'):
Severity: Minor
Found in app/api/events.py - About 35 mins to fix

Function is_coorganizer has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

def is_coorganizer(view, view_args, view_kwargs, *args, **kwargs):
Severity: Minor
Found in app/api/helpers/permission_manager.py - About 35 mins to fix

Function is_super_admin has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

def is_super_admin(view, view_args, view_kwargs, *args, **kwargs):
Severity: Minor
Found in app/api/helpers/permission_manager.py - About 35 mins to fix

Function is_admin has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

def is_admin(view, view_args, view_kwargs, *args, **kwargs):
Severity: Minor
Found in app/api/helpers/permission_manager.py - About 35 mins to fix

Function is_owner has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

def is_owner(view, view_args, view_kwargs, *args, **kwargs):
Severity: Minor
Found in app/api/helpers/permission_manager.py - About 35 mins to fix

Function is_registrar_or_user_itself has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

def is_registrar_or_user_itself(view, view_args, view_kwargs, *args, **kwargs):
Severity: Minor
Found in app/api/helpers/permission_manager.py - About 35 mins to fix

Function is_coorganizer_but_not_admin has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

def is_coorganizer_but_not_admin(view, view_args, view_kwargs, *args, **kwargs):
Severity: Minor
Found in app/api/helpers/permission_manager.py - About 35 mins to fix
Severity
Category
Status
Source
Language