davidlatwe/MontyDB

View on GitHub

Showing 123 of 188 total issues

Function inclusion has a Cognitive Complexity of 85 (exceeds 5 allowed). Consider refactoring.
Open

def inclusion(fieldwalker, positioned, located_match, init_doc):
    _doc_type = fieldwalker.doc_type

    def _inclusion(node, init_doc=None):
        doc = node.value
Severity: Minor
Found in montydb/engine/project.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 parser has a Cognitive Complexity of 77 (exceeds 5 allowed). Consider refactoring.
Open

    def parser(self, spec, qfilter):
        """ """
        self.array_op_type = self.ARRAY_OP_NORMAL

        for key, val in spec.items():
Severity: Minor
Found in montydb/engine/project.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 queries.py has 671 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import re
from copy import deepcopy
from datetime import datetime
from collections.abc import Mapping

Severity: Major
Found in montydb/engine/queries.py - About 1 day to fix

    File field_walker.py has 650 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class _NoVal(object):
        def __repr__(self):
            return "_NoVal()"
        __slots__ = ()
    
    
    Severity: Major
    Found in montydb/engine/field_walker.py - About 1 day to fix

      File update.py has 606 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      from collections import OrderedDict
      from datetime import datetime
      
      from ..errors import WriteError
      
      
      Severity: Major
      Found in montydb/engine/update.py - About 1 day to fix

        Function exclusion has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
        Open

        def exclusion(fieldwalker, init_doc):
            _doc_type = fieldwalker.doc_type
        
            def _exclusion(node, init_doc=None):
                doc = node.value
        Severity: Minor
        Found in montydb/engine/project.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 extract has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
        Open

            def extract(self, visited_only=False):
                ON_DELETE = False
                if isinstance(self.handler, FieldTreeWriter):
                    ON_DELETE = self.handler.on_delete
        
        
        Severity: Minor
        Found in montydb/engine/field_walker.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

        File collection.py has 410 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import warnings
        from copy import deepcopy
        
        from .base import (
            BaseObject,
        Severity: Minor
        Found in montydb/collection.py - About 5 hrs to fix

          Function parse_all has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
          Open

          def parse_all(query):
          
              field_op_ls = set(QueryFilter({}).field_ops.keys())
              field_op_ls.remove("$eq")
              field_op_ls.remove("$not")
          Severity: Minor
          Found in montydb/engine/queries.py - About 5 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 ordering has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
          Open

          def ordering(fieldwalkers, order, doc_type=None):
              """ """
              total = len(fieldwalkers)
              pre_sect_stack = []
          
          
          Severity: Minor
          Found in montydb/engine/queries.py - About 5 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

          File project.py has 356 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          from ..errors import OperationFailure
          from .queries import QueryFilter
          from .field_walker import _no_val
          from ..types import (
              string_types,
          Severity: Minor
          Found in montydb/engine/project.py - About 4 hrs to fix

            File sqlite.py has 347 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import os
            import shutil
            import sqlite3
            import contextlib
            from collections import OrderedDict
            Severity: Minor
            Found in montydb/storage/sqlite.py - About 4 hrs to fix

              Function parse_slice has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
              Open

                  def parse_slice(self, field_path, slicing):
                      def _slice(fieldwalker):
                          if "$" in field_path:
                              return
              
              
              Severity: Minor
              Found in montydb/engine/project.py - About 4 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 __call__ has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
              Open

                  def __call__(self, array):
                      new_array = (array or [])[:]
                      new_elems = self.mods["$each"][:]
              
                      position = self.mods["$position"]
              Severity: Minor
              Found in montydb/engine/update.py - About 3 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 parse_lte has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
              Open

              def parse_lte(query):
                  _dec_NaN_INF_ls = list(bson.decimal128_NaN_ls) + [bson.decimal128_INF]
              
                  @keep(query)
                  def _lte(fieldwalker):
              Severity: Minor
              Found in montydb/engine/queries.py - About 3 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 _eq_match has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
              Open

              def _eq_match(fieldwalker, query):
                  """ """
                  if is_duckument_type(query):
                      for val in fieldwalker.value:
                          if is_duckument_type(val):
              Severity: Minor
              Found in montydb/engine/queries.py - About 3 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 _iter has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _iter(self, array_only, unpack, pack):
                      """Value iterator
              
                      Args:
                          array_only (bool): Yield only `list` type values.
              Severity: Minor
              Found in montydb/engine/field_walker.py - About 3 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 parse_gte has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
              Open

              def parse_gte(query):
                  @keep(query)
                  def _gte(fieldwalker):
                      for value in fieldwalker.value:
                          if _is_comparable(value, query):
              Severity: Minor
              Found in montydb/engine/queries.py - About 3 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 _perr_doc has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
              Open

              def _perr_doc(val):
                  """
                  For pretty error msg, same as Mongo
                  """
                  v_lis = []
              Severity: Minor
              Found in montydb/engine/project.py - About 3 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 parse_pull has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
              Open

              def parse_pull(field, value_or_conditions, array_filters):
                  if is_duckument_type(value_or_conditions):
                      query_spec = {}
                      for k, v in value_or_conditions.items():
                          if not k[:1] == "$":
              Severity: Minor
              Found in montydb/engine/update.py - About 3 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