Showing 66 of 66 total issues
Function check_send_type
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def check_send_type(
func_name: str,
sendval: T,
annotation: Any,
memo: TypeCheckMemo,
- 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 visit_BinOp
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def visit_BinOp(self, node: BinOp) -> Any:
self.generic_visit(node)
if isinstance(node.op, BitOr):
# If either branch of the BinOp has been transformed to `None`, it means
- 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 check_yield_type
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def check_yield_type(
func_name: str,
yieldval: T,
annotation: Any,
memo: TypeCheckMemo,
- 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
if sys.version_info < (3, 9):
subscript_slice = Index(subscript_slice, ctx=Load())
Avoid deeply nested control flow statements. Open
if is_method_of(property_func, target):
retval = instrument(property_func)
if isfunction(retval):
kwargs[name] = retval
Avoid deeply nested control flow statements. Open
if sys.version_info < (3, 9):
subscript_slice = Index(subscript_slice, ctx=Load())
Function typechecked
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def typechecked(
Avoid deeply nested control flow statements. Open
if len(items) > 1:
new_memo.send_annotation = self._convert_annotation(
items[1]
)
Avoid deeply nested control flow statements. Open
if len(items) > 2:
new_memo.return_annotation = self._convert_annotation(
items[2]
)
else:
Avoid deeply nested control flow statements. Open
if node.args.args:
if node.name == "__new__":
memo_kwargs["self_type"] = Name(
id=node.args.args[0].arg, ctx=Load()
)
Function check_type
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def check_type(
Avoid deeply nested control flow statements. Open
if isinstance(decorator, Call) and decorator.keywords:
self._memo.configuration_overrides = {
kw.arg: kw.value for kw in decorator.keywords if kw.arg
}
Avoid deeply nested control flow statements. Open
if (
isinstance(decorator, Name)
and decorator.id == "staticmethod"
):
break
Avoid deeply nested control flow statements. Open
if expression is None:
item[key] = self._get_import("typing", "Any")
Avoid deeply nested control flow statements. Open
if isfunction(retval):
wrapper = attr.__class__(retval)
setattr(target, key, wrapper)
elif isinstance(attr, property):
Avoid deeply nested control flow statements. Open
if isinstance(annotation_slice, Index):
annotation_slice = (
annotation_slice.value # type: ignore[attr-defined]
)
Function is_ignored_name
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def is_ignored_name(self, expression: expr | Expr | None) -> bool:
top_expression = (
expression.value if isinstance(expression, Expr) else expression
)
- 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
if len(items) > 0:
new_memo.yield_annotation = self._convert_annotation(
items[0]
)
Avoid deeply nested control flow statements. Open
if sys.version_info >= (3, 9):
container = Name("tuple", ctx=Load())
else:
container = self._get_import("typing", "Tuple")
Avoid deeply nested control flow statements. Open
if annotation:
annotations_[Constant(name)] = annotation
check_required = True
else:
annotations_[Constant(name)] = None