Showing 10 of 10 total issues
File models.py
has 661 lines of code (exceeds 250 allowed). Consider refactoring. Open
###############################################################################
#
# Copyright 2016-2022 by Shoobx, Inc.
#
###############################################################################
Key
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
class Key(models.FakeKey):
_last_modified = _InfoProperty("last_modified")
storage_class = _InfoProperty("storage_class")
metadata = _InfoProperty("metadata")
_etag = _InfoProperty("etag")
Function reset
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def reset(self):
# For every key and multipart, Moto opens a TemporaryFile to write the value of
# those keys. Ensure that these TemporaryFile-objects are closed, and leave no
# filehandles open
for bucket in self.buckets.values():
- 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 put_object
has 14 arguments (exceeds 4 allowed). Consider refactoring. Open
def put_object(
Function __init__
has 13 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function create_multipart_upload
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_multipart_upload(
Function rules
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def rules(self):
if not os.path.exists(self._lifecyle_path):
return []
rules = []
with open(self._lifecyle_path) as file:
- 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 fill_config
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def fill_config(config_path):
"""
Config priority
default values -> config -> env
- 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
for part in key.multipart.parts.values():
part._value_buffer.close()
super().reset()
Function complete
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def complete(self, body):
decode_hex = codecs.getdecoder("hex_codec")
total = bytearray()
md5s = bytearray()
- 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"