Function parse
has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring. Open
def parse(self, parent):
"""
https://www.w3.org/TR/html5/syntax.html
See: 8.2.5 Tree construction
"""
- 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 measure_column_widths
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def measure_column_widths(self):
table_columns = []
columns = None
for box in self.boxes():
if isinstance(box.behavior, TableRow):
- 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_behavior
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def get_behavior(parent, node):
display = node.style.display
if display == 'block':
- 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 pumper
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def pumper(html_generator):
"""
Pulls HTML from source generator,
feeds it to the parser and yields
DOM elements.
- 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 yield_root_table_rows and isinstance(child_node.behavior, TableRow):
self.css.apply_recursively(child_node)
yield child_element, child_node
Avoid deeply nested control flow statements. Open
for hrow in table.thead.children:
columns.measure(hrow, table_columns[-1])
if table.tfoot:
Avoid deeply nested control flow statements. Open
if previous is not None:
if node.text_allowed and previous[0].tail:
# insert text between previous node and current node
node.insert(len(node.children)-2, previous[0].tail)
position_of_type.setdefault(child_node.tag, 0)
Avoid deeply nested control flow statements. Open
for frow in table.tfoot.children:
columns.measure(frow, table_columns[-1])
columns.measure(box, table_columns[-1])
Avoid too many return
statements within this function. Open
return TableRow(node)
Avoid too many return
statements within this function. Open
return Block(node)
Avoid too many return
statements within this function. Open
return TableColumnGroup(node)
Avoid too many return
statements within this function. Open
return TableRowGroup(node)
Avoid too many return
statements within this function. Open
return TableCell(node)
Avoid too many return
statements within this function. Open
return TableColumn(node)
Avoid too many return
statements within this function. Open
return ListItem(node)