sgammon/canteen

View on GitHub

Showing 1,384 of 1,384 total issues

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

Identical blocks of code found in 2 locations. Consider refactoring.
Open

        status, headers, content_type, content = (
          context['status'],
          context['headers'],
          context['content_type'],
          context['content']
Severity: Minor
Found in canteen/core/runtime.py and 1 other location - About 55 mins to fix
canteen/core/runtime.py on lines 332..336

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 37.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

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

Identical blocks of code found in 2 locations. Consider refactoring.
Open

      status, headers, content_type, content = (
        context['status'],
        context['headers'],
        context['content_type'],
        context['content']
Severity: Minor
Found in canteen/core/runtime.py and 1 other location - About 55 mins to fix
canteen/core/runtime.py on lines 315..319

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 37.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

              if not isinstance(bundle, tuple):  # pragma: no cover
                _key = '.'.join((namespace, bundle)) if namespace else bundle
                property_bucket[_key] = (responder, bundle)
                continue
Severity: Minor
Found in canteen/core/meta.py and 1 other location - About 50 mins to fix
canteen/core/meta.py on lines 441..444

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 36.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

      _metadata['ops']['put'] = _metadata['ops'].get('put', 0) + 1
Severity: Major
Found in canteen/model/adapter/inmemory.py and 2 other locations - About 50 mins to fix
canteen/model/adapter/inmemory.py on lines 218..219
canteen/model/adapter/inmemory.py on lines 311..312

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 36.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

      _metadata['global']['entity_count'] = (
        _metadata['global'].get('entity_count', 0) + 1)
Severity: Major
Found in canteen/model/adapter/inmemory.py and 2 other locations - About 50 mins to fix
canteen/model/adapter/inmemory.py on lines 216..216
canteen/model/adapter/inmemory.py on lines 311..312

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 36.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

        _metadata['ops']['delete'] = (
          _metadata['ops'].get('delete', 0) + 1)
Severity: Major
Found in canteen/model/adapter/inmemory.py and 2 other locations - About 50 mins to fix
canteen/model/adapter/inmemory.py on lines 216..216
canteen/model/adapter/inmemory.py on lines 218..219

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 36.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

              if _global:
                _key = '.'.join((namespace, alias)) if namespace else alias
                property_bucket[_key] = (responder, prop)
                continue
Severity: Minor
Found in canteen/core/meta.py and 1 other location - About 50 mins to fix
canteen/core/meta.py on lines 434..437

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 36.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

Avoid deeply nested control flow statements.
Open

            if index in _metadata and (path, value) in _metadata[index]:
              _metadata[index][(path, value)].remove(target)

              # if there's no keys left in the index, trim it
              if len(_metadata[index][(path, value)]) == 0:
Severity: Major
Found in canteen/model/adapter/inmemory.py - About 45 mins to fix
Severity
Category
Status
Source
Language