File models.py
has 752 lines of code (exceeds 250 allowed). Consider refactoring. Open
import datetime
import hashlib
import importlib
import inspect
import json
User
has 31 functions (exceeds 20 allowed). Consider refactoring. Open
class User(db.Model):
__tablename__ = 'users'
id = db.Column(db.String(32), primary_key=True)
# ext_id is mandatory and unique. ext_id can be used to retrieve database objects
Function __init__
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, name=None, description=None, template_id=None, workspace_id=None, labels=None,
Function __init__
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, ext_id, password=None, is_admin=False, email_id=None, expiry_ts=None, pseudonym=None,
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, name=None, description=None, application_type='generic', attribute_limits=None,
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, subject, content, level, targets, is_enabled, is_public):
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, id, target, source, status, data):
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, application_session_id, log_level, log_type, timestamp, message):
Function check_membership_expiry_policy
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def check_membership_expiry_policy(mep):
""" Return validation errors for given membership expiry policy or None if successful """
if not isinstance(mep, dict):
return 'membership expiry policy must be a dict'
kind = mep.get('kind')
- Read upRead up
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__
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, ext_id, password=None, is_admin=False, email_id=None, expiry_ts=None, pseudonym=None,
workspace_quota=None):
self.id = uuid.uuid4().hex
self.ext_id = ext_id
self.is_admin = is_admin
- Read upRead up
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
Avoid too many return
statements within this function. Open
return None
Function load_yaml
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def load_yaml(yaml_data):
"""
A function to load annotated yaml data into the database.
Example can be found in devel_dataset.yaml
"""
- Read upRead up
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"