Function _get_args
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def _get_args(
values: list[grammar.ValueType],
handler: _CustomHandler,
) -> Optional[list[Any]]:
queue = values[::-1]
- 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 _get_arg
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def _get_arg(annotation: Any, queue: list[grammar.ValueType]) -> Optional[Any]:
if not queue:
return None
value = queue.pop()
if get_origin(annotation) is Union:
- 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 _process_entry
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def _process_entry(self, entry: Directive) -> Iterator[Directive]:
if isinstance(entry, Custom) and (handlers := self._CUSTOM_HANDLERS.get(entry.type)):
for chandler in handlers:
if (args := _get_args(entry.values or [], chandler)) is not None:
with _wrap_plugin_exception(entry, self._error_logger):
- 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 plugin
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def plugin(
name: str,
*,
param_type: Any = None,
custom_scope: Optional[str] = None,
- 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 None
Avoid too many return
statements within this function. Open
return