Showing 14 of 20 total issues
Function sortingOnNotebook
has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring. Open
def sortingOnNotebook(notebooks, sorter, _filter):
sortedNotebookId= []
if sorter['columnKey'] == "schedule" and sorter['order'] == 'ascend':
sortedNotebookId = NotebookJob.objects.all().order_by("crontab__customschedule__name").values_list("notebookId", flat=True)
for notebookId in sortedNotebookId[::-1]:
- 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 getNotebooks
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def getNotebooks(offset: int = 0, limit: int = None , searchQuery: str = None, sorter: dict = None, _filter: dict = None):
"""
Service to fetch and serialize NotebookJob objects
Number of NotebookObjects fetched is stored as the constant GET_NOTEBOOKOJECTS_LIMIT
:param offset: Offset for fetching NotebookJob objects
- 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 __setNotebookStatus
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def __setNotebookStatus(response, notebookRunLogs: NotebookRunLogs):
"""
Sets notebook run status based on the response
"""
if response:
- 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 getDriversCount
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def getDriversCount(self):
"""
Gets Driver and executors count
"""
runningDrivers = 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 runNotebookJob
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def runNotebookJob(notebookId: str, notebookRunLogsId: int = None, runType: str = "Scheduled"):
"""
Celery task to run a zeppelin notebook
:param notebookId: ID of the zeppelin notebook which to run
:param notebookRunLogsId: ID of genie.notebookRunLogs model
- 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 _prepareNotebookJson
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _prepareNotebookJson(notebookTemplate: NotebookTemplate, payload: dict):
"""
Utility function for preparing notebook json to be sent to zeppelin
Can be used to add a notebook or edit one
Returns tuple containing notebook json and notebook connection
- 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 updateWorkflow
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def updateWorkflow(
id: int,
name: str,
scheduleId: int,
triggerWorkflowId: int,
- 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 updateWorkflow
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def updateWorkflow(
Function __checkIfNotebookRunningAndStoreLogs
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def __checkIfNotebookRunningAndStoreLogs(notebookId: str, notebookRunLogs: NotebookRunLogs, zeppelin: ZeppelinAPI):
"""
Checks if notebook is running and stores logs
"""
response = zeppelin.getNotebookDetailsWithRetry(notebookId)
- 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 notify
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def notify(notebookName: str, isSuccess: bool, message: str):
"""
Service to send message to preconfigured slack channel
:param message: Message to be sent to slack
"""
- 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 __checkOrphanNotebookJobs
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def __checkOrphanNotebookJobs():
from genie.models import NotebookRunLogs, NOTEBOOK_STATUS_RUNNING
notebookRunLogs = NotebookRunLogs.objects.filter(status__in=[NOTEBOOK_STATUS_RUNNING])
if len(notebookRunLogs):
staleRunStatues = []
- 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 __evaluateScaleDownZeppelin
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def __evaluateScaleDownZeppelin():
pods = Kubernetes.getPods()
zeppelinServerPods = []
for pod in pods:
if ZEPPELIN_JOB_SERVER_PREFIX in pod.metadata.name:
- 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 __convertTablesToTreeStructure
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def __convertTablesToTreeStructure(self, tables: List):
treeStructure = {}
for table in tables:
if table["database"] not in treeStructure:
treeStructure[table["database"]] = {"views": [], "tables": []}
- 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 count
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def count(self, obj):
"""Count number of workflow and notebook assinged with schedule """
workflow= 0
notebook = 0
schedule = Schedule.objects.get(id= obj.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"