Showing 300 of 1,194 total issues
File payment.py
has 337 lines of code (exceeds 250 allowed). Consider refactoring. Open
import json
import omise
import paypalrestsdk
import requests
- Create a ticketCreate a ticket
File import_helpers.py
has 335 lines of code (exceeds 250 allowed). Consider refactoring. Open
import json
import os
import shutil
import traceback
import uuid
- Create a ticketCreate a ticket
File rocket_chat.py
has 324 lines of code (exceeds 250 allowed). Consider refactoring. Open
import logging
import random
import string
from dataclasses import dataclass
from typing import Optional
- Create a ticketCreate a ticket
File system_mails.py
has 317 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
All the System mails
Register a mail here before using it
"""
- Create a ticketCreate a ticket
Function before_get_object
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def before_get_object(self, view_kwargs):
"""
before get method for Discount Code detail
:param view_kwargs:
:return:
- Read upRead up
- Create a ticketCreate a ticket
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 25 (exceeds 5 allowed). Consider refactoring. Open
def before_get(self, args, kwargs):
if kwargs.get('video_stream_id'):
stream = safe_query_kwargs(VideoStream, kwargs, 'video_stream_id', 'id')
if stream.channel and stream.channel.provider == 'bbb':
- Read upRead up
- Create a ticketCreate a ticket
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
File users.py
has 311 lines of code (exceeds 250 allowed). Consider refactoring. Open
from flask_jwt_extended import current_user
from marshmallow import pre_dump
from marshmallow_jsonapi import fields
from marshmallow_jsonapi.flask import Relationship
- Create a ticketCreate a ticket
Function create_save_image_sizes
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def create_save_image_sizes(
image_file, image_sizes_type, unique_identifier=None, folder=None
):
"""
Save the resized version of the background image
- Read upRead up
- Create a ticketCreate a ticket
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 to_ical
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def to_ical(event, include_sessions=False, my_schedule=False, user_id=None):
cal = Calendar()
cal.add('version', '2.0')
cal.add('METHOD', 'PUBLISH')
cal.add('X-WR-CALNAME', event.name)
- Read upRead up
- Create a ticketCreate a ticket
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_custom_form_constraints
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def validate_custom_form_constraints(form, obj, excluded):
"""
The validate custom form constraints.
"""
conditions = {
- Read upRead up
- Create a ticketCreate a ticket
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 23 (exceeds 5 allowed). Consider refactoring. Open
def before_update_object(self, event, data, view_kwargs):
"""
method to save image urls before updating event object
:param event:
:param data:
- Read upRead up
- Create a ticketCreate a ticket
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
File scheduled_jobs.py
has 302 lines of code (exceeds 250 allowed). Consider refactoring. Open
import datetime
import logging
import pytz
from flask_celeryext import RequestContextTask
- Create a ticketCreate a ticket
File export_helpers.py
has 296 lines of code (exceeds 250 allowed). Consider refactoring. Open
import json
import os
import shutil
from collections import OrderedDict
from datetime import datetime
- Create a ticketCreate a ticket
Function calculate_update_amount
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def calculate_update_amount(order):
discount = None
if order.discount_code_id:
discount = order.discount_code
# Access code part will be done ticket_holders API
- Read upRead up
- Create a ticketCreate a ticket
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
File tickets.py
has 292 lines of code (exceeds 250 allowed). Consider refactoring. Open
from flask import Blueprint, jsonify
from flask_jwt_extended import current_user, verify_jwt_in_request
from flask_rest_jsonapi import ResourceDetail, ResourceList, ResourceRelationship
from flask_rest_jsonapi.exceptions import ObjectNotFound
from sqlalchemy.orm.exc import NoResultFound
- Create a ticketCreate a ticket
Function _download_media
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def _download_media(data, srv, dir_path, settings):
"""
Downloads the media and saves it
"""
if srv not in DOWNLOAD_FIEDLS:
- Read upRead up
- Create a ticketCreate a ticket
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
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def send_email(to, action, subject, html, attachments=None, bcc=None, reply_to=None):
"""
Sends email and records it in DB
"""
from .tasks import get_smtp_config, send_email_task_sendgrid, send_email_task_smtp
- Read upRead up
- Create a ticketCreate a ticket
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_satus
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def validate_satus(self, data, original_data):
if 'role' in data and 'role_name' in data:
try:
role = Role.query.filter_by(id=data['role']).one()
except NoResultFound:
- Read upRead up
- Create a ticketCreate a ticket
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
File check_in_stats.py
has 268 lines of code (exceeds 250 allowed). Consider refactoring. Open
import datetime
from flask import Blueprint, request
from sqlalchemy import desc
- Create a ticketCreate a ticket
Function before_create_object
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def before_create_object(self, data, view_kwargs):
if data.get('used_for') == 'ticket' and (event_id := data.get('event')):
discount_codes = DiscountCode.query.filter_by(
event_id=event_id, code=data['code'], deleted_at=None
)
- Read upRead up
- Create a ticketCreate a ticket
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"