Function _render_node
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _render_node(node, parents, result, nodes_to_parse, pretty=False):
for key, value in node.items():
if isinstance(value, str):
result.append("%s: %s; %s" % (key, value, "\n" if pretty else ""))
elif hasattr(value, "__call__"):
- Read upRead up
- Create a ticketCreate a ticket
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_attr
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def find_attr(self, selector_list, ignore_error=True):
try:
if not isinstance(selector_list, list) or len(selector_list) < 1:
raise WrongArgsError(
self, selector_list, "The provided argument should be a non-empty list."
- Read upRead up
- Create a ticketCreate a ticket
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 replace_element
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def replace_element(self, selector_list, new_style, ignore_error=True):
if new_style is None or not isinstance(new_style, (str, dict)) or not new_style:
if ignore_error:
return
else:
- Read upRead up
- Create a ticketCreate a ticket
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 _render_parents
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _render_parents(self, parents, result):
gen = [parent for parent in parents] if parents else []
for parent in gen:
if isinstance(parent, tuple):
result.append(", ".join(parent))
- Read upRead up
- Create a ticketCreate a ticket
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 _parse__args
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _parse__args(self, *args, **kwargs):
css_styles = {}
if len(args) > 1:
raise WrongContentError(self, args, "Css accepts max one positional argument.")
- Read upRead up
- Create a ticketCreate a ticket
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 render
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def render(self, *args, **kwargs):
pretty = kwargs.pop("pretty", False)
result = []
nodes_to_parse = [([], self.attrs["css_attrs"])]
- Read upRead up
- Create a ticketCreate a ticket
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"