Showing 5 of 5 total issues
Function _stream_inflate
has a Cognitive Complexity of 165 (exceeds 5 allowed). Consider refactoring. Open
def _stream_inflate(length_extra_bits_diffs, dist_extra_bits_diffs, cache_size, chunk_size):
literal_stop_or_length_code_lengths = \
(8,) * 144 + \
(9,) * 112 + \
(7,) * 24 + \
- 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
File stream_inflate.py
has 355 lines of code (exceeds 250 allowed). Consider refactoring. Open
from collections import Counter, defaultdict, namedtuple
from queue import Empty, Queue
def stream_inflate(chunk_size=65536):
Function get_deferred_yielder_readers
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_deferred_yielder_readers(reader_has_bit, reader_has_byte, reader_get_bit, reader_get_byte, reader_yield_bytes_up_to):
Function test_stream_inflate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def test_stream_inflate(self):
rnd = random.Random()
strategies = [zlib.Z_DEFAULT_STRATEGY, zlib.Z_FIXED]
levels = [-1, 0, 9]
- 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 test_stream_inflate64
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def test_stream_inflate64(self):
input_sizes = [1, 7, 65536]
output_sizes = [1, 7, 65536]
with open('fixtures/data64.bin', 'rb') as f:
- 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"