optiver/ruruki

View on GitHub

Showing 18 of 18 total issues

File interfaces.py has 708 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""
Database interfaces.
"""
import abc
from collections import MutableSet
Severity: Major
Found in ruruki/interfaces.py - About 1 day to fix

    File graphs.py has 651 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """
    Graph implementations
    """
    from collections import defaultdict
    import json
    Severity: Major
    Found in ruruki/graphs.py - About 1 day to fix

      File entities.py has 461 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      """
      Entities
      """
      from ruruki import interfaces
      
      
      Severity: Minor
      Found in ruruki/entities.py - About 7 hrs to fix

        File cypher_parser.py has 414 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        #pylint: skip-file
        """
        https://s3.amazonaws.com/artifacts.opencypher.org/cypher.ebnf
        """
        import parsley
        Severity: Minor
        Found in ruruki/parsers/cypher_parser.py - About 5 hrs to fix

          Function filter has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
          Open

              def filter(self, label=None, **kwargs):  # pylint: disable=too-many-locals,too-many-branches
                  if label is None and not kwargs:
                      return self
          
                  if label and not kwargs:
          Severity: Minor
          Found in ruruki/entities.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

          TestCypherEval has 30 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class TestCypherEval(base.TestBase):
              def eval_query(self, query_string, expected_value):
                  ast = cypher_parser.Parser(query_string).Cypher()
                  value = cypher_parser.cypher_eval(
                      ast, {"__entityset__": self.graph.vertices}
          Severity: Minor
          Found in ruruki/parsers/tests/test_cypher_parser.py - About 3 hrs to fix

            Graph has 23 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class Graph(interfaces.IGraph):
                """
                In-memory graph database.
            
                See :class:`~.IGraph` for doco.
            Severity: Minor
            Found in ruruki/graphs.py - About 2 hrs to fix

              Function _vertex_constraint_violated has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _vertex_constraint_violated(self, vertex, **kwargs):
                      """
                      Check if the given vertex violates any of the constraints.
              
                      :param vertex: vertex that you are checking for constraint violations.
              Severity: Minor
              Found in ruruki/graphs.py - About 2 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 get_or_create_vertex has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                  def get_or_create_vertex(self, label=None, **kwargs):
                      if not label and not kwargs:
                          return None
              
                      # first check constraints.
              Severity: Minor
              Found in ruruki/graphs.py - About 2 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 _search_for_edge_ids has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

              def _search_for_edge_ids(path):
                  """
                  Internal helper function to search for edges identity numbers
                  based in the directories and the head and tail vertices identity
                  numbers.
              Severity: Minor
              Found in ruruki/graphs.py - About 2 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 get_edges has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

                  def get_edges(self, head=None, label=None, tail=None, **kwargs):
                      if head is None and tail is None:
                          return self.edges.filter(label, **kwargs)
              
                      container = EntitySet()
              Severity: Minor
              Found in ruruki/graphs.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 _search_for_vertex_id has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

              def _search_for_vertex_id(path):
                  """
                  Internal helper function to search for vertices identity numbers
                  based in the directories.
              
              
              Severity: Minor
              Found in ruruki/graphs.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 append_vertex has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  def append_vertex(self, vertex):
                      if vertex.graph is not None and vertex.graph is not self:
                          raise interfaces.DatabaseException(
                              "Can not append vertex {} which is already bound to "
                              "anther graph instance.".format(vertex)
              Severity: Minor
              Found in ruruki/graphs.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

              Avoid deeply nested control flow statements.
              Open

                                      if indexed_entity.properties[key] == value:
                                          raise interfaces.ConstraintViolation(
                                              "{!r} violated constraint {!r}".format(
                                                  vertex, key
                                              )
              Severity: Major
              Found in ruruki/graphs.py - About 45 mins to fix

                Function return_body has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def return_body(context, items, order, skip, limit):
                Severity: Minor
                Found in ruruki/parsers/cypher_parser.py - About 35 mins to fix

                  Function check_new_edge_is_created has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  def check_new_edge_is_created(context, ident, head_ident, tail_ident, label):
                  Severity: Minor
                  Found in ruruki/test_behave/steps/graphs.py - About 35 mins to fix

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

                        def remove_vertex(self, vertex):
                            count = len(vertex.get_both_edges())
                            if count > 0:
                                raise interfaces.VertexBoundByEdges(
                                    "Vertex {0!r} is still bound to another vertex "
                    Severity: Minor
                    Found in ruruki/graphs.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 get_indexes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def get_indexes(self):
                            for label in self._prop_reference:
                                for key in self._prop_reference[label]:
                                    if not key.startswith("_all"):
                                        yield label, key
                    Severity: Minor
                    Found in ruruki/entities.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