Showing 106 of 169 total issues
Function post
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def post(self):
user = g.user
form = ApplicationSessionForm()
if not form.validate_on_submit():
- 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 check_data
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def check_data(datadir):
"""
Checks given applications and templates YAML data files in given directory for consistency.
"""
applications_file = datadir + '/applications.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"
Further reading
Function render_template_objects
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def render_template_objects(self, namespace, application_session):
""" Render the template for the application session. This is done on OpenShift server.
"""
application_config = application_session['provisioning_config']
- 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 process_application
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def process_application(application):
# cache application template names in the request context to avoid lookups on every call
template_name_cache = g.setdefault('template_name_cache', dict())
if application.template_id not in template_name_cache.keys():
result = db.session.execute(
- 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 get
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def get(self):
user = g.user
args = self.get_parser.parse_args()
workspace_user_query = WorkspaceMembership.query
- 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 process_volume_restore_task
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def process_volume_restore_task(self, task):
task_data = task.get('data')
driver = self.get_driver(task_data.get('tgt_cluster'))
if not driver:
raise RuntimeError(
- 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 post
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def post(self):
user = g.user
user_owned_workspaces = WorkspaceMembership.query.filter_by(user_id=user.id, is_owner=True)
num_user_owned_workspaces = [
w.workspace.status == Workspace.STATUS_ACTIVE for w in user_owned_workspaces].count(True)
- 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 delete
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def delete(self, application_id):
user = g.user
s = rules.generate_application_query(user, dict(application_id=application_id))
application = db.session.scalar(s)
if not application:
- 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 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, name=None, description=None, template_id=None, workspace_id=None, labels=None,
Function list_application_images
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def list_application_images():
"""
Lists images used by non-deleted applications
"""
applications = Application.query.filter(Application.status != 'deleted').all()
- 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 post
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def post(self):
parser = reqparse.RequestParser()
parser.add_argument('agreement_sign', type=str, default=False)
args = parser.parse_args()
form = SessionCreateForm()
- 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 createuser_bulk
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def createuser_bulk(user_prefix=None, domain_name=None, count=0, lifetime_in_days=0):
"""Creates new demo users"""
if not count:
count = int(input('Enter the number of demo user accounts needed: '))
print()
- 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 post
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def post(self):
form = ApplicationForm()
if not form.validate_on_submit():
logging.warning("Form validation error on create application %s" % form.errors)
return form.errors, 422
Function check_attribute_limit_format
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def check_attribute_limit_format(limits):
"""Check attribute limit format. Return None if AOK, error string otherwise"""
for limit in limits:
name = limit.get('name', None)
min = limit.get('min', None)
- 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 update
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def update(self, token, application_session_id):
""" an update call updates the status of an application_session.
If an application_session is
* queued it will be provisioned
- 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 get
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def get(self, workspace_id):
applications = Application.query.filter_by(workspace_id=workspace_id).all()
session_accounting = {}
total_gib_hours = 0
- 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 run_membership_expiry_cleanup
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def run_membership_expiry_cleanup(pb_client):
"""Deletes expired workspace memberships by
- listing workspaces with matching policy
- asking API to clean up the mappings
"""
- 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 put
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def put(self, application_id):
user = g.user
application = Application.query.filter_by(id=application_id).first_or_404()
args = self.parser.parse_args()
- 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 patch
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def patch(self, workspace_id):
user = g.user
args = self.patch_parser.parse_args()
workspace = Workspace.query.filter_by(id=workspace_id).first()
if not workspace:
- 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 oauth2_login
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def oauth2_login():
parser = reqparse.RequestParser()
parser.add_argument('agreement_sign', type=str, default=False, location='args')
args = parser.parse_args()
if not current_app.config['OAUTH2_LOGIN_ENABLED']: