sgammon/canteen

View on GitHub

Showing 200 of 1,384 total issues

Avoid deeply nested control flow statements.
Open

                  if hasattr(obj, property_name):
                    return getattr(obj, property_name)  # pragma: nocover

Severity: Major
Found in canteen/core/meta.py - About 45 mins to fix

Function pack has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def pack(self, encode=True):

    """ Pack this set of ``QueryOptions`` into a string describing the
        constituent settings it contains.

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

Function pack has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def pack(self, encode=True):

    """ Pack this ``Query`` instance into a structure uniquely describing it,
        with the ability to optionally expand that into a ``Query`` object
        representing the same operations.
Severity: Minor
Found in canteen/model/query.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

Avoid deeply nested control flow statements.
Open

                  if klass.__binding__ and klass.__binding__.__alias__:
                    parent_ref = '.'.join((
                      klass.__binding__.__alias__, property_name))
                    if parent_ref in pool:
                      return pool[parent_ref]
Severity: Major
Found in canteen/core/meta.py - About 45 mins to fix

Function __enter__ has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def __enter__(self):

    """ Context entrance method, responsible for triggering a load of the top-
        level package and propagating exceptions if ``strict`` mode is active.

Severity: Minor
Found in canteen/core/runtime.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

Function prepare has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def prepare(mcs, target):

      """ Prepare ``target`` (usually ``cls``) for injection, possibly resolving
          a global singleton object to be returned upon matching attribute
          requests.
Severity: Minor
Found in canteen/core/meta.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

Avoid deeply nested control flow statements.
Open

                  if hasattr(klass, '__aliases__') and (
                    property_name in klass.__aliases__):
                    return getattr(obj, klass.__aliases__[property_name])
                  if hasattr(obj, property_name):
Severity: Major
Found in canteen/core/meta.py - About 45 mins to fix

Function run has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def run(output=None,
Severity: Minor
Found in canteen/test.py - About 45 mins to fix

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

  def __init__(self, prop, value,
Severity: Minor
Found in canteen/model/query.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

              if not isinstance(bundle, tuple):  # pragma: no cover
                _key = '.'.join((namespace, bundle)) if namespace else bundle
                property_bucket[_key] = (responder, bundle)
                continue

Severity: Major
Found in canteen/core/meta.py - About 45 mins to fix

Consider simplifying this complex logical expression.
Open

    if not (isinstance(value, (model.Key, model.Model)) or (
            isinstance(value, type) and issubclass(value, model.Model)) or (
            value is None)):
      raise ValueError('`KeyFilter` value must be a `Key`, model class,'
                       ' or `None`. Instead, got: "%s".' % repr(value))
Severity: Major
Found in canteen/model/query.py - About 40 mins to fix

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

  def render(self, handler, config, template, ctx, _direct=False):
Severity: Minor
Found in canteen/logic/template.py - About 35 mins to fix

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

  def execute_query(cls, kind, spec, options, **kwargs):  # pragma: no cover
Severity: Minor
Found in canteen/model/adapter/redis.py - About 35 mins to fix

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

  def execute(cls, operation, kind, *args, **kwargs):
Severity: Minor
Found in canteen/model/adapter/redis.py - About 35 mins to fix

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

def run(app=None,
Severity: Minor
Found in canteen/dispatch.py - About 35 mins to fix

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

  def commit(self, status, headers, request, http, response):
Severity: Minor
Found in canteen/logic/session.py - About 35 mins to fix

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

  def put(cls, key, entity, model, pipeline=None):
Severity: Minor
Found in canteen/model/adapter/redis.py - About 35 mins to fix

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

  def allocate_ids(cls, key_class, kind, count=1, pipeline=None):
Severity: Minor
Found in canteen/model/adapter/redis.py - About 35 mins to fix

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

  def write_indexes(cls, w, g, pipeline=None, execute=True):
Severity: Minor
Found in canteen/model/adapter/redis.py - About 35 mins to fix

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

  def establish(self, environ, endpoint, arguments, request, http):
Severity: Minor
Found in canteen/logic/session.py - About 35 mins to fix
Severity
Category
Status
Source
Language