fossasia/open-event-orga-server

View on GitHub

Showing 300 of 1,194 total issues

Function before_get has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def before_get(self, args, kwargs):
        refresh = request.args.get('refresh')
        if refresh == 'true':
            refresh_settings()
        kwargs['id'] = 1
Severity: Minor
Found in app/api/settings.py - About 35 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 check_event_user_ticket_holders has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def check_event_user_ticket_holders(order, data, element):
    if element in ['event', 'user'] and data[element] != str(
        getattr(order, element, None).id
    ):
        raise ForbiddenError(
Severity: Minor
Found in app/api/orders.py - About 35 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 _upload_media_queue has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def _upload_media_queue(srv, obj):
    """
    Add media uploads to queue
    """
    global UPLOAD_QUEUE
Severity: Minor
Found in app/api/helpers/import_helpers.py - About 35 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 export_xcal_task has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def export_xcal_task(self, event_id, temp=True):
    event = safe_query(Event, 'id', event_id, 'event_id')

    try:
        if temp:
Severity: Minor
Found in app/api/helpers/tasks.py - About 35 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 too many return statements within this function.
Open

        return None
Severity: Major
Found in app/api/helpers/payment.py - About 30 mins to fix

Avoid too many return statements within this function.
Open

    return True, 'celery ok'
Severity: Major
Found in app/views/healthcheck.py - About 30 mins to fix

Avoid too many return statements within this function.
Open

            return True, None
Severity: Major
Found in app/api/helpers/payment.py - About 30 mins to fix

Avoid too many return statements within this function.
Open

                return False, 'Payment already been verified'
Severity: Major
Found in app/api/helpers/payment.py - About 30 mins to fix

Avoid too many return statements within this function.
Open

            return False, 'Payment Not Found'
Severity: Major
Found in app/api/helpers/payment.py - About 30 mins to fix

Avoid too many return statements within this function.
Open

        return False, 'celery not ok'
Severity: Major
Found in app/views/healthcheck.py - About 30 mins to fix

Avoid too many return statements within this function.
Open

        return None
Severity: Major
Found in app/api/schema/user_check_in.py - About 30 mins to fix

Avoid too many return statements within this function.
Open

    return None
Severity: Major
Found in app/api/helpers/mail.py - About 30 mins to fix

Function validate_date has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def validate_date(self, data, original_data):
        if 'id' in original_data['data']:
            ticket = Ticket.query.filter_by(id=original_data['data']['id']).one()

            if 'sales_starts_at' not in data:
Severity: Minor
Found in app/api/schema/tickets.py - About 25 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 configure_paypal has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def configure_paypal():
        """
        Configure the paypal sdk
        :return: Credentials
        """
Severity: Minor
Found in app/api/helpers/payment.py - About 25 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 add_in_room has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def add_in_room(
        self, event: Event, rocket_user_id, microlocation: Optional[Microlocation] = None
    ):
        bot = self.check_or_create_bot()
        data = self.get_token(bot)
Severity: Minor
Found in app/api/chat/rocket_chat.py - About 25 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_get has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def after_get(custom_forms):
        """
        query method for different view_kwargs
        :param view_kwargs:
        :return:
Severity: Minor
Found in app/api/custom_forms.py - About 25 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_patch has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def before_patch(_args, _kwargs, data):
        """
        before patch method
        :param _args:
        :param kwargs:
Severity: Minor
Found in app/api/station_store_paxs.py - About 25 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 _email_message has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def _email_message(cls, action, attr=None):
        message = {}
        if action in MailType.entries():
            message = MAILS.get(action)
        else:
Severity: Minor
Found in app/models/message_setting.py - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

    def after_create_object(self, stream, data, view_kwargs):
        if stream.channel and stream.channel.provider == 'bbb':
            params_isMeetingRunning = dict(
                meetingID=stream.extra['response']['meetingID'],
            )
Severity: Minor
Found in app/api/video_stream.py - About 25 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 reject_invite has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def reject_invite(speaker_invite_id):
    try:
        speaker_invite = SpeakerInvite.query.filter_by(id=speaker_invite_id).one()
    except NoResultFound:
        raise NotFoundError({'source': ''}, 'Speaker Invite Not Found')
Severity: Minor
Found in app/api/speaker_invites.py - About 25 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