Showing 5 of 69 total issues
Function read
has a Cognitive Complexity of 60 (exceeds 50 allowed). Consider refactoring. Open
Open
def read(self, fp):
sections = []
matched = False
self.valid = True
meta_data = defaultdict(list)
- 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 deeply nested control flow statements. Open
Open
if reader is None:
print("*EF", enc, form, start, attr, abbr)
start = image.tell()
Avoid deeply nested control flow statements. Open
Open
if "chunk" in dict_:
if self.parseData(container, format_type):
chunk = bytearray.fromhex(dict_["chunk"])
else:
# don't convert/parse stuff like symbols.
Avoid deeply nested control flow statements. Open
Open
for key, value in dict_.items():
if key not in ("chunk", "junk"):
setattr(container, key, atoi(value))
elif key == "junk":
setattr(container, key, value)
Avoid deeply nested control flow statements. Open
Open
if self.is_data_line(container, format_type):
sections.append(Section(container.address, container.chunk))
else:
chunk = (
container.chunk if hasattr(container, "chunk") else None