sgammon/canteen

View on GitHub

Showing 200 of 1,384 total issues

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

  def put(cls, key, entity, model, pipeline=None):

    """ Persist an entity to storage in Redis.

        :param key: New (and potentially empty) :py:class:`model.Key` for
Severity: Minor
Found in canteen/model/adapter/redis.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 prepare has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

  def prepare():  # pragma: no cover

    """ Prepare constants and tools for setting up Canteen.

        :returns: ``go``, a closured function that, when called, will begin
Severity: Minor
Found in canteen/setup.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 put has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

  def put(cls, key, entity, model, **kwargs):

    """ Persist an entity to storage in Python RAM.

        :param key: Target :py:class:`model.Key` object at which data should be
Severity: Minor
Found in canteen/model/adapter/inmemory.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 scan has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

  def scan(cls, request, ua):

    """ Scan a target HTTP ``request`` and ``User-Agent`` string for various
        pieces of information, such as an OS, browser/vendor, etc. Also scan
        other request-based headers that can provide hints about supported
Severity: Minor
Found in canteen/logic/http/agent.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

File meta.py has 288 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-

"""

  core meta
Severity: Minor
Found in canteen/core/meta.py - About 2 hrs to fix

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

  def __init__(self, *parts, **kwargs):

    """ Initialize this Key.

        args, kwargs
Severity: Minor
Found in canteen/model/__init__.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 __call__ has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

  def __call__(self, func):

    """ Pair this ``Context`` with the target ``func`` and execute using the
        locally-attached ``requested`` args, potentially using ``rollup``.

Severity: Minor
Found in canteen/core/hooks.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 __init__ has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def __init__(self):

    """  """

    global _server_profiles
Severity: Minor
Found in canteen/model/adapter/redis.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 generate_indexes has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def generate_indexes(cls, key, properties=None):

    """ Generate a set of indexes that should be written to with associated
        values.

Severity: Minor
Found in canteen/model/adapter/abstract.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 __init__ has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  def __init__(self, parser=None, autorun=False, safe=False):

    """ This initializer method is called at the tip of the toolchain tree
        (composed of :py:class:`Tool` classes) to start the process of
        initializing and constructing each :py:mod:`argparse` object.
Severity: Minor
Found in canteen/util/cli.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 stream has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  def stream(self, target, send):  # pragma: no cover

    """ Prepare to consume a stream of packets/messages from ``target``, using
        ``send`` as a callback to transmit messages back to the client.

Severity: Minor
Found in canteen/logic/realtime.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 __get__ has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  def __get__(self, instance, owner):

    """ Descriptor attribute access.

        :param instance:
Severity: Minor
Found in canteen/model/__init__.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

Runtime has 21 functions (exceeds 20 allowed). Consider refactoring.
Open

class Runtime(object):

  """ Describes a structure that can manage and schedule execution for Canteen
      applications. When a Canteen app is running, there is always an active
      ``Runtime`` object behind it.
Severity: Minor
Found in canteen/core/runtime.py - About 2 hrs to fix

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

  def __init__(self, source=None, *targets, **properties):

    """ Initialize this ``Edge`` with a ``Vertex`` ``source`` and ``target``
        pair.

Severity: Minor
Found in canteen/model/__init__.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 walk has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def walk(root=None, debug=__debug__):  # pragma: no cover

  """ Force-walk all packages from ``root`` downward. DANGER: WILL IMPORT ALL
      MODULES BY FORCE, possibly loading code you didn't mean to load, or
      triggering scripts that aren't properly guarded against ``__main__``.
Severity: Minor
Found in canteen/util/__init__.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

File protorpc.py has 252 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-

"""

  protorpc model extensions
Severity: Minor
Found in canteen/model/adapter/protorpc.py - About 2 hrs to fix

File session.py has 252 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-

"""

  session logic
Severity: Minor
Found in canteen/logic/session.py - About 2 hrs to fix

Function main has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

def main(argv, version=DEFAULT_VERSION):
    """Install or upgrade setuptools and EasyInstall"""
    try:
        import setuptools
    except ImportError:
Severity: Minor
Found in ez_setup.py - About 1 hr 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_value has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def _get_value(self, name, default=None):

    """ Retrieve the value of a named property on this Entity.

        :param name:
Severity: Minor
Found in canteen/model/__init__.py - About 1 hr 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 wrap has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def wrap(self, dispatch):

    """  """

    if not self.__wrapped__:
Severity: Minor
Found in canteen/core/runtime.py - About 1 hr 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