cuebook/cuelake

View on GitHub
api/genie/services/notebookJobs.py

Summary

Maintainability
D
1 day
Test Coverage
F
53%

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]:
Severity: Minor
Found in api/genie/services/notebookJobs.py - About 1 day to fix

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 notebookJobs.py has 363 lines of code (exceeds 250 allowed). Consider refactoring.
Wontfix

import asyncio
import json
import pytz
import time
import logging
Severity: Minor
Found in api/genie/services/notebookJobs.py - About 4 hrs to fix

    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
    Severity: Minor
    Found in api/genie/services/notebookJobs.py - About 3 hrs to fix

    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
    Severity: Minor
    Found in api/genie/services/notebookJobs.py - About 45 mins to fix

    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

    There are no issues that match your filters.

    Category
    Status