Showing 4 of 4 total issues
Function __getitem__
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def __getitem__(self, key: Union[int, str, slice]) -> Union[List[Any], Any]:
if isinstance(key, int):
key_name = self._mapping[key]
return self.__getitem__(key_name)
- 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 __new__
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def __new__(cls, *_, **kwargs: Dict[str, Any]) -> "DataclassDict":
if not hasattr(cls, "dataclass_args"):
raise TypeError(
"You can't instance the class directly, you must inherit it first or "
"use the function 'create_dataclass_dict', 'dataclass_from_dict' or"
- 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 __setattr__
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def __setattr__(self, key: Union[str, int], value: Any):
if key[0] != "_" and key not in self:
field_type = type(value)
if key not in getattr(self, _FIELDS):
- 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 __init_subclass__
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def __init_subclass__(cls, **kwargs: Dict[str, Any]):
cls.dataclass_args = {}
for param_name, param in signature(dataclass).parameters.items():
# both cls and _cls are to avoid bugs with nightly version of python.
- 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"