sgammon/canteen

View on GitHub

Showing 200 of 1,384 total issues

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

  def __call__(self, arguments, unknown=None):  # pragma: no cover

    """ Begins dispatching execution from a set of parsed arguments, as the
        product of a :py:meth:`parser.parse_args()` call.

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

      def encode_message(self, message):

        """  """

        message.check_initialized()
Severity: Minor
Found in canteen/rpc/protocol/msgpack.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, **kwargs):

    """ Low-level method for retrieving an entity by Key. Fetches and
        deserializes the given entity, if it exists, or returns ``None``.

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

  def __call__(self, *args, **kwargs):

    """ Execute this local ``HookResponder``, which will dispatch the underlying
        hook target, passing along any arguments and keyword arguments.

Severity: Minor
Found in canteen/core/hooks.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 10 (exceeds 5 allowed). Consider refactoring.
Open

  def _execute(self, options=None, adapter=None, **kwargs):

    """ Internal method to execute a query, optionally along with some override
        options.

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

    def to_message(self, *args, **kwargs):

      """ Convert a `Model` instance to a ProtoRPC `Message` class.

          :param args: Positional arguments to pass to
Severity: Minor
Found in canteen/model/adapter/protorpc.py - About 55 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 allocate_ids has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def allocate_ids(cls, key_class, kind, count=1, pipeline=None):

    """ Allocate new :py:class:`model.Key` IDs up to ``count``. Allocated IDs
        are guaranteed not to be provisioned or otherwise used by the underlying
        persistence engine, and thus can be used for uniquely identifying
Severity: Minor
Found in canteen/model/adapter/redis.py - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
Open

    def __new__(mcs, name, chain, _map):

      """ Read mapped properties, store on the object, along with a reverse
          mapping.

Severity: Minor
Found in canteen/util/struct.py - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
Open

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

    """ Construct a new ``MetaFactory`` concrete class, implementing the
        ``initialize`` protocol for bootstrapping meta-implementing classes
        dynamically, potentially with DI-enabled MRO.
Severity: Minor
Found in canteen/core/meta.py - About 55 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 __init__ has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def __init__(self, prop, value,
                            AND=None,
                            OR=None,
                            type=PROPERTY,
                            operator=EQUALS):
Severity: Minor
Found in canteen/model/query.py - About 55 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 register has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def register(meta, target):

      """ Register a new constructed subclass at ``target``, utilizing
          ``meta``'s chain.

Severity: Minor
Found in canteen/core/meta.py - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
Open

  def pack(self, encode=True):

    """ Pack a ``QueryComponent`` object into a structure uniquely describing
        the operation it specifies, that can optionally later be used to
        reproduce another ``QueryComponent`` object just like it.
Severity: Minor
Found in canteen/model/query.py - About 55 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 redirect has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def redirect(cls, url=None, name=None, permanent=False, code=None,
Severity: Major
Found in canteen/logic/http/semantics.py - About 50 mins to fix

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

  def __init__(self, name, basetype,
Severity: Major
Found in canteen/model/__init__.py - About 50 mins to fix

Avoid deeply nested control flow statements.
Open

            if isinstance(v, (staticmethod, classmethod)):
              v = v.__func__  # unwrap from wrapped class/static decorator

            # is this a bound (i.e. dependency-injected) method?
            if hasattr(v, '__binding__') and v.__binding__:
Severity: Major
Found in canteen/util/decorators.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

            if hasattr(v, '__binding__') and v.__binding__:
              _bindings.add(k)
              if v.__binding__.__alias__:
                _aliases[v.__binding__.__alias__] = k

Severity: Major
Found in canteen/util/decorators.py - About 45 mins to fix

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

    def __init__(self, module, sources, target, config,
Severity: Minor
Found in canteen/logic/template.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

            if not isinstance(_pargs, list):
              _pargs = [i for i in _pargs]

Severity: Major
Found in canteen/model/adapter/protorpc.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

            if isinstance(_filter_kind, basestring) and _filter_kind in (
                  frozenset(('Edge', 'Vertex', 'Model'))):

              # we are querying for all [edges,vertexes,models]
              _filter_key = (
Severity: Major
Found in canteen/model/adapter/redis.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

            if subquery.sub_operator is query.AND:
              _and_filters.append(subquery)
            if subquery.sub_operator is query.OR:
Severity: Major
Found in canteen/model/adapter/redis.py - About 45 mins to fix
Severity
Category
Status
Source
Language