File symbol.py
has 312 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
This module defines the symbol table.
"""
from __future__ import annotations
Function __getitem__
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def __getitem__(self, info: Union[str, Tuple[str, str]]) -> Union[Name, List[Name]]:
"""
Retrieves an instance of Name based on its information.
If the information is only a name, then it returns all the names in the
- 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 __add__
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def __add__(self, other: Name) -> Name:
"""
Insert a name to this instance.
"""
if self < other:
- 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 __delitem__
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def __delitem__(self, info: Tuple[str, str]) -> None:
"""
Delete a node from this symbol table. It can be the root node itself.
When it deletes a node, delitem also deletes the children nodes of this
- 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 [child for child in self() if child.name == info]
Avoid too many return
statements within this function. Open
return self.right[info]