MichalKononenko/OmicronServer

View on GitHub

Showing 6 of 21 total issues

Function restful_pagination has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

def restful_pagination(default_items_per_page=1000):
    """
    Wraps a RESTful getter, extracting the arguments
    ``page`` and ``items_per_page`` from the URL query parameter.
    These arguments are then parsed into integers, and returned as a
Severity: Minor
Found in omicron_server/decorators.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 crossdomain has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

def crossdomain(origin=None, methods=None, headers=conf.ALLOWED_HEADERS,
                max_age=21600, attach_to_all=True,
                automatic_options=True):
    """
    Fills in access control headers for a given endpoint function, enabling
Severity: Minor
Found in omicron_server/decorators.py - About 2 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 crossdomain has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

def crossdomain(origin=None, methods=None, headers=conf.ALLOWED_HEADERS,
Severity: Minor
Found in omicron_server/decorators.py - About 45 mins to fix

    Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(self, metadata=meta, database_url=None,
    Severity: Minor
    Found in omicron_server/database/versioning.py - About 35 mins to fix

      Function __init__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def __init__(self, conf_dict=os.environ):
              """
              Instantiate config parameters from environment variables
      
              :param conf_dict: The dictionary or dictionary-like object from which
      Severity: Minor
      Found in omicron_server/config.py - About 35 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

      Function get_token_string has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_token_string(self, req_to_parse):
              """
              Parse the request to get the token that should be deleted. If the
              user authenticated from a token, use that token. If the user did not,
              return the token from the request body.
      Severity: Minor
      Found in omicron_server/views/tokens.py - About 25 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

      Severity
      Category
      Status
      Source
      Language