fossasia/open-event-orga-server

View on GitHub

Showing 300 of 1,194 total issues

Function send_email has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

def send_email(to, action, subject, html, attachments=None, bcc=None, reply_to=None):
Severity: Major
Found in app/api/helpers/mail.py - About 50 mins to fix

Function upload_to_aws has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

def upload_to_aws(
Severity: Major
Found in app/api/helpers/storage.py - About 50 mins to fix

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

def get_order_data(order):
    """Get order data from order object"""
    if not order:
        return {
            'Tax ID': '',
Severity: Minor
Found in app/api/helpers/csv_jobs_util.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 celery_task has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def celery_task(task_id):
    """
    Get CeleryTask status of an API based task
    """
    # in case of always eager, get results. don't call AsyncResult
Severity: Minor
Found in app/api/celery_tasks.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 access_code:
                        access_code_value = access_code.code
                        break

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

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

def health_check_celery():
    """
    Check health status of celery and redis broker
    :return:
    """
Severity: Minor
Found in app/views/healthcheck.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 validate_date has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def validate_date(self, data, original_data):
        ends_at = data.get('valid_till', None)
        if 'id' in original_data['data']:
            try:
                discount_code = DiscountCode.query.filter_by(
Severity: Minor
Found in app/api/schema/discount_codes.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 session.ends_at is None or session.starts_at is None:
                            duration = ""
                        else:
                            duration = format_timedelta(
                                session.ends_at - session.starts_at
Severity: Major
Found in app/api/helpers/pentabarfxml.py - About 45 mins to fix

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

    def query(self, view_kwargs):
        """
        query method for SessionList class
        :param view_kwargs:
        :return:
Severity: Minor
Found in app/api/sessions.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_event_invoice has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def send_event_invoice(
    self, event_id: int, send_notification: bool = True, force: bool = False
):
    this_month = this_month_date()
    # Check if this month's invoice has been generated
Severity: Minor
Found in app/api/helpers/scheduled_jobs.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 speaker in session.speakers:
                            person = Person(id=speaker.id, name=speaker.name)
                            session_event.add_person(person)

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

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

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

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

    def before_update_object(self, ticket, data, view_kwargs):
        """
        method to check if paid ticket has payment method before updating ticket object
        :param ticket:
        :param data:
Severity: Minor
Found in app/api/tickets.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_task_smtp has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def send_email_task_smtp(payload):
    smtp_config = get_smtp_config()
    mailer_config = {'transport': {'use': 'smtp', **smtp_config}}

    mailer = Mailer(mailer_config)
Severity: Minor
Found in app/api/helpers/tasks.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 hasattr(data, f):
                        fetched = getattr(data, f)
                        break
            else:
Severity: Major
Found in app/api/helpers/permission_manager.py - About 45 mins to fix

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

def get_discount_amount(code, price, tax_included, tax, ticket_tax, discounted_tax):
Severity: Minor
Found in app/api/helpers/order.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                        if element not in relationships and data[element] != getattr(
                            order, element, None
                        ):
                            if element != 'status':
                                raise ForbiddenError(
Severity: Major
Found in app/api/orders.py - About 45 mins to fix

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

def virtual_check_in(event_identifier):
    """Search attendees by name or email."""
    event = db.session.query(Event).filter_by(identifier=event_identifier).first()
    if event is None:
        raise NotFoundError({'source': ''}, 'event can not be found')
Severity: Minor
Found in app/api/custom/events.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 (
                            type(result.data['response']['recordings']['recording'])
                            is list
                        ):
                            recordings = result.data['response']['recordings'][
Severity: Major
Found in app/api/video_recordings.py - About 45 mins to fix

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

def upload_to_gs(bucket_name, client_id, client_secret, file, key, acl='public-read'):
Severity: Minor
Found in app/api/helpers/storage.py - About 45 mins to fix
Severity
Category
Status
Source
Language