theia/naivestore.py
Function find
has a Cognitive Complexity of 21 (exceeds 10 allowed). Consider refactoring. Open
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.
- Read upRead up
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
Open
def _search_data_file(self, data_file, ts_start, ts_end, flags, match, reverse):
Function search
has 5 arguments (exceeds 4 allowed). Consider refactoring. Invalid
Invalid
def search(self, ts_start, ts_end=None, flags=None, match=None, order='asc'):
Function _match_forward
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def _match_forward(self, data_file, ts_start, ts_end, flags, match):
Function _match_reverse
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def _match_reverse(self, data_file, ts_start, ts_end, flags, match):
Function binary_search
has a Cognitive Complexity of 12 (exceeds 10 allowed). Consider refactoring. Open
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
- Read upRead up
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
Open
return None