fuzeman/byte

View on GitHub

Showing 38 of 86 total issues

File model.py has 332 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

"""byte - model module."""

from __future__ import absolute_import, division, print_function
Severity: Minor
Found in byte/model.py - About 4 hrs to fix

    Expressions has 31 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Expressions(object):
        """Expressions class."""
    
        def and_(self, *values):
            """Create and expression."""
    Severity: Minor
    Found in byte/core/models/expressions/base.py - About 3 hrs to fix

      File property.py has 309 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      
      """byte - property module."""
      from __future__ import absolute_import, division, print_function
      
      
      Severity: Minor
      Found in byte/property.py - About 3 hrs to fix

        File manager.py has 281 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        """byte - plugin manager module."""
        
        from __future__ import absolute_import, division, print_function
        
        from byte import __path__ as byte_path
        Severity: Minor
        Found in byte/core/plugin/manager.py - About 2 hrs to fix

          Collection has 24 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Collection(object):
              """Collection for the storage of keyed items."""
          
              def __init__(self, model_or_uri=None, uri=None, model=None, executor=None, plugins=None, **kwargs):
                  """
          Severity: Minor
          Found in byte/collection.py - About 2 hrs to fix

            Function update has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

                def update(self, modules=None, reset=True):
                    """Update plugins registry.
            
                    :param modules: Modules to scan for plugins
                    :type modules: list of module
            Severity: Minor
            Found in byte/core/plugin/manager.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 order_by has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                def order_by(self, *properties):
                    """Order results by :code:`properties`."""
                    if 'order_by' not in self.state:
                        self.state['order_by'] = []
            
            
            Severity: Minor
            Found in byte/queries/select.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 index_insertions has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                def index_insertions(self, primary_key):
                    """Index insertion operations by primary key."""
                    insertions = {}
            
                    for operation in self.operations:
            Severity: Minor
            Found in byte/core/models/task/simple.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 discover has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                def discover(cls, packages=('compilers', 'executors', 'formats')):
                    """Discover plugin modules.
            
                    :param packages: Package names
                    :type packages: tuple of str
            Severity: Minor
            Found in byte/core/plugin/manager.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 __construct_expression has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                def __construct_expression(self, expressions, op, left, right):
                    if op in ['eq', '=', '==']:
                        return ProxyEqual(left, right)
            
                    if op in ['ne', '!=']:
            Severity: Minor
            Found in byte/queries/where/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 __parse_string_parts has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                def __parse_string_parts(self, parts, offset=0, parameters=None):
                    if (len(parts) - 1) % 2 > 0:
                        raise ValueError('Incorrect number of expression parts')
            
                    if parts[0] == '(' and parts[-1] == ')':
            Severity: Minor
            Found in byte/queries/where/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 __init__ has 8 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def __init__(self, value_type, by=None, default=None, max_length=None, name=None, nullable=False,
            Severity: Major
            Found in byte/property.py - About 1 hr to fix

              Function __create_init has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  def __create_init(bases, namespace, properties):
                      original = namespace.get('__init__')
              
                      def __init__(self, *args, **kwargs):
                          self.__collection__ = kwargs.pop('_collection', None)
              Severity: Minor
              Found in byte/model.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 from_plain has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  def from_plain(cls, data, strict=True, translate=False):
                      """
                      Parse model item from plain dictionary.
              
                      :param data: Item data
              Severity: Minor
              Found in byte/model.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 is_tuple_of has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              def is_tuple_of(items, value_type):
                  """Validate tuple :code:`items` match :code:`value_type`.
              
                  :param items: Items
                  :type items: tuple
              Severity: Minor
              Found in byte/core/helpers/validate.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 register_collections has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def register_collections(self, plugin, meta):
                      """Register plugin in collections.
              
                      :param plugin: Plugin
                      :param meta: Plugin metadata
              Severity: Minor
              Found in byte/core/plugin/manager.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 __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def __init__(self, collection, model, items=None, properties=None, query=None, state=None):
              Severity: Minor
              Found in byte/queries/insert.py - About 45 mins to fix

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

                    def __init__(self, model_or_uri=None, uri=None, model=None, executor=None, plugins=None, **kwargs):
                Severity: Minor
                Found in byte/collection.py - About 45 mins to fix

                  Function __parse_string has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def __parse_string(self, value, *parameters):
                          if not value:
                              return []
                  
                          if len(parameters) == 1 and type(parameters[0]) is tuple:
                  Severity: Minor
                  Found in byte/queries/where/query.py - About 35 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 discover_package has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def discover_package(package, package_path):
                          """Discover plugin modules in package.
                  
                          :param package: Package name
                          :type package: str
                  Severity: Minor
                  Found in byte/core/plugin/manager.py - About 35 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