sgammon/canteen

View on GitHub

Showing 200 of 1,384 total issues

Avoid too many return statements within this function.
Open

          return iter([response])
Severity: Major
Found in canteen/core/runtime.py - About 30 mins to fix

Avoid too many return statements within this function.
Open

          return iter([response])
Severity: Major
Found in canteen/core/runtime.py - About 30 mins to fix

Avoid too many return statements within this function.
Open

    return [(i, getattr(self, i)) for i in self.__lookup__]
Severity: Major
Found in canteen/model/__init__.py - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return False  # no such property
Severity: Major
Found in canteen/model/query.py - About 30 mins to fix

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

    def redirect(cls, url=None, name=None, permanent=False, code=None,
                 *args, **kwargs):

      """ Prepare an HTTP redirect to ``url`` or ``name``, where ``name`` is a
          named URL bound earlier via the ``url`` decorator.
Severity: Minor
Found in canteen/logic/http/semantics.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

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

    def from_message(cls, message):

      """ DOCSTRING """

      # create an empty model, loading its key
Severity: Minor
Found in canteen/model/adapter/protorpc.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

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

    def initialize_request_state(self, state):  # pragma: no cover

      """ Initialize this service with ``state`` handed-in by ProtoRPC's
          underlying plumbing.

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

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

def run(environment):

    def root(context):
        if 0: yield None
        for event in context.blocks['root'][0](context):
Severity: Minor
Found in canteen/templates/compiled/base.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

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

  def respond(self, content=None, direct=False):

    """ Respond to this ``Handler``'s request with raw ``str`` or ``unicode``
        content. UTF-8 encoding happens if necessary.

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

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

  def compound(cls):

    """ Generate a compound ``Mixin`` class. Builds a new class, composed of all
        available methods on attached mixins.

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

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

  def get(cls, key=None, name=None, adapter=None, **kwargs):

    """ Retrieve a persisted version of this model via the current model
        adapter.

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

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

  def sanitize(cls, content, _iter=True):

    """ Clean yielded template content of preceding and trailing whitespace,
        ensure correct encoding, and chunk/yield efficiently.

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

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

  def delete(cls, key, pipeline=None):

    """ Delete an entity by Key from Redis.

        :param key: Target :py:class:`model.Key`, whose associated
Severity: Minor
Found in canteen/model/adapter/redis.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

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

  def __eq__(self, other):

    """ Test whether two keys are functionally identical.

        Tries the following tests to negate equality:
Severity: Minor
Found in canteen/model/__init__.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

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

def use_setuptools(
    version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
    download_delay=15
):
    """Automatically find/download setuptools and make it available on sys.path
Severity: Minor
Found in ez_setup.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

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

  def delete(cls, key, **kwargs):

    """ Delete an entity by Key from memory.

        :param key: Target :py:class:`model.Key` object at which data should be
Severity: Minor
Found in canteen/model/adapter/inmemory.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

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

    def _get_prop_filter(inverse=False):

      """ Builds a callable that can filter properties
          between internal and user-defined ones. Returns

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

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

    def __repr__(cls):

      """ Generate string representation of `Model` class,
          like "Model(<prop1>, <prop n...>)".

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

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

  def match(self, target):

    """ Match this query's target, operator, and embedded data against a target
        entity or value.

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

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

    def __new__(mcs, name_or_target, bases=None, properties=None):

      """ Construct a new ``Delegate`` subclass.

          :param name_or_target: Either the ``str`` name of a subtype extending
Severity: Minor
Found in canteen/core/injection.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