fossasia/open-event-orga-server

View on GitHub

Showing 300 of 1,194 total issues

Function downgrade has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def downgrade():
    op.alter_column('events', 'can_pay_by_stripe', new_column_name='pay_by_stripe')
    op.alter_column('events', 'can_pay_by_bank', new_column_name='pay_by_bank')
    op.alter_column('events', 'can_pay_by_cheque', new_column_name='pay_by_cheque')
    op.alter_column('events', 'can_pay_by_paypal', new_column_name='pay_by_paypal')
Severity: Minor
Found in migrations/versions/76c949b1235f_.py - About 1 hr to fix

Function downgrade has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, 'user_detail', type_='foreignkey')
    op.create_foreign_key(u'user_detail_user_id_fkey', 'user_detail', 'user', ['user_id'], ['id'])
    op.drop_constraint(None, 'ticket_holders', type_='foreignkey')
Severity: Minor
Found in migrations/versions/3f145ecaf358_.py - About 1 hr to fix

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

def upgrade():
    op.alter_column('events', 'pay_by_stripe', new_column_name='can_pay_by_stripe')
    op.alter_column('events', 'pay_by_bank', new_column_name='can_pay_by_bank')
    op.alter_column('events', 'pay_by_paypal', new_column_name='can_pay_by_paypal')
    op.alter_column('events', 'pay_by_cheque', new_column_name='can_pay_by_cheque')
Severity: Minor
Found in migrations/versions/76c949b1235f_.py - About 1 hr to fix

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

def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(u'discount_codes_event_id_fkey', 'discount_codes', type_='foreignkey')
    op.drop_constraint(u'discount_codes_marketer_id_fkey', 'discount_codes', type_='foreignkey')
    op.create_foreign_key(None, 'discount_codes', 'user', ['marketer_id'], ['id'], ondelete='CASCADE')
Severity: Minor
Found in migrations/versions/3f145ecaf358_.py - About 1 hr to fix

Function create_event_copy has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def create_event_copy(identifier):
    id = 'identifier'

    if identifier.isdigit():
        id = 'id'
Severity: Minor
Found in app/api/event_copy.py - About 1 hr to fix

Function validate_order_quantity has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def validate_order_quantity(self, data, original_data):
        if 'id' in original_data['data']:
            access_code = AccessCode.query.filter_by(id=original_data['data']['id']).one()

            if 'min_quantity' not in data:
Severity: Minor
Found in app/api/schema/access_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 init_filters has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def init_filters(app):
    @app.template_filter('currency_symbol')
    def currency_symbol_filter(currency_code):
        symbol = CurrencyCodes().get_symbol(currency_code)
        return symbol if symbol else currency_code
Severity: Minor
Found in app/templates/flask_ext/jinja/filters.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_order_ticket_data has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def get_order_ticket_data(attendee, order, ticket):
    """Get order ticket data"""
    data = {}
    if not order:
        return {
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 get_session_stats has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def get_session_stats(session_ids, session_checked_in, session_checked_out):
    """
    Get session stats
    @param session_ids: session id to get
    @param session_checked_in: session_checked_in
Severity: Minor
Found in app/api/custom/check_in_stats.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_get has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def before_get(self, args, kwargs):
        """
        before get method to get the resource id for fetching details
        :param args:
        :param kwargs:
Severity: Minor
Found in app/api/tax.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 authenticate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def authenticate(allow_refresh_token=False, existing_identity=None):
    data = request.get_json()
    username = data.get('email', data.get('username'))
    password = data.get('password')
    criterion = [username, password]
Severity: Minor
Found in app/api/auth.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 _order_json has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def _order_json(data, srv):
    """
    sorts the data a/c FIELD_ORDER and returns.
    If some keys are not included in FIELD_ORDER, they go at last, sorted alphabetically
    """
Severity: Minor
Found in app/api/helpers/export_helpers.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_receipt has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def send_receipt():
    """
    Send receipts to attendees related to the provided order.
    :return:
    """
Severity: Minor
Found in app/api/custom/attendees.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_check_in_out_status has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def validate_check_in_out_status(station: Station, attendee_data: UserCheckIn):
    """
    validate if attendee already check in/out
    @param station:
    @param attendee_data:
Severity: Minor
Found in app/api/helpers/user_check_in.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_file_from_request has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def get_file_from_request(ext=None, folder=None, name='file'):
    """
    Get file from a request, save it locally and return its path
    """
    if ext is None:
Severity: Minor
Found in app/api/helpers/import_helpers.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 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, 'users_events_roles', type_='foreignkey')
    op.create_foreign_key(u'users_events_roles_event_id_fkey', 'users_events_roles', 'events', ['event_id'], ['id'])
    op.drop_constraint(None, 'tracks', type_='foreignkey')
Severity: Minor
Found in migrations/versions/1b3e4f5f56bd_.py - About 1 hr to fix

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

def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(u'call_for_papers_event_id_fkey', 'call_for_papers', type_='foreignkey')
    op.create_foreign_key(None, 'call_for_papers', 'events', ['event_id'], ['id'], ondelete='CASCADE')
    op.drop_constraint(u'custom_forms_event_id_fkey', 'custom_forms', type_='foreignkey')
Severity: Minor
Found in migrations/versions/1b3e4f5f56bd_.py - About 1 hr to fix

Function create_save_resized_image has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

def create_save_resized_image(
Severity: Major
Found in app/api/helpers/files.py - About 1 hr to fix

Function check_migrations has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def check_migrations():
    """
    Checks whether database is up to date with migrations by performing a select query on each model
    :return:
    """
Severity: Minor
Found in app/views/healthcheck.py - About 55 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 validate_date has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def validate_date(event, data):
    if event:
        if 'starts_at' not in data:
            data['starts_at'] = event.starts_at

Severity: Minor
Found in app/api/events.py - About 55 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

Severity
Category
Status
Source
Language