Showing 10 of 11 total issues
Function deserialize
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def deserialize(
self, t: Any, value: Any, convert_key: Callable = lambda x: x
) -> Any:
if t in self.serializers:
return self.serializers[t].deserialize(value)
- 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 find_unsupported
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def find_unsupported(t: typing.Any) -> typing.List[typing.Any]:
if t in SCALAR_TYPES:
return []
if isinstance(t, type): # if it's a class
if issubclass(t, enum.Enum):
- 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 serialize
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def serialize(self, obj: Any, convert_key: Callable = lambda x: x) -> Any:
for t in self.serializers:
if isinstance(obj, t):
return self.serializers[t].serialize(obj)
- 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
return [t]
Avoid too many return
statements within this function. Open
return obj
Avoid too many return
statements within this function. Open
return find_unsupported(t.__args__[0])
Avoid too many return
statements within this function. Open
return [self.serialize(i, convert_key) for i in obj]
Avoid too many return
statements within this function. Open
return [arg for arg in t.__args__ if find_unsupported(arg)]
Avoid too many return
statements within this function. Open
return [self.deserialize(args[0], item, convert_key) for item in value]
Avoid too many return
statements within this function. Open
return self.deserialize(arg, value, convert_key)