sgammon/canteen

View on GitHub

Showing 200 of 1,384 total issues

Function on_message has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

  def on_message(self, handler, socket):  # pragma: no cover

    """ Top-level ``on_message` logic that provides dispatch for inbound
        realtime messages.

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

      def _hamlish_syntax(self, handler, environment_factory, j2config, config):

        """ Prepare a ``HAMLish``-based tempmlate syntax, which is based on
            Ruby's *HAML*, but is extended/modified to be a bit more Pythonic
            and friendly to ``Jinja2``.
Severity: Minor
Found in canteen/logic/template.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 query has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  def query(cls, *args, **kwargs):

    """ Start building a new `model.Query` object, if the underlying adapter
        implements `IndexedModelAdapter`.

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

  def get(cls, key, pipeline=None, _entity=None):

    """ Retrieve an entity by Key from Redis.

        :param key: Target :py:class:`model.Key` to retrieve from storage.
Severity: Minor
Found in canteen/model/adapter/redis.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 set_session has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def set_session(self, session_obj, engine=None):

        """ Set the current session by force.

            :param session_obj: Session object to force-assign as the current
Severity: Minor
Found in canteen/logic/http/semantics.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 _set_key has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def _set_key(self, value=None, **kwargs):

    """ Set this Entity's key manually.

        kwargs
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 service_mappings has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def service_mappings(services, registry_path='/_rpc/meta', protocols=None):

    """ Generates mappings from `url -> service` for registered Canteen RPC
        services.

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

  def __init__(self, key=None,
                     model=ClientSession,
                     **kwargs):

    """ Initialize this ``Session`` object with an ID and session model.
Severity: Minor
Found in canteen/logic/session.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 __init__ has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def __init__(self, value,
                      AND=None,
                      OR=None,
                      _type=KEY_KIND):

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

  def _get_multi(self, keys, **kwargs):

    """ Low-level method for retrieving a set of entities via an iterable of
        keys, all in one go.

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

  def _pluck_indexed(entity, context=None, _map=None):

    """ Zip and pluck only properties that should be indexed. Simply returns a
        set of property descriptors, mapped to ehtir names in a ``dict``, if
        they are marked as needing to be indexed.
Severity: Minor
Found in canteen/model/adapter/abstract.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 to_dict has 10 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def to_dict(self, exclude=tuple(), include=tuple(),
Severity: Major
Found in canteen/model/adapter/core.py - About 1 hr to fix

Function mro has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def mro(cls):

      """ Generate a fully-mixed method resolution order for
          `AbstractModel` subclasses.

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 execute has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def execute(cls, operation, kind, *args, **kwargs):

    """ Acquire a channel and execute an operation, optionally buffering the
        command.

Severity: Minor
Found in canteen/model/adapter/redis.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 template_ast has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def template_ast(self, node, frame=None):  # pragma: no cover

    """ Shim for Jinja2's default ``Jinja``-sytnax-to-Python AST converter.
        Wraps template code in a module-level ``run`` function that binds it
        to an instance of :py:class:`jinja2.Environment`.
Severity: Minor
Found in canteen/logic/template.py - About 1 hr to fix

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

    def __init__(self, module='templates', strict=False):

      """ Initialize this ``ModuleLoader`` with a target top-level ``module``.
          Templates will be loaded under this top level module name, where
          directories are converted to packages and the template file has
Severity: Minor
Found in canteen/logic/template.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 asset_url has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def asset_url(self, type, fragments, arguments):

    """  """

    assert (fragments or arguments)  # must pass at least fragments or arguments
Severity: Minor
Found in canteen/logic/assets.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 flatten has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def flatten(self, join=False):

    """ Flatten this Key into a basic structure suitable for transport or
        storage.

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

    def get(self, key, default=None, _skip=False):

      """ Retrieve an item from the threadcache by key.

          :param key: Key at which an item should exist in the threadcache to
Severity: Minor
Found in canteen/logic/cache.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 url has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def url(name_or_route, route=None, **kwargs):

  """ Decorator for binding a URL (potentially with a name) to some sort of
      handler, which can really be anything from raw types like a ``str`` or a
      ``tuple`` to a full handler/function/class to a foreign WSGI callable.
Severity: Minor
Found in canteen/logic/http/semantics.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