Showing 106 of 169 total issues
File models.py
has 752 lines of code (exceeds 250 allowed). Consider refactoring. Open
import datetime
import hashlib
import importlib
import inspect
import json
File workspaces.py
has 702 lines of code (exceeds 250 allowed). Consider refactoring. Open
import datetime
import json
import logging
import re
import time
File kubernetes_driver.py
has 643 lines of code (exceeds 250 allowed). Consider refactoring. Open
import datetime
import logging
import os
import time
from enum import Enum, unique
Function oauth2_login
has a Cognitive Complexity of 45 (exceeds 5 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']:
- 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 do_check_readiness
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
def do_check_readiness(self, token, application_session_id):
application_session = self.fetch_and_populate_application_session(token, application_session_id)
namespace = self.get_application_session_namespace(application_session)
pod_api = self.dynamic_client.resources.get(api_version='v1', kind='Pod')
pods = pod_api.get(
- 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
File applications.py
has 350 lines of code (exceeds 250 allowed). Consider refactoring. Open
import datetime
import logging
import uuid
import flask_restful as restful
KubernetesDriverBase
has 34 functions (exceeds 20 allowed). Consider refactoring. Open
class KubernetesDriverBase(base_driver.ProvisioningDriverBase):
def __init__(self, logger, config, cluster_config, token):
super().__init__(logger, config, cluster_config, token)
self.ingress_app_domain = cluster_config.get('appDomain', 'localhost')
File application_sessions.py
has 338 lines of code (exceeds 250 allowed). Consider refactoring. Open
import datetime
import json
import logging
import flask_restful as restful
Function put
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def put(self, workspace_id):
form = WorkspaceForm()
if not form.validate_on_submit():
logging.warning('validation error on updating workspace')
return form.errors, 422
- 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
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
File controllers.py
has 321 lines of code (exceeds 250 allowed). Consider refactoring. Open
import logging
import os
import time
import traceback
from random import randrange
Function process
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def process(self):
# process sessions in increased intervals
if time.time() < self.next_check_ts:
return
self.update_next_check_ts(self.polling_interval_min, self.polling_interval_max)
- 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
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def process(self):
# process clusters in increased intervals
if time.time() < self.next_check_ts:
return
self.update_next_check_ts(self.polling_interval_min, self.polling_interval_max)
- 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
PBClient
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
class PBClient:
def __init__(self, token, api_base_url, ssl_verify=True):
self.token = token
self.api_base_url = api_base_url
self.ssl_verify = ssl_verify
Function init_api
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
def init_api(app: Flask):
from pebbles.views.alerts import AlertList, AlertView, SystemStatus, AlertReset
from pebbles.views.application_categories import ApplicationCategoryList
from pebbles.views.application_sessions import ApplicationSessionList, ApplicationSessionView, \
ApplicationSessionLogs
Function patch
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def patch(self, application_session_id):
user = g.user
# check that the user has rights to access the session
opts = dict(application_session_id=application_session_id)
- 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_provisioning_config
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def get_provisioning_config(application):
"""Render provisioning config for application"""
app_config = application.config if application.config else {}
provisioning_config = application.base_config.copy()
- 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 handle_status_change
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def handle_status_change(self, user, workspace_id, new_status):
workspace = Workspace.query.filter_by(id=workspace_id).first()
if not workspace:
abort(404)
- 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 do_deprovision
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def do_deprovision(self, token, application_session_id):
application_session = self.fetch_and_populate_application_session(token, application_session_id)
namespace = self.get_application_session_namespace(application_session)
# remove deployment
try:
- 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 17 (exceeds 5 allowed). Consider refactoring. Open
def patch(self, application_session_id):
patch_parser = reqparse.RequestParser()
patch_parser.add_argument('log_record', type=dict)
args = patch_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"