sgammon/canteen

View on GitHub

Showing 200 of 1,384 total issues

Function execute_query has a Cognitive Complexity of 229 (exceeds 5 allowed). Consider refactoring.
Open

  def execute_query(cls, kind, spec, options, **kwargs):  # pragma: no cover

    """ Execute a :py:class:`model.Query` across one (or multiple) indexed
        properties.

Severity: Minor
Found in canteen/model/adapter/redis.py - About 4 days 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_query has a Cognitive Complexity of 179 (exceeds 5 allowed). Consider refactoring.
Open

  def execute_query(cls, kind, spec, options, **kwargs):  # pragma: no cover

    """ Execute a query across one (or multiple) indexed properties. Collapses
        a symbolic :py:class:`canteen.model.query.Query` object and attempts to
        properly satisfy any ``Filter``/``Sort`` objects attached.
Severity: Minor
Found in canteen/model/adapter/inmemory.py - About 3 days 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 redis.py has 1141 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

"""

  redis model adapter
Severity: Major
Found in canteen/model/adapter/redis.py - About 2 days to fix

File __init__.py has 1111 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

"""

  model
Severity: Major
Found in canteen/model/__init__.py - About 2 days to fix

Function to_dict has a Cognitive Complexity of 86 (exceeds 5 allowed). Consider refactoring.
Open

  def to_dict(self, exclude=tuple(), include=tuple(),
              filter=None, map=None, _all=False,
              filter_fn=filter, map_fn=map,
              convert_keys=True, convert_models=True, convert_datetime=True):

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

Function collapse has a Cognitive Complexity of 86 (exceeds 5 allowed). Consider refactoring.
Open

    def collapse(cls, spec=None):

      """ Collapse available ``component`` items into a mapping of names to
          objects which can respond to attribute requests for those paths.

Severity: Minor
Found in canteen/core/meta.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 abstract.py has 728 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

"""

  abstract model adapters
Severity: Major
Found in canteen/model/adapter/abstract.py - About 1 day to fix

Function generate_indexes has a Cognitive Complexity of 78 (exceeds 5 allowed). Consider refactoring.
Open

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

    """ Generate a set of indexes that should be written to with associated
        values, considering that some ``key`` values may be ``VertexKey`` or
        ``EdgeKey`` instances.
Severity: Minor
Found in canteen/model/adapter/abstract.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

Function clean_indexes has a Cognitive Complexity of 77 (exceeds 5 allowed). Consider refactoring.
Open

  def clean_indexes(cls, writes, **kwargs):

    """ Clean indexes for a key that is due to be deleted.

        :param writes: Index writes that would be committed if the ``key`` was
Severity: Minor
Found in canteen/model/adapter/inmemory.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 query.py has 672 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

"""

  model queries
Severity: Major
Found in canteen/model/query.py - About 1 day to fix

File template.py has 646 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

"""

  template logic
Severity: Major
Found in canteen/logic/template.py - About 1 day to fix

Function write_indexes has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring.
Open

  def write_indexes(cls, w, g, pipeline=None, execute=True):

    """ Write a batch of index updates generated earlier via
        :py:meth:`RedisAdapter.generate_indexes`.

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

Function write_indexes has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
Open

  def write_indexes(cls, writes, _graph, execute=True):

    """ Write a set of generated indexes via `generate_indexes`.

        :param writes: Index writes to commit to the ``_metadata`` ``dict``.
Severity: Minor
Found in canteen/model/adapter/inmemory.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

Function get_multi has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
Open

  def get_multi(cls, keys, pipeline=None, **kwargs):

    """ Retrieve a set of entity by Key from Redis, all in one go.

        :param keys: Target iterable of :py:class:`model.Key` instances to
Severity: Minor
Found in canteen/model/adapter/redis.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 inmemory.py has 544 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

"""

  in-memory model adapter
Severity: Major
Found in canteen/model/adapter/inmemory.py - About 1 day to fix

Function build_message has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
Open

  def build_message(_model):

    """ Recursively builds a new `Message` class dynamically from a canteen
        :py:class:`model.Model`. Properties are converted to their
        :py:mod:`protorpc` equivalents and factoried into a full
Severity: Minor
Found in canteen/model/adapter/protorpc.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

Function bind_urls has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
Open

  def bind_urls(self):

    """ Bind static asset URLs, if Canteen is instructed to handle requests for
        static assets. Constructs handlers according to URLs and paths from
        application configuration. """
Severity: Minor
Found in canteen/logic/assets.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 __init__.py has 497 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

"""

  RPC
Severity: Minor
Found in canteen/rpc/__init__.py - About 7 hrs to fix

Function environment has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
Open

    def environment(self, _handler, config):

      """ Prepare a new :py:class:`jinja2.Environment` object, for the purpose
          of rendering a template.

Severity: Minor
Found in canteen/logic/template.py - About 7 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 _set_value has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
Open

  def _set_value(self, name, value=EMPTY, _dirty=True):

    """ Set (or reset) the value of a named property on this Entity.

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

Severity
Category
Status
Source
Language