fossasia/open-event-orga-server

View on GitHub

Showing 300 of 1,194 total issues

Function validate_quantity has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def validate_quantity(self, data):
        if 'max_order' in data and 'min_order' in data:
            if data['max_order'] < data['min_order']:
                raise UnprocessableEntityError(
                    {'pointer': '/data/attributes/max-order'},
Severity: Minor
Found in app/api/schema/tickets.py - About 1 hr 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 get_attendee_data has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

def get_attendee_data(attendee, custom_forms, attendee_form_dict):
    """Get attendee data from attendee object"""
    order_ticket_data = get_order_ticket_data(attendee, attendee.order, attendee.ticket)
    data = {
        **order_ticket_data,
Severity: Minor
Found in app/api/helpers/csv_jobs_util.py - About 1 hr 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 is_discount_available has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

def is_discount_available(
    discount_code,
    tickets=None,
    ticket_holders=None,
    quantity_discount=None,
Severity: Minor
Found in app/api/helpers/ticketing.py - About 1 hr 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_after_event_mail has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

def send_after_event_mail():
    current_time = datetime.datetime.now()
    events = (
        Event.query.filter_by(state='published', deleted_at=None)
        .filter(
Severity: Minor
Found in app/api/helpers/scheduled_jobs.py - About 1 hr 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 14 (exceeds 5 allowed). Consider refactoring.
Open

    def before_update_object(self, session, data, view_kwargs):
        """
        before update method to verify if session is locked before updating session object
        :param event:
        :param data:
Severity: Minor
Found in app/api/sessions.py - About 1 hr 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_task_sendgrid has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

def send_email_task_sendgrid(payload):
    message = Mail(
        from_email=From(payload['from'], payload['fromname']),
        to_emails=payload['to'],
        subject=payload['subject'],
Severity: Minor
Found in app/api/helpers/tasks.py - About 1 hr 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_update_object has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def after_update_object(self, session, data, view_kwargs):
        """Send email if session accepted or rejected"""

        if data.get('send_email', None) and g.get('send_email'):
            notify_for_session(session)
Severity: Minor
Found in app/api/sessions.py - About 1 hr 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 export has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def export(event_id):
        """Takes an event id and returns the event in xCal format"""

        event = Event.query.get(event_id)

Severity: Minor
Found in app/api/helpers/xcal.py - About 1 hr 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 downgrade has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('users', 'signup_at',
                    existing_type=sa.DateTime(timezone=True),
                    type_=postgresql.TIMESTAMP(),
Severity: Minor
Found in migrations/versions/f5fec4ca8b2b_.py - About 1 hr to fix

Function populate has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def populate():
    """
    Create defined Roles, Services and Permissions.
    """
    print('Creating roles...')
Severity: Minor
Found in populate_db.py - About 1 hr to fix

Function validate_quantity has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def validate_quantity(self, data, original_data):
        if 'id' in original_data['data']:
            try:
                discount_code = DiscountCode.query.filter_by(
                    id=original_data['data']['id']
Severity: Minor
Found in app/api/schema/discount_codes.py - About 1 hr 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 validate_quantity has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def validate_quantity(self, data, original_data):
        if 'id' in original_data['data']:
            try:
                discount_code = DiscountCode.query.filter_by(
                    id=original_data['data']['id']
Severity: Minor
Found in app/api/schema/discount_codes.py - About 1 hr 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 accept_invite has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def accept_invite():
    token = request.json['data']['token']
    try:
        role_invite = RoleInvite.query.filter_by(hash=token).one()
    except NoResultFound:
Severity: Minor
Found in app/api/role_invites.py - About 1 hr 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 query has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def query(self, view_kwargs):
        """
        query method for resource list
        :param view_kwargs:
        :return:
Severity: Minor
Found in app/api/tickets.py - About 1 hr 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 create_onsite_attendees_for_order has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def create_onsite_attendees_for_order(data):
    """
    Creates on site ticket holders for an order and adds it into the request data.
    :param data: data initially passed in the POST request for order.
    :return:
Severity: Minor
Found in app/api/helpers/order.py - About 1 hr 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 create_object has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def create_object(data, _view_kwargs):
        """
        create_object method for the Badge Form Layer
        charge the user using paypal or stripe
        :param data:
Severity: Minor
Found in app/api/data_layers/BadgeFormLayer.py - About 1 hr 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_post has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def before_post(self, args, kwargs, data=None):
        """
        method to add user_id to view_kwargs before post
        :param args:
        :param kwargs:
Severity: Minor
Found in app/api/speakers.py - About 1 hr 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 downgrade has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def downgrade():
    ### commands auto generated by Alembic - please adjust! ###

    op.create_table('temp_user',
    sa.Column('id', sa.INTEGER(), nullable=False),
Severity: Minor
Found in migrations/versions/9105f9e64cdc_.py - About 1 hr to fix

Function create_app has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def create_app():
    global app_created
    if not app_created:
        BlueprintsManager.register(app)
        graphql_views.init_app(app)
Severity: Minor
Found in app/instance.py - About 1 hr to fix

Function upgrade has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(u'association_ticket_tag_id_fkey', 'association', type_='foreignkey')
    op.drop_constraint(u'association_ticket_id_fkey', 'association', type_='foreignkey')
    op.create_foreign_key(None, 'association', 'ticket_tag', ['ticket_tag_id'], ['id'], ondelete='CASCADE')
Severity: Minor
Found in migrations/versions/e95a9cd83678_.py - About 1 hr to fix
Severity
Category
Status
Source
Language