theia-log/theia

View on GitHub
theia/naivestore.py

Summary

Maintainability
B
5 hrs
Test Coverage

Function find has a Cognitive Complexity of 21 (exceeds 10 allowed). Consider refactoring.
Open

    def find(self, ts_from, ts_to):
        """Finds the data files that contain the events within the given interval [``ts_from``, ``ts_to``].

        The interval can be open at the end ([``ts_from``, ``Inf``]), by passing ``0`` for ``ts_to``. The interval
        cannot be open at the start.
Severity: Minor
Found in theia/naivestore.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_data_file has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def _search_data_file(self, data_file, ts_start, ts_end, flags, match, reverse):
Severity: Minor
Found in theia/naivestore.py - About 45 mins to fix

    Function search has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Invalid

        def search(self, ts_start, ts_end=None, flags=None, match=None, order='asc'):
    Severity: Minor
    Found in theia/naivestore.py - About 35 mins to fix

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

          def _match_forward(self, data_file, ts_start, ts_end, flags, match):
      Severity: Minor
      Found in theia/naivestore.py - About 35 mins to fix

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

            def _match_reverse(self, data_file, ts_start, ts_end, flags, match):
        Severity: Minor
        Found in theia/naivestore.py - About 35 mins to fix

          Function binary_search has a Cognitive Complexity of 12 (exceeds 10 allowed). Consider refactoring.
          Open

          def binary_search(datafiles, timestamp):
              """Performs a binary search in the list of datafiles, for the index of the first data file that contain events that
              happened at or after the provided timestamp.
          
              :param datafiles: ``list`` of :class:`DataFile`, list of datafiles **sorted** in ascending order by the start
          Severity: Minor
          Found in theia/naivestore.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

          Avoid too many return statements within this function.
          Open

              return None
          Severity: Major
          Found in theia/naivestore.py - About 30 mins to fix

            There are no issues that match your filters.

            Category
            Status