Line
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
class Line:
"""
A Line is a collection of Nodes and Comments that should be printed together, on a
single line.
"""
- Create a ticketCreate a ticket
Consider simplifying this complex logical expression. Open
if (
self.nodes
and self.previous_node is not None
and self.previous_node.open_jinja_blocks
and (
- Create a ticketCreate a ticket
Function starts_new_segment
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Wontfix
def starts_new_segment(self, prev_segment_depth: Tuple[int, int]) -> bool:
if self.depth <= prev_segment_depth or self.depth[1] < prev_segment_depth[1]:
# if this line starts with a closing bracket,
# we want to include that closing bracket
# in the same segment as the first line.
- 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_with_comments
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def render_with_comments(self, max_length: int) -> str:
"""
Returns a string that represents the properly-formatted Line,
including associated comments
"""
- 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 opens_new_bracket
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def opens_new_bracket(self) -> bool:
"""
Returns True iff the Nodes in this Line open a new explicit bracket and do
not also close that bracket
"""
- 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"